Skip to content

Commit

Permalink
Simplify archiver selection
Browse files Browse the repository at this point in the history
  • Loading branch information
rhowe committed Aug 11, 2022
1 parent 61f7352 commit 36d794f
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,18 +244,11 @@ public File createArchive()
}
}

final String archiverName = containsModuleDescriptor ? "mjar" : "jar";

MavenArchiver archiver = new MavenArchiver();
archiver.setCreatedBy( "Maven JAR Plugin", "org.apache.maven.plugins", "maven-jar-plugin" );

if ( containsModuleDescriptor )
{
archiver.setArchiver( (JarArchiver) archivers.get( "mjar" ) );
}
else
{
archiver.setArchiver( (JarArchiver) archivers.get( "jar" ) );
}

archiver.setArchiver( (JarArchiver) archivers.get( archiverName ) );
archiver.setOutputFile( jarFile );

// configure for Reproducible Builds based on outputTimestamp value
Expand Down

0 comments on commit 36d794f

Please sign in to comment.