Update Gradle plugin to only repackage main jar
Previously, Repackage would attempt to repackage every jar in the project. This would cause it to incorrectly attempt to repackage source and javadoc jars. This commit updates Repackage so that it ignores any jar with a classifier. Hopefully this is a reasonable approximation for ignoring 'special' jars that should not be repackaged such as sources and javadoc.
This commit is contained in:
parent
a4c0733d4a
commit
bde98defa5
|
|
@ -46,18 +46,20 @@ public class Repackage extends DefaultTask {
|
|||
project.getTasks().withType(Jar.class, new Action<Jar>() {
|
||||
@Override
|
||||
public void execute(Jar archive) {
|
||||
File file = archive.getArchivePath();
|
||||
if (file.exists()) {
|
||||
Repackager repackager = new Repackager(file);
|
||||
repackager.setMainClass(extension.getMainClass());
|
||||
if (extension.convertLayout() != null) {
|
||||
repackager.setLayout(extension.convertLayout());
|
||||
}
|
||||
repackager.setBackupSource(extension.isBackupSource());
|
||||
try {
|
||||
repackager.repackage(libraries);
|
||||
} catch (IOException ex) {
|
||||
throw new IllegalStateException(ex.getMessage(), ex);
|
||||
if ("".equals(archive.getClassifier())) {
|
||||
File file = archive.getArchivePath();
|
||||
if (file.exists()) {
|
||||
Repackager repackager = new Repackager(file);
|
||||
repackager.setMainClass(extension.getMainClass());
|
||||
if (extension.convertLayout() != null) {
|
||||
repackager.setLayout(extension.convertLayout());
|
||||
}
|
||||
repackager.setBackupSource(extension.isBackupSource());
|
||||
try {
|
||||
repackager.repackage(libraries);
|
||||
} catch (IOException ex) {
|
||||
throw new IllegalStateException(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue