针对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 ...
随机推荐
- Myeclipse学习总结(1)——Myeclipse优化配置
作为企业级开发最流行的工具,用Myeclipse开发java web程序无疑是最合适的,java web前端采用jsp来显示,myeclipse默认打开jsp的视图有卡顿的现象,那么如何更改jsp默认 ...
- 在django里用xlwt作EXCEL导出功能
参考了以前kevin的代码,搞起来快呀,哈哈哈,,阿里亚多.... 代码的意思比较明白,不注释,几乎自解释... 就是定义EXCEL时,比较硬生生的,一步一步没有快捷的方法. 另外就是取时间出来时,如 ...
- awr ash addm
awr ash addm awr addm :基于快照的ash :单独,每秒采样 dbtime=db cpu + wait 柜员忙碌的时间=A做业务的时间+B做业务的时间等待时间=B等待A做业务的时间 ...
- eclipse上导入import git项目
1.左上角File->import->git eclipse 可以从很多来源处import项目,项目来源可以使git/maven/general等. import来源可以看下面 2.点击g ...
- myeclipse git 上下箭头表示什么
myeclipse git 上下箭头表示什么? 向上箭头表示本地有提交(commit),但是还没有推(push)到远程代码库中,旁边的数字表示本地commit的次数: 向下箭头表示你拉(fetch)下 ...
- UVA 10859 树形DP
很明显的树形DP了,设状态dp[i][0],dp[i][1].枚举子节点放或不放的两种状态. 在此学到一种不同于一般处理的方法,题目要求被两灯照亮的边尽量多,反过来即被一灯照亮的尽量少设为e.又需要的 ...
- the solution of CountNonDivisible by Codility
question:https://codility.com/programmers/lessons/9 To solve this question , I get each element's di ...
- BZOJ 2048 2009国家集训队 书堆 数学算法
题目大意:经典的物理上的桌边堆书问题,初中物理老师以前还讲过,只是仅仅记住了结论. . . 没关系,简单证明一下就好 首先我们设由上至下第i本书比它以下那本书多伸出去的长度为a[i],前缀和为s[i] ...
- oc26--Property,省略setget的声明
// // Person.h #import <Foundation/Foundation.h> @interface Person : NSObject { int _age; } /* ...
- Google Deepmind AI tries it hand at creating Hearthstone and Magic: The Gathering cards
http://www.techrepublic.com/article/google-deepmind-ai-tries-it-hand-at-creating-hearthstone-magic-t ...