执行Maven打包时候报错如下:
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[WARNING] 'build.pluginManagement.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.apache.maven.plugins:maven-war-plugin @ line 620, column 25
[FATAL] Non-resolvable parent POM for com.xxx.xxx:xxx:1.0.0-SNAPSHOT: Failure to find com.xxx:dolphin-parent:pom:1.2.0 in http://maven.xxx.com.cn/nexus/content/groups/xxx-group/ was cached in the local repository, resolution will not be reattempted until the update interval of xxx-down has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 13, column 13
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.xxx.xxx:xxx:1.0.0-SNAPSHOT (D:\rep\svnRep\\xxx-web\pom.xml) has 1 error
[ERROR] Non-resolvable parent POM for com.xxx.xxx:xxx:1.0.0-SNAPSHOT: Failure to find com.xxx:dolphin-parent:pom:1.2.0 in http://maven.xxx.com.cn/nexus/content/groups/xxx-group/ was cached in the local repository, resolution will not be reattempted until the update interval of xxx-down has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 13, column 13 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
仔细检查后发现因为公司给这个项目配置的maven私服不一样的,在引入eclipse后选择不一样User Settings文件,如下图:
image.png
而通过CMD打包时候,默认用apache-maven-3.5.2/conf/settings.xml为配置文件的。
为此我们可以在打包命令中加入 --settings D:\soft\apache-maven-3.5.2\conf\settings_custom.xml 以指定本次打包所使用的配置文件,完整打包命令如下:
mvn clean package --settings D:\soft\apache-maven-3.5.2\conf\settings_custom.xml -DskipTests
网友评论