gpt4 book ai didi

java - 无法通过maven创建fat jar

转载 作者:太空宇宙 更新时间:2023-11-04 09:58:24 25 4
gpt4 key购买 nike

我正在尝试创建一个 fat 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,但我不明白为什么我会面对它。

最佳答案

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

<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。

关于java - 无法通过maven创建fat jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53813541/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com