maven package 打包报错 Failed to execute goal的解决
总结一下maven 打包,项目工程开发工具idea14,使用 jdk 1.8 版本
1.打包前需要先将idea关掉,不然会导致mvn clean的时候,部分文件删除不掉,mvn package的时候,也会丢失文件。
2.mvn package打包报错:[error] failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.6.1:clean (default-clean) on project
解决办法:
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>${java_home}/bin/javac</executable> </configuration> </plugin>
这边的${java8_home}可能获取不了,可以直接写路径:
${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>
揭晓原因:
idea本身可以编译通过的原因是:maven其实是有一个默认的仓库.m2仓库和默认的settings.xml配置文件,这个默认的settings.xml文件中也添加了一个java_home的变量后,编译就通过了。而在用cmd窗口mvn package命令打包,报编译失败,这就说明,maven编译的时候找的不是我在idea中配置的settings.xml,而是找的我原来配置e:\tools\maven\conf下的settings.xml。因为里面没有默认配置编译使用1.8版本的jdk,所以之前找不到java_home,导致编译失败。
到此这篇关于maven package 打包报错 failed to execute goal的解决的文章就介绍到这了,更多相关maven package 打包报错 内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!
上一篇: Mysql删除数据以及数据表的方法实例
下一篇: Postman使用详解
推荐阅读
-
针对maven install 报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1 解决方案
-
maven package 打包报错 Failed to execute goal的解决
-
Maven error: Failed to execute goal on project : Could not resolve dependencies for project 解决办法
-
maven多项目打包报错---子模块相互依赖打包时所遇到的问题:依赖的程序包找不到 package xxx does not exist
-
Pyinstaller 打包exe 报错 "failed to execute script XXX"的一种解决方案
-
Python自动发邮件以及打包报错failed to execute script和DLL load failed while importing win32api: 找不到指定的模块
-
jetty启动项目报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugi
-
jetty启动项目报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugi
-
Maven打包错误:Failed to execute goal on project client: Could not resolve dependencies for project
-
针对maven install 报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1 解决方案