【发布时间】:2017-11-28 22:02:49
【问题描述】:
假设我在 ~/.m2/settings.xml 文件中定义了以下配置文件
<profiles>
<profile>
<id>artifactory</id>
</repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>thirdparty</id>
<name>scscm-thirdparty</name>
<url>http://www.mycompany.com/artifactory/my-thirdparty-repo</url>
</repository>
</repositories>
</profile>
</profiles>
现在我想从 settings.xml 中定义的第三方存储库 id 下载自制的 apr-1.6.2.tar.gz 制品,所以在我的 pom.xml 文件中有
<artifactId>apr</artifactId>
<groupId>com.company</groupId>
<version>1.6.2</version>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>org.apache</groupId>
<artifactId>apr</artifactId>
<version>1.6.2</version>
<type>tar.gz</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>download-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<id>apr</id>
<phase>pre-integration-test</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
# HOW DO I SPECIFY URL FROM PROFILE HERE????
<unpack>false</unpack>
</configuration>
</execution>
</executions>
</plugin>
</plujgins>
</build>
我在网上看到了配置文件的示例,但它们都是在 pom.xml 本身中定义的,但这不是我想要做的。我只想在我的 pom.xml 文件中使用我的 settings.xml 配置文件中定义的 URL。
【问题讨论】:
-
在你的 settings.xml 中定义一个属性并使用它。但我认为这不是一个好主意...此外,我会问您为什么要单独下载文件...
-
你说得对,我想要的不是房产,而是个人资料。我正在下载此文件,以便编译、构建并将其打包成 RPM。
-
如果您使用的是 apr,它本身应该可以通过 RPM 依赖项获得?不是吗?除此之外,我不确定在这种情况下使用 Maven 是否真的是一个好主意......
-
apr 只是一个例子。它可以是任何文件。
标签: maven maven-3 maven-plugin