Class JarsLockMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
de.saumya.mojo.gem.JarsLockMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="jars-lock", defaultPhase=INITIALIZE, requiresDependencyResolution=TEST) public class JarsLockMojo extends org.apache.maven.plugin.AbstractMojo
installs a set of given gems without resolving any transitive dependencies
  • Field Details

    • JARS_HOME

      private static final String JARS_HOME
      See Also:
    • project

      @Parameter(defaultValue="${project}", readonly=true) protected org.apache.maven.project.MavenProject project
      reference to maven project for internal use.
    • jarsLock

      @Parameter(defaultValue="Jars.lock", property="jars.lock") public File jarsLock
      Jars.lock file to be updated or created.
    • jarsHome

      @Parameter(property="jars.home") public File jarsHome
      where to copy the jars - default to JARS_HOME environment if set.
    • force

      @Parameter(defaultValue="false", property="jars.force") public boolean force
      force update of Jars.lock file.
    • update

      @Parameter(property="jars.update") public String update
      update of Jars.lock file for a given artifactId
    • gems

      @Parameter public List<String> gems
      list of gems. one line one gem: {gemname}:{version}:{scope} or {gemname}:{version} where scope defaults to compile.
    • outputFile

      @Parameter(property="jars.outputFile") File outputFile
      log output file.
    • repositorySystem

      @Component protected org.apache.maven.repository.RepositorySystem repositorySystem
    • localRepository

      @Parameter(defaultValue="${localRepository}", readonly=true) protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
      local repository for internal use.
  • Constructor Details

    • JarsLockMojo

      public JarsLockMojo()
  • Method Details

    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException
    • processJarsLock

      void processJarsLock() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • getArtifacts

      private List<org.apache.maven.artifact.Artifact> getArtifacts()
    • updateJarsLock

      private void updateJarsLock(List<String> lines) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • exception

      private org.apache.maven.plugin.MojoExecutionException exception(String text, IOException e)
    • message

      private String message(String text)
    • toLines

      private List<String> toLines(Collection<org.apache.maven.artifact.Artifact> artifacts)
    • updateArtifact

      private void updateArtifact() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • resolveUpdate

      private org.apache.maven.artifact.resolver.ArtifactResolutionResult resolveUpdate() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • resolve

      private org.apache.maven.artifact.resolver.ArtifactResolutionResult resolve(boolean hasUpdate) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • createArtifact

      private org.apache.maven.artifact.Artifact createArtifact(String jar, String type)
    • jarsLock

      private String jarsLock()
    • vendorJars

      private void vendorJars() throws IOException
      Throws:
      IOException
    • writeJarsLock

      private void writeJarsLock(List<String> lines) throws FileNotFoundException
      Throws:
      FileNotFoundException
    • checkForUpdates

      private JarsLockMojo.Status checkForUpdates(List<String> lines) throws IOException, org.apache.maven.plugin.MojoExecutionException
      Throws:
      IOException
      org.apache.maven.plugin.MojoExecutionException
    • loadJarsLock

      private List<String> loadJarsLock() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • toLine

      private String toLine(org.apache.maven.artifact.Artifact a)
    • getSystemFile

      private String getSystemFile(String file)