I'm wondering if Nexus provides API (I unfortunately didn't find any useful examples) to do such thing. So, in my group id ( com.testtools ) I got artifact hibi which is versioned in manner - 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. But for this hibi artifact I have to be able to get the latest patch for certain minor version . So how can I get 0.0.5 if I pass 0.0 (or 0.1.4 if I pass 0.1)? 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". Just start it with "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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.