Copy the latest version of an artifact from a Maven repository
I am trying to copy a war file from my company's Nexus repository to a specific location. I am using maven-dependency-plugin in the following way:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>copy-to-output</id>
<phase>prepare-package</phase>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.mycompany</groupId>
<artifactId>myproduct</artifactId>
<version>2.3.0</version>
<type>war</type>
<overWrite>false</overWrite>
</artifactItem>
</artifactItems>
<outputDirectory>${basedir}/src/main/output</outputDirectory>
</configuration>
</plugin>
The problem arise when I am trying to use <ve开发者_JS百科rsion>RELEASE</version>
instead of a specific version (or no version at all) in order to get the latest release version (although not best practice, in this case it is safe) - it doesnt work. Any thoughts?
Brian Fox (who wrote the dependency plugin) explained in this answer that the unpack
and copy
goals do NOT support ranges (nor the LATEST or RELEASE) - he didn't implement this feature - and suggests to use the xxx-dependencies
goals instead.
I wonder if this has been fixed in a later version of Maven; we're using 3.0.3 and maven-dependency-plugin:copy goal is working using <version>LATEST</version
精彩评论