Maven 打包报错,log4j版本导致
Posted hanwen1014
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Maven 打包报错,log4j版本导致相关的知识,希望对你有一定的参考价值。
# 在执行打包的时候 mvn clean assembly:assembly # 发生上面的错误 ------------------------------ [INFO] Total time: 2.872 s [INFO] Finished at: 2019-08-08T13:44:10+08:00 [INFO] Final Memory: 13M/168M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project FlinkTest: Could not resolve dependencies for project com.badou:FlinkTest:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: javax.jms:jms:jar:1.1, com.sun.jdmk:jmxtools:jar:1.2.1, com.sun.jmx:jmxri:jar:1.2.1: Could not transfer artifact javax.jms:jms:jar:1.1 from/to java.net (https://maven-repository.dev.java.net/nonav/repository): Cannot access https://maven-repository.dev.java.net/nonav/repository with type legacy using the available connector factories: BasicRepositoryConnectorFactory: Cannot access https://maven-repository.dev.java.net/nonav/repository with type legacy using the available layout factories: Maven2RepositoryLayoutFactory: Unsupported repository layout legacy -> [Help 1] [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/DependencyResolutionException
从报错来看,是由于缺少一些包导致的,经过搜索发现是由于 log4j 的版本导致的,打包的时候使用的版本是 1.2.15,发现将其升到 1.2.16 还是不行,但是升级到 1.2.17 就没有这个问题了。
换成 1.2.17 是一种解决办法。另外还可以找到对应的 jar 放到库里面。最后一种办法就是在打包的时候直接将 log4j 注释掉,这样也是可以的。
以上是关于Maven 打包报错,log4j版本导致的主要内容,如果未能解决你的问题,请参考以下文章
log4j的1.2.15版本,在pom.xml中的顶层project报错错误: Failure to transfer javax.jms:jms:jar:1.1 from https://maven
The following artifacts could not be resolved(jenkins打包报错)
maven打包报错Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.5.2.RELEASE:repa