从Maven存储库复制工件的最新版本 [英] Copy the latest version of an artifact from a Maven repository

查看:90
本文介绍了从Maven存储库复制工件的最新版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将战争文件从公司的Nexus存储库复制到特定位置.我通过以下方式使用 maven-dependency-plugin :

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>

当我尝试使用 <version>RELEASE</version> 而不是特定版本(或根本没有版本)以获取最新发行版时出现问题(尽管不是最佳实践)如果是安全的话)-它不起作用.有什么想法吗?

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?

推荐答案

Brian Fox(编写了依赖插件)在

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.

这篇关于从Maven存储库复制工件的最新版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆