无法通过Maven创建胖罐

时间:2018-12-17 10:45:10

标签: java maven maven-assembly-plugin fatjar

我正在尝试创建一个胖的jar,其中包括我的测试类以及此处描述的内容:How to add test classes in JAR with Maven project

但是运行maven install时出现以下错误:

Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.3:single (make-assembly) on project formulas: Failed to create assembly: Unable to resolve dependencies for assembly 'fat-tests': Failed to resolve dependencies for assembly: Missing:
[ERROR] ----------
[ERROR] 1) org.eclipse.jetty:jetty-servlet:jar:7.6.16
[ERROR] 
[ERROR]   Try downloading the file manually from the project website.
[ERROR] 
[ERROR]   Then, install it using the command: 
[ERROR]       mvn install:install-file -DgroupId=org.eclipse.jetty -DartifactId=jetty-servlet -Dversion=7.6.16 -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR]   Alternatively, if you host your own repository you can deploy the file there: 
[ERROR]       mvn deploy:deploy-file -DgroupId=org.eclipse.jetty -DartifactId=jetty-servlet -Dversion=7.6.16 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

outout很明显我缺少jar,但是我不明白为什么要面对它。

1 个答案:

答案 0 :(得分:0)

对于jetty-servlet依赖项,没有像7.6.16这样的版本。确保您具有正确的依赖项,例如:

<dependency>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-servlets</artifactId>
    <version>7.6.16.v20140903</version>
</dependency>

或来自Maven中央存储库的以下任何版本: https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-servlets

您还可以在本地Maven存储库中重命名文件夹和jar,但是我强烈建议您这样做,因为这只是一个hack。