Class JarMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    @Mojo(name="jar",
          defaultPhase=PACKAGE,
          requiresProject=true)
    public class JarMojo
    extends org.apache.maven.plugin.AbstractMojo
    Build a JAR from the current Archetype project.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private ArchetypeArtifactManager archetypeArtifactManager
      The archetype artifact manager component.
      private java.io.File archetypeDirectory
      Directory containing the classes.
      private org.apache.maven.archiver.MavenArchiveConfiguration archive
      The archive configuration to use.
      private java.util.Map<java.lang.String,​org.codehaus.plexus.archiver.Archiver> archivers
      The Jar archiver.
      private java.lang.String finalName
      Name of the generated JAR.
      private ArchetypeManager manager
      The archetype manager component.
      private java.io.File outputDirectory
      Directory containing the generated JAR.
      private java.lang.String outputTimestamp
      Timestamp for reproducible output archive entries, either formatted as ISO 8601 yyyy-MM-dd'T'HH:mm:ssXXX or as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH).
      private org.apache.maven.project.MavenProject project
      The Maven project.
      private org.apache.maven.execution.MavenSession session
      The MavenSession.
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Constructor Description
      JarMojo()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void checkArchetypeFile​(java.io.File jarFile)  
      private void checkFileSetArchetypeFile​(java.io.File jarFile)  
      void execute()  
      • Methods inherited from class org.apache.maven.plugin.AbstractMojo

        getLog, getPluginContext, setLog, setPluginContext
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • archetypeDirectory

        @Parameter(defaultValue="${project.build.outputDirectory}",
                   required=true)
        private java.io.File archetypeDirectory
        Directory containing the classes.
      • finalName

        @Parameter(defaultValue="${project.build.finalName}",
                   alias="jarName",
                   required=true)
        private java.lang.String finalName
        Name of the generated JAR.
      • outputDirectory

        @Parameter(defaultValue="${project.build.directory}",
                   required=true)
        private java.io.File outputDirectory
        Directory containing the generated JAR.
      • project

        @Parameter(defaultValue="${project}",
                   readonly=true,
                   required=true)
        private org.apache.maven.project.MavenProject project
        The Maven project.
      • session

        @Parameter(defaultValue="${session}",
                   readonly=true,
                   required=true)
        private org.apache.maven.execution.MavenSession session
        The MavenSession.
      • archivers

        @Component
        private java.util.Map<java.lang.String,​org.codehaus.plexus.archiver.Archiver> archivers
        The Jar archiver.
      • archive

        @Parameter
        private org.apache.maven.archiver.MavenArchiveConfiguration archive
        The archive configuration to use. See Maven Archiver Reference.
        Since:
        3.2.0
      • outputTimestamp

        @Parameter(defaultValue="${project.build.outputTimestamp}")
        private java.lang.String outputTimestamp
        Timestamp for reproducible output archive entries, either formatted as ISO 8601 yyyy-MM-dd'T'HH:mm:ssXXX or as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH).
        Since:
        3.2.0
      • manager

        @Component
        private ArchetypeManager manager
        The archetype manager component.
      • archetypeArtifactManager

        @Component
        private ArchetypeArtifactManager archetypeArtifactManager
        The archetype artifact manager component.
    • Constructor Detail

      • JarMojo

        public JarMojo()
    • Method Detail

      • 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
      • checkArchetypeFile

        private void checkArchetypeFile​(java.io.File jarFile)
                                 throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException