Monday, December 24, 2018

Maven Artifact Resolver

https://github.com/shrinkwrap/resolver#introduction-to-shrinkwrap-resolvers

add dependency org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-depchain:3.1.3 (default scope, not test scope)

package org.pierre.artifactresolver;

import java.io.File;

import org.jboss.shrinkwrap.resolver.api.maven.Maven;

public class App 
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World!" );
        File[] files = Maven.resolver().resolve("org.apache.commons:commons-lang3:3.8.1").withTransitivity().asFile();
        for (File file : files) {
         System.out.println(file.getAbsolutePath());
        }
        
    }
}



this prints:


Hello World!
c:\pierre\.m2\repository\org\apache\commons\commons-lang3\3.8.1\commons-lang3-3.8.1.jar




No comments: