针对Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1的解决方案
背景:本项目使用JDK1.8
编译maven工程的时候出现如下错误:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1
pom中如下配置maven插件,配置中声明使用JDK1.8:
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
- <configuration>
- <verbose>true</verbose>
- <fork>true</fork>
- <executable>${JAVA8_HOME}/bin/javac</executable>
- </configuration>
- </plugin>
这里的${JAVA8_HOME}这个变量是在settings.xml中配置的,如下:
- <profile>
- <id>custom-compiler</id>
- <properties>
- <JAVA8_HOME>C:\Program Files (x86)\Java\jdk1.8.0_73</JAVA8_HOME>
- </properties>
- </profile>
当然这里应该需要激活,所以settings.xml文件还应该有如下配置:
- <activeProfiles>
- <activeProfile>custom-compiler</activeProfile>
- </activeProfiles>
从pom文件中CTRL点击变量JAVA8_HOME能跳到settings.xml中找到它的定义处,按理来说应该是能找到这个变量,出现上述问题并不是因为找不到这个变量。我将pom文件中的JAVA8_HOME这个变量直接用实际的路径替换,即替换为
- C:\Program Files (x86)\Java\jdk1.8.0_73\bin\javac
发现编译通过,这就奇怪了。
揭晓原因:
maven其实是有一个默认的仓库.m2仓库和默认的settings.xml配置文件,我们在这个默认的settings.xml文件中也添加了一个JAVA8_HOME的变量后,编译就通过了,这就说明,maven编译的时候找的不是我在idea中配置的我自定义的settings.xml,而是先找的它默认的那个。因为里面没有,所以之前找不到JAVA8_HOME,导致编译失败、
总结:maven编译的时候应该是先找的默认的settings.xml,如果找不到,才会去找我在idea的settings选项下配置的“User settings file”中配置的settings.xml文件。
解决办法:删掉maven默认的去找的那个settings.xml文件,这样自定义的文件就会生效了
针对Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1的解决方案的更多相关文章
- maven install Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project web_nanchang
maven打包成war时,报错:Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default- ...
- Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (dist) on project hadoop-kms: An Ant BuildException has occured
编译cdh版hadoop2.5.0出现的问题 系统: CentOs66 64位 JDK:1.7 Maven: 3.0.5 Protobuf: libprotoc 2.5.0 编译命令: mvn pac ...
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project LogTest: Compilation failure -> [Help 1]
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default ...
- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:
security-sdk-1.0.jar已经存在于D:/secServerSDK-test/src/main/resources/lib下 报错如下: xxxxxx@xxxxxxxx /d/secSe ...
- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:create (default-cli) on project standalone-pom: Unable to parse configuration of 3: mojo org.apache.maven.plugins:
问题: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:create (defau ...
- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (default-jar) on
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (default-jar) on ...
- maven install 报错Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project*****
[ERROR]Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-co ...
- Maven Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean Failed to delete access_log
I'm trying to run simple struts project using maven and tomcat. When I'm trying to exucute next goal ...
- 解决Failed to execute goal org.apache.maven.plugins
1.Maven构建失败 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin: 2.3 . 2 :compile ...
随机推荐
- 【codeforces 755E】PolandBall and White-Red graph
[题目链接]:http://codeforces.com/contest/755/problem/E [题意] 给你n个节点; 让你在这些点之间接若干条边;构成原图(要求n个节点都联通) 然后分别求出 ...
- redis学习三,Redis主从复制和哨兵模式
Redis主从复制 java架构师项目实战,高并发集群分布式,大数据高可用,视频教程 1.Master可以拥有多个slave 2.多个slave可以连接同一个Master外,还可以连接到其他的slav ...
- java中String类型转换为float类型
import java.io.*; public class Demo1{ public static void main(String args[]) { String df="12.2& ...
- 【ACM】hdu_zs3_1008_Train Problem I_201308100835
Train Problem I Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Tota ...
- Linux Container测试之block IO
简介 Linux Container是OS级别的虚拟化方案,它相比于一般的虚拟机没有了硬件模拟以及指令模拟,相比传统虚拟机具有更低的开销,因此可以应用到私有云之中.LXC目前的版本支持对memor ...
- MRO 方法解释顺序
MRO是用在多重继承中的.考虑这种情况,整个环境中父类是两个 P1,P2 子类是两个 C1,C2 而 孙子类是G1. 我们知道 G1会从 P1,P2,C1,C2中继承属性,但是如果有多个属性重名,那么 ...
- iOS: 将OC的NSMutableArray转为Swift的Array
一句话: YourSwiftObject convertedArray = your_MutableArray as NSArray as [YourSwiftObject]
- PHP array_intersect_uassoc()
定义和用法 array_intersect_uassoc() 函数使用用户自定义的回调函数计算数组的交集,用回调函数比较索引. array_intersect_uassoc() 返回一个数组,该数组包 ...
- PHP array_intersect()
定义和用法 array_intersect() 函数返回两个或多个数组的交集数组. 结果数组包含了所有在被比较数组中,也同时出现在所有其他参数数组中的值,键名保留不变. 注释:仅有值用于比较. 语法 ...
- WPF学习笔记——ListBox用ItemsSource绑定数据源
作为一个WPF初学者,感到困难重重.在网上想查个ListBox绑定数据源的示例,结果出来一大堆代码,一看心就烦. 我给个简洁一点的代码: 后台代码: protected class UserItem ...