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 注释掉,这样也是可以的。

猜你喜欢

转载自www.cnblogs.com/hanwen1014/p/11324492.html