Class RepackMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.basepom.mojo.repack.RepackMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="repack", defaultPhase=PACKAGE, requiresProject=true, threadSafe=true, requiresDependencyResolution=COMPILE_PLUS_RUNTIME, requiresDependencyCollection=COMPILE_PLUS_RUNTIME) public final class RepackMojo extends org.apache.maven.plugin.AbstractMojo
Repack archives for execution using java -jar. Can also be used to repack a jar with nested dependencies by using layout=NONE.
  • Field Details

    • project

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

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

      @Component public org.apache.maven.project.MavenProjectHelper projectHelper
    • mainClass

      @Parameter(property="repack.main-class") public String mainClass
      The name of the main class. If not specified the first compiled class found that contains a main method will be used.
    • includedDependencies

      @Parameter(alias="includes") public Set<org.basepom.mojo.repack.DependencyDefinition> includedDependencies
      Collection of artifact definitions to include.
    • excludedDependencies

      @Parameter(alias="excludedDependencies") public Set<org.basepom.mojo.repack.DependencyDefinition> excludedDependencies
      Collection of artifact definitions to exclude.
    • includeSystemScope

      @Parameter(defaultValue="false", property="repack.include-system-scope") public boolean includeSystemScope
      Include system scoped dependencies.
    • includeProvidedScope

      @Parameter(defaultValue="false", property="repack.include-provided-scope") public boolean includeProvidedScope
      Include provided scoped dependencies.
    • includeOptional

      @Parameter(defaultValue="false", property="repack.include-optional") public boolean includeOptional
      Include optional dependencies
    • outputDirectory

      @Parameter(defaultValue="${project.build.directory}", property="repack.output-directory") public File outputDirectory
      Directory containing the generated archive.
    • finalName

      @Parameter(defaultValue="${project.build.finalName}", property="repack.final-name") public String finalName
      Name of the generated archive.
    • skip

      @Parameter(defaultValue="false", property="repack.skip") public boolean skip
      Skip the execution.
    • quiet

      @Parameter(defaultValue="false", property="repack.quiet") public boolean quiet
      Silence all non-output and non-error messages.
    • report

      @Parameter(defaultValue="true", property="repack.report") public boolean report
      Do a summary report.
    • repackClassifier

      @Parameter(defaultValue="repacked", property="repack.classifier") public String repackClassifier
      Classifier to add to the repacked archive. Use the blank string to replace the main artifact.
    • attachRepackedArtifact

      @Parameter(defaultValue="true", property="repack.attach-artifact") public boolean attachRepackedArtifact
      Attach the repacked archive to the build cycle.
    • runtimeUnpackedDependencies

      @Parameter public Set<org.basepom.mojo.repack.DependencyDefinition> runtimeUnpackedDependencies
      A list of the libraries that must be unpacked at runtime (do not work within the fat jar).
    • optionalDependencies

      @Parameter public Set<org.basepom.mojo.repack.DependencyDefinition> optionalDependencies
      A list of optional libraries that should be included even if optional dependencies are not included by default.
    • outputTimestamp

      @Parameter(defaultValue="${project.build.outputTimestamp}", property="repack.output-timestamp") public String outputTimestamp
      Timestamp for reproducible output archive entries, either formatted as ISO 8601 (yyyy-MM-dd'T'HH:mm:ssXXX) or an int representing seconds since the epoch.
    • layout

      @Parameter(defaultValue="JAR", property="repack.layout") public org.basepom.mojo.repack.LayoutType layout
      The type of archive (which corresponds to how the dependencies are laid out inside it). Possible values are JAR, WAR, ZIP, DIR, NONE. Defaults to JAR.
    • layoutFactory

      @Parameter public org.springframework.boot.loader.tools.LayoutFactory layoutFactory
      The layout factory that will be used to create the executable archive if no explicit layout is set. Alternative layouts implementations can be provided by 3rd parties.
  • Constructor Details

    • RepackMojo

      public RepackMojo()
  • Method Details

    • setIncludedDependencies

      public void setIncludedDependencies(String... includedDependencies)
    • setExcludedDependencies

      public void setExcludedDependencies(String... excludedDependencies)
    • setRuntimeUnpackedDependencies

      public void setRuntimeUnpackedDependencies(String... runtimeUnpackedDependencies)
    • setOptionalDependencies

      public void setOptionalDependencies(String... optionalDependencies)
    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException