针对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 ...
随机推荐
- Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method fail
SpringBoot 单元测试报错 @RunWith(SpringRunner.class) @SpringBootTest public class ProductCategoryRepositor ...
- Jquery书写ajax
根据API学习本章 Jquery书写ajax 使用ajax发送表单到servlet,发送时显示等待图片,servlet处理完返回信息,在页面显示返回信息,并且隐藏等待图片 <%@ page la ...
- Vim+xxd=强大的十六进制编辑器
Vim 是黑客文化中强大的编辑器.利用它调用外部十六进制文件显示命令xxd就可以顺利的编辑二进制文件了. 其中,%在vimComandLine时代表当前文件的路径,xxd是以十六进制显示一个文件,xx ...
- Axure RP一个专业的高速原型设计工具
Axure RP是一个专业的高速原型设计工具.Axure(发音:Ack-sure),代表美国Axure公司.RP则是Rapid Prototyping(高速原型)的缩写. Axure简要介绍 Axur ...
- Android游戏框架Libgdx使用入门
转载自:http://blog.csdn.net/cping1982/article/details/6176191 Libgdx作者博客:http://www.badlogicgames.com/ ...
- CF 447A(DZY Loves Hash-简单判重)
A. DZY Loves Hash time limit per test 1 second memory limit per test 256 megabytes input standard in ...
- HDU3183 RMQ/贪心
A Magic Lamp Problem Description Kiki likes traveling. One day she finds a magic lamp, unfortunately ...
- sharepoint类型转换
sharepoint学习汇总 http://blog.csdn.net/qq873113580/article/details/20390149 r[col.ColumnName] = GetType ...
- 清橙A1206.小Z的袜子 && CF 86D(莫队两题)
清橙A1206.小Z的袜子 && CF 86D(莫队两题) 在网上看了一些别人写的关于莫队算法的介绍,我认为,莫队与其说是一种算法,不如说是一种思想,他通过先分块再排序来优化离线查询问 ...
- B1001 狼抓兔子 最小割
题目描述 现在小朋友们最喜欢的"喜羊羊与灰太狼",话说灰太狼抓羊不到,但抓兔子还是比较在行的, 而且现在的兔子还比较笨,它们只有两个窝,现在你做为狼王,面对下面这样一个网格的地形: ...