jar不从maven下载

发布于 2025-02-12 04:19:57 字数 305 浏览 2 评论 0原文

我有一个场景,在我的Maven存储库中,可以使用所需的JAR,但它不在版本文件夹中,而是直接在组下方。

例如,我需要test-1.0.0.jar

我的Maven仓库中,罐子放在下面的路径中,

com.java.test
----test-1.0.0.jar

但应该像下面一样

com.java.test
---1.0.0
------test-1.0.0.jar

在 。是否有任何解决方法可以在不更改Maven存储库结构的情况下下载JAR?

I have a scenario, where in my maven repository, the required JAR is available, but it is not inside the version folder, instead, it is directly under the group.

For Example I need test-1.0.0.jar

In my Maven Repo, the jar is placed in the path like below,

com.java.test
----test-1.0.0.jar

But it is supposed to be like the below,

com.java.test
---1.0.0
------test-1.0.0.jar

Because of this, the jar is not downloading when I do maven install. Are there any workarounds to get the jar downloaded without changing the maven repository structure?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

辞慾 2025-02-19 04:19:57

我认为pom.xml的test.jar.jar或jar上载了遥控器的pom.xml存在问题。

在这种情况下,如果您可以控制测试。JAR代码库或远程存储库,则可以弄清楚什么问题并修复它。如果您无法控制它们,则可以像对待第三方罐子一样对待。使用以下命令,您可以将Jar填充到本地Maven存储库中。

MVN安装:安装文件

,此命令读取此依赖关系,并在您作为参数提供的约束中安装到本地Maven存储库中。

以下示例取自

mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

但是请记住,这只是您本地发展的解决方法。从长远来看,实际问题需要解决。如前所述,pom.xml test.jar的jar应该是固定的,或者应通过重新上传jar来纠正远程存储库的结构。

I think there is a problem with pom.xml of test.jar or jar uploaded to the remote repo incorrectly.

In that case, if you have control over test.jar codebase or remote repo, you can figure out what is wrong and fix it. If you don't have control over them, you can treat like it is 3rd party jar. Using below command you can populate the jar into your local maven repository.

mvn install:install-file

Basically, this command reads this dependency and installs into your local maven repository within the constraints you provided as a parameter.

Below example have been taken from Apache Maven Documentation.

mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

But keep in mind, it is just a workaround for your local development. In the long run, the actual problem needs to be resolved. As mentioned earlier, either pom.xml of test.jar should be fixed or structure of remote repository should be corrected by re-uploading the jar.

我爱人 2025-02-19 04:19:57

您需要使用 mvn部署:deploy-file < /code>

在Windows:

cmd /v /c“设置g = com.java&amp;&amp;&amp; ;设置v = 1.0.0&amp; amp; mvn部署:deploy -file -dfile =! -drepositoryId = your-nexus-id -durl = https://nexus.your.comany.com repository/public'

您可以在jar所在的文件夹中执行该文件,即使没有任何pom。 XML

You would need to re-upload your jar to the right path in Nexus, using mvn deploy:deploy-file :

In Windows:

cmd /v /c "set g=com.java&& set a=test&& set v=1.0.0&& mvn deploy:deploy-file -Dfile=!a!-!v!.jar -Dpackaging=jar -DgroupId=!g! -DartifactId=!a! -Dversion=!v! -DrepositoryId=your-nexus-id -Durl=https://nexus.your.comany.com repository/public"

You can execute that in the folder where the jar is, even without any pom.xml.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文