Class MavenProjectHelper
java.lang.Object
org.eclipse.jetty.maven.plugin.utils.MavenProjectHelper
MavenProjectHelper
A class to facilitate interacting with the build time maven environment.
-
Constructor Summary
ConstructorDescriptionMavenProjectHelper
(org.apache.maven.project.MavenProject project, org.eclipse.aether.RepositorySystem repositorySystem, List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositories, org.apache.maven.execution.MavenSession session) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.maven.project.MavenProject
getMavenProjectFor
(org.apache.maven.artifact.Artifact artifact) Gets the maven project represented by the artifact iff it is in the reactor.getPathFor
(org.apache.maven.artifact.Artifact artifact) Gets path to artifact.org.apache.maven.project.MavenProject
resolveArtifact
(String groupId, String artifactId, String version, String type) Given the coordinates for an artifact, resolve the artifact from the remote repositories.
-
Constructor Details
-
MavenProjectHelper
public MavenProjectHelper(org.apache.maven.project.MavenProject project, org.eclipse.aether.RepositorySystem repositorySystem, List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositories, org.apache.maven.execution.MavenSession session) - Parameters:
project
- the project being builtrepositorySystem
- a resolve for artifactsremoteRepositories
- repositories from which to resolve artifactssession
- the current maven build session
-
-
Method Details
-
getProject
public org.apache.maven.project.MavenProject getProject() -
getWarPluginInfo
-
getOverlayManager
-
getMavenProjectFor
public org.apache.maven.project.MavenProject getMavenProjectFor(org.apache.maven.artifact.Artifact artifact) Gets the maven project represented by the artifact iff it is in the reactor.- Parameters:
artifact
- the artifact of the project to get- Returns:
MavenProject
if artifact is referenced in reactor, otherwise null
-
getPathFor
Gets path to artifact. If the artifact is referenced in the reactor, returns path to ${project.build.outputDirectory}. Otherwise, returns path to location in local m2 repo. Cannot return null - maven will complain about unsatisfied dependency during project build.- Parameters:
artifact
- maven artifact to check- Returns:
- path to artifact
-
resolveArtifact
public File resolveArtifact(String groupId, String artifactId, String version, String type) throws org.eclipse.aether.resolution.ArtifactResolutionException Given the coordinates for an artifact, resolve the artifact from the remote repositories.- Parameters:
groupId
- the groupId of the artifact to resolveartifactId
- the artifactId of the artifact to resolveversion
- the version of the artifact to resolvetype
- the type of the artifact to resolve- Returns:
- a File representing the location of the artifact or null if not resolved
- Throws:
org.eclipse.aether.resolution.ArtifactResolutionException
-