[英]How to get 'latest' artifact version?
I'm wondering if Nexus provides API (I unfortunately didn't find any useful examples) to do such thing. 我想知道Nexus是否提供API(不幸的是我没有找到任何有用的示例)来做这种事情。 So, in my group id ( com.testtools ) I got artifact hibi which is versioned in manner - major.minor.patch . 因此,在我的组ID( com.testtools )中,我获得了工件hibi ,它以方式-major.minor.patch进行版本控制。 Currently in this directory I've got versions: 当前在此目录中,我有版本:
0.0.5
0.1.2
0.1.4
I know how to get certain version or how get latest stored version (here - snapshot), eg: 我知道如何获取某个版本或如何获取最新的存储版本(此处为快照),例如:
wget 'http://mynexus.se:8081/nexus/service/local/artifact/maven/content?g=com.testtools&a=hibi&v=LATEST&r=snapshots' --content-disposition
give me hibi-0.1.4. 给我hibi-0.1.4。 But for this hibi artifact I have to be able to get the latest patch for certain minor version . 但是对于这个hibi工件,我必须能够获得某些次要版本的最新补丁 。 So how can I get 0.0.5 if I pass 0.0 (or 0.1.4 if I pass 0.1)? 因此,如果我通过0.0,如何获得0.0.5(如果我通过0.1,如何获得0.1.4)? Tried something like: 尝试过类似的东西:
wget 'http://mynexus.se:8081/nexus/service/local/artifact/maven/content?g=com.testtools&a=hibi&v=0.1.*&r=snapshots' --content-disposition
but it isn't work properly (artifact not found). 但它无法正常运行(找不到工件)。 I'll be glad for any suggestions. 我会很高兴提出任何建议。
Here is a simple pom.xml, which will copy its dependencies (I used slf4j as an example) to the directory "destination". 这是一个简单的pom.xml,它将其依赖项(我以slf4j为例)复制到目录“目的地”。 Just start it with "mvn clean install". 只需以“ mvn clean install”开始。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>YourGroup</groupId>
<artifactId>Test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>[1.6.0,1.7.0)</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>destination</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<configuration>
<allowSnapshots>true</allowSnapshots>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.