|
|
|
@@ -63,6 +63,9 @@ public class AmpMojo extends AbstractMojo implements ArtifactResolutionCallback
|
|
|
|
|
|
|
|
|
|
@Requirement
|
|
|
|
|
private ArtifactResolver artifactResolver;
|
|
|
|
|
|
|
|
|
|
@Parameter( property = "classifier", required = false )
|
|
|
|
|
protected String classifier;
|
|
|
|
|
|
|
|
|
|
@Parameter( property = "outputFile", required = true, defaultValue = "${project.build.directory}/${project.artifactId}-${project.version}.amp" )
|
|
|
|
|
protected String outputAmpFile;
|
|
|
|
@@ -103,6 +106,13 @@ public class AmpMojo extends AbstractMojo implements ArtifactResolutionCallback
|
|
|
|
|
}
|
|
|
|
|
this.getLog().debug("Executing AMP packaging");
|
|
|
|
|
|
|
|
|
|
this.classifier = StringUtils.trimToNull(this.classifier);
|
|
|
|
|
if (this.classifier != null) {
|
|
|
|
|
this.getLog().info("A classifier was specified; injecting classifier into module and output artifact names");
|
|
|
|
|
this.outputAmpFile = this.injectClassifier(this.outputAmpFile);
|
|
|
|
|
this.moduleJarFile = this.injectClassifier(this.moduleJarFile);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.normalize();
|
|
|
|
|
|
|
|
|
|
File ampFile = this.getOutputFile();
|
|
|
|
@@ -134,6 +144,22 @@ public class AmpMojo extends AbstractMojo implements ArtifactResolutionCallback
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String injectClassifier(String filename) {
|
|
|
|
|
int lastDot = filename.lastIndexOf('.');
|
|
|
|
|
if (lastDot < 0)
|
|
|
|
|
throw new IllegalArgumentException();
|
|
|
|
|
|
|
|
|
|
int lastDash = filename.lastIndexOf('-', lastDot-1);
|
|
|
|
|
if (lastDash > 0) {
|
|
|
|
|
// see if the classifier was already specified
|
|
|
|
|
String possibleClassifier = filename.substring(lastDash+1, lastDot);
|
|
|
|
|
if (this.classifier.equals(possibleClassifier))
|
|
|
|
|
return filename;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return filename.substring(0, lastDot) + '-' + this.classifier + filename.substring(lastDot);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void normalize() {
|
|
|
|
|
this.outputAmpFile = StringUtils.trimToNull(this.outputAmpFile);
|
|
|
|
|
this.moduleJarFile = StringUtils.trimToNull(this.moduleJarFile);
|
|
|
|
@@ -219,9 +245,9 @@ public class AmpMojo extends AbstractMojo implements ArtifactResolutionCallback
|
|
|
|
|
|
|
|
|
|
for (FileSet fileset : this.libDirectories)
|
|
|
|
|
libcount += this.zipFileset(zstream, fileset, "lib");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (libcount == 0)
|
|
|
|
|
throw new IllegalStateException("There are no external libraries to include, making an AMP pointless");
|
|
|
|
|
this.getLog().warn("There are no external libraries to include; an AMP is not recommended");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<String> getExclusions() {
|
|
|
|
|