Maven: Get repository URL of a dependency

前端 未结 1 758
刺人心
刺人心 2021-01-20 18:29

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

相关标签:
1条回答
  • 2021-01-20 18:58

    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>
    

    (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.)

    0 讨论(0)
提交回复
热议问题