Class MavenProjectHelper

java.lang.Object
org.eclipse.jetty.maven.plugin.utils.MavenProjectHelper

public class MavenProjectHelper extends Object
MavenProjectHelper A class to facilitate interacting with the build time maven environment.
  • 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 built
      repositorySystem - a resolve for artifacts
      remoteRepositories - repositories from which to resolve artifacts
      session - the current maven build session
  • Method Details

    • getProject

      public org.apache.maven.project.MavenProject getProject()
    • getWarPluginInfo

      public WarPluginInfo getWarPluginInfo()
    • getOverlayManager

      public OverlayManager 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

      public Path getPathFor(org.apache.maven.artifact.Artifact artifact)
      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 resolve
      artifactId - the artifactId of the artifact to resolve
      version - the version of the artifact to resolve
      type - 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