Package org.xwiki.test.integration.maven
Class MavenResolver
- java.lang.Object
-
- org.xwiki.test.integration.maven.MavenResolver
-
public class MavenResolver extends Object
Resolves Maven Artifacts either from a remote repository or from a local POM file.- Since:
- 10.9
- Version:
- $Id: 6d1a69801600ab0f6396ab390d7a2cde651157cb $
-
-
Constructor Summary
Constructors Constructor Description MavenResolver(List<String> profiles, ArtifactResolver artifactResolver, RepositoryResolver repositoryResolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCloverJAR(List<org.eclipse.aether.artifact.Artifact> artifacts)org.eclipse.aether.artifact.ArtifactconvertToArtifact(org.apache.maven.model.Dependency dependency)List<org.eclipse.aether.artifact.Artifact>convertToArtifacts(Collection<org.apache.maven.model.Dependency> dependencies)List<org.eclipse.aether.artifact.Artifact>convertToArtifacts(Collection<ArtifactCoordinate> artifactCoordinates, boolean resolveExtraJARs)Collection<org.eclipse.aether.artifact.Artifact>getDependencies(org.apache.maven.model.Model model)org.apache.maven.model.ModelgetModelFromCurrentPOM()org.apache.maven.model.ModelgetModelFromPOM(File pomFile)org.apache.maven.model.ModelgetModelFromPOMArtifact(org.eclipse.aether.artifact.Artifact artifact)StringgetPlatformVersion()StringgetPropertyFromCurrentPOM(String propertyName)StringreplacePropertiesFromCurrentPOM(String value)
-
-
-
Constructor Detail
-
MavenResolver
public MavenResolver(List<String> profiles, ArtifactResolver artifactResolver, RepositoryResolver repositoryResolver)
- Parameters:
profiles- the list of Maven profile to enable when reading/resolving pom filesartifactResolver- the resolver to resolve artifacts from Maven repositoriesrepositoryResolver- the resolver to create Maven repositories and sessions
-
-
Method Detail
-
getModelFromCurrentPOM
public org.apache.maven.model.Model getModelFromCurrentPOM() throws Exception- Returns:
- the Maven Model object for the
pom.xmlfile in the current directory (i.e. the POM of the module executing functional tests) - Throws:
Exception- if an error occurred during reading and parsing of the POM
-
getPlatformVersion
public String getPlatformVersion() throws Exception
- Returns:
- the version of the XWiki platform artifacts to download/resolve
- Throws:
Exception- if an error occurred during reading and parsing of the POM
-
getPropertyFromCurrentPOM
public String getPropertyFromCurrentPOM(String propertyName) throws Exception
- Parameters:
propertyName- the maven property name for which to retrieve the value- Returns:
- the property value
- Throws:
Exception- if the property doesn't exist- Since:
- 11.7RC1
-
getModelFromPOM
public org.apache.maven.model.Model getModelFromPOM(File pomFile) throws Exception
- Parameters:
pomFile- the location of the pom file to read- Returns:
- the Maven Model object for the
pom.xmlfile passed in parameters - Throws:
Exception- if an error occurred during reading and parsing of the POM
-
getModelFromPOMArtifact
public org.apache.maven.model.Model getModelFromPOMArtifact(org.eclipse.aether.artifact.Artifact artifact) throws Exception- Parameters:
artifact- the artifact for which to read and parse the POM- Returns:
- the Maven Model object for the passed artifact
- Throws:
Exception- if an error occurred during resolving of the artifact or during reading and parsing of the POM
-
convertToArtifact
public org.eclipse.aether.artifact.Artifact convertToArtifact(org.apache.maven.model.Dependency dependency)
- Parameters:
dependency- the dependency to convert to an Artifact instance- Returns:
- the converted Artifact instance
- Since:
- 10.11RC1
-
convertToArtifacts
public List<org.eclipse.aether.artifact.Artifact> convertToArtifacts(Collection<org.apache.maven.model.Dependency> dependencies)
- Parameters:
dependencies- the dependencies to convert to Artifact instances- Returns:
- the converted Artifact instances
- Since:
- 12.5RC1
-
convertToArtifacts
public List<org.eclipse.aether.artifact.Artifact> convertToArtifacts(Collection<ArtifactCoordinate> artifactCoordinates, boolean resolveExtraJARs) throws Exception
- Parameters:
artifactCoordinates- the Maven artifact coordinates to convert to a resolved list of ArtifactsresolveExtraJARs- whether or not extra JARs without version should get their version resolved from the current POM or not- Returns:
- the resolved list of artifacts
- Throws:
Exception- in case the POM model cannot be resolved- Since:
- 12.5RC1
-
addCloverJAR
public void addCloverJAR(List<org.eclipse.aether.artifact.Artifact> artifacts) throws Exception
- Parameters:
artifacts- the list of artifacts to which to add the Clover JAR- Throws:
Exception- in case the POM model cannot be resolved- Since:
- 10.11.2, 12.0RC1
-
getDependencies
public Collection<org.eclipse.aether.artifact.Artifact> getDependencies(org.apache.maven.model.Model model) throws Exception
- Parameters:
model- the model from which to find the current artifact and its transitive dependencies- Returns:
- the full transitive dependencies for the current POM
- Throws:
Exception- in case an error occurred during resolving- Since:
- 12.5RC1
-
-