Loading src/main/java/com/inteligr8/alfresco/amp/AmpMojo.java +26 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,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; Loading Loading @@ -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(); Loading Loading @@ -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); Loading Loading
src/main/java/com/inteligr8/alfresco/amp/AmpMojo.java +26 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,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; Loading Loading @@ -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(); Loading Loading @@ -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); Loading