本文介绍了Maven:获取依赖项的存储库URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想显示在构建工作结束时已部署到我们的Maven存储库中的JAR的URL. (基本上是可以从存储库服务器下载依赖项-JAR的链接")
I want do display the URL to a JAR that was deployed to our maven repo at the end of my build job. (Basically the "link" where the dependency - the JAR - can be downloaded from the repository server)
那么如何在命令行上显示依赖项的远程存储库URL?
So how to display the remote repository URL of a dependency on command line?
推荐答案
我建议您根据pom中的参数组成URL.示例:
I suggest you to compose the URL from the parameters in the very pom. Example:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>deploy-message</id>
<phase>deploy</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>deploying to url=${project.distributionManagement.repository.url}/${project.groupId}/${project.artifactId}/${project.version}/${project.artifactId}-${project.version}.jar</echo>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
(此消息将在执行部署的同时出现,但是您可以将其设置为所需的任何阶段.也可以将其包含在 Maven个人资料.)
(This message will appear at the same time the deploy is being performed, but you can set it to whatever phase you want. Or include it into a Maven profile.)
这篇关于Maven:获取依赖项的存储库URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!