Package org.jboss.modules.maven
Interface MavenResolver
-
public interface MavenResolver
A resolution strategy for Maven artifacts.- Author:
- David M. Lloyd
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static MavenResolver
createDefaultResolver()
Create a Maven artifact resolver using the default strategy.java.io.File
resolveArtifact(ArtifactCoordinates coordinates, java.lang.String packaging)
Tries to find a maven jar artifact from the system property"maven.repo.local"
This property is a list of platform separated directory names.default java.io.File
resolveJarArtifact(ArtifactCoordinates coordinates)
Try to resolve a Maven JAR artifact.
-
-
-
Method Detail
-
resolveJarArtifact
default java.io.File resolveJarArtifact(ArtifactCoordinates coordinates) throws java.io.IOException
Try to resolve a Maven JAR artifact. Calling this method is identical to callingresolveJarArtifact(qualifier, "jar")
.- Parameters:
coordinates
- the non-null
Maven coordinates object- Returns:
- the absolute path to the artifact, or
null
if none exists - Throws:
java.io.IOException
- if acquiring the artifact path failed for some reason
-
resolveArtifact
java.io.File resolveArtifact(ArtifactCoordinates coordinates, java.lang.String packaging) throws java.io.IOException
Tries to find a maven jar artifact from the system property"maven.repo.local"
This property is a list of platform separated directory names. If not specified, then it looks in${user.home}/.m2/repository
by default.If it can't find it in local paths, then will try to download from a remote repository from the system property
"remote.maven.repo"
. There is no default remote repository. It will download both the pom and jar and put it into the first directory listed in"maven.repo.local"
(or the default directory). This directory will be created if it doesn't exist.Finally, if you do not want a message to console, then set the system property
"maven.download.message"
to"false"
.- Parameters:
coordinates
- the non-null
Maven coordinates objectpackaging
- a non-null
string with the exact packaging type desired (e.g.pom
,jar
, etc.)- Returns:
- the absolute path to the artifact, or
null
if none exists - Throws:
java.io.IOException
- if acquiring the artifact path failed for some reason
-
createDefaultResolver
static MavenResolver createDefaultResolver()
Create a Maven artifact resolver using the default strategy. The permissions of the class calling this method are captured and used for filesystem and network accesses. The default strategy uses the following system properties:maven.repo.local
- a list of directory names using the platform separator which reflect local Maven repository rootsremote.maven.repo
- a comma-separated list of URIs which refer to remote Maven repositories, from which artifacts can be downloadedmaven.download.message
- a boolean system property which controls the logging of messages to the console
- Returns:
- the maven resolver strategy (not
null
)
-
-