Copy the latest version of an artifact from a Maven repository

那年仲夏 提交于 2019-12-07 09:30:13

问题


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 <version>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?


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/3335715/copy-the-latest-version-of-an-artifact-from-a-maven-repository

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!