You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:27:58 UTC
[sling-slingstart-maven-plugin] 11/15: SLING-6068 :
slingstart-maven-plugin: Allow to start a quickstart JAR based on a
provisioning model even for non slingstart packagings
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag slingstart-maven-plugin-1.5.0
in repository https://gitbox.apache.org/repos/asf/sling-slingstart-maven-plugin.git
commit 25c4c597a3301797f25d804b97751f6e3c2d0051
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Nov 8 08:51:14 2016 +0000
SLING-6068 : slingstart-maven-plugin: Allow to start a quickstart JAR based on a provisioning model even for non slingstart packagings
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/slingstart-maven-plugin@1768644 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/sling/maven/slingstart/PackageMojo.java | 37 ++++++++++++----------
1 file changed, 20 insertions(+), 17 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/slingstart/PackageMojo.java b/src/main/java/org/apache/sling/maven/slingstart/PackageMojo.java
index 53df7db..cd92163 100644
--- a/src/main/java/org/apache/sling/maven/slingstart/PackageMojo.java
+++ b/src/main/java/org/apache/sling/maven/slingstart/PackageMojo.java
@@ -64,7 +64,6 @@ public class PackageMojo extends AbstractSlingStartMojo {
private void packageStandaloneApp(final Map<String, File> globalContentsMap) throws MojoExecutionException {
this.getLog().info("Packaging standalone jar...");
- final File buildDirectory = new File(this.project.getBuild().getDirectory());
@SuppressWarnings("unchecked")
final Map<String, File> contentsMap = (Map<String, File>) this.project.getContextValue(BuildConstants.CONTEXT_STANDALONE);
@@ -75,14 +74,7 @@ public class PackageMojo extends AbstractSlingStartMojo {
fis = new FileInputStream(manifestFile);
final Manifest mf = new Manifest(fis);
- // make sure this filename does not conflict with any other project artifacts (primary or secondary)
- final File outputFile;
- if ( BuildConstants.PACKAGING_SLINGSTART.equals(project.getPackaging()) ) {
- outputFile = new File(buildDirectory, this.project.getArtifactId() + "-" + this.project.getVersion() + ".jar");
- } else {
- outputFile = new File(buildDirectory, this.project.getArtifactId() + "-" + this.project.getVersion() + ".standalonelaunchpad.jar");
- }
-
+ final File outputFile = getBuildFile(".jar");
final JarArchiverHelper helper = new JarArchiverHelper(jarArchiver, this.project, outputFile, mf);
helper.addDirectory(buildOutputDirectory, null, EXCLUDES_MANIFEST);
@@ -110,16 +102,10 @@ public class PackageMojo extends AbstractSlingStartMojo {
@SuppressWarnings("unchecked")
final Map<String, File> contentsMap = (Map<String, File>) this.project.getContextValue(BuildConstants.CONTEXT_WEBAPP);
- final File buildOutputDirectory = new File(buildDirectory, BuildConstants.WEBAPP_OUTDIR);
- // make sure this filename does not conflict with any other project artifacts (primary or secondary)
- final File outputFile;
- if ( BuildConstants.PACKAGING_SLINGSTART.equals(project.getPackaging()) ) {
- outputFile = new File(buildDirectory, this.project.getArtifactId() + "-" + this.project.getVersion() + ".war");
- } else {
- outputFile = new File(buildDirectory, this.project.getArtifactId() + "-" + this.project.getVersion() + ".webapplaunchpad.war");
- }
+ final File outputFile = getBuildFile(".war");
final JarArchiverHelper helper = new JarArchiverHelper(this.jarArchiver, this.project, outputFile);
+ final File buildOutputDirectory = new File(buildDirectory, BuildConstants.WEBAPP_OUTDIR);
helper.addDirectory(buildOutputDirectory, null, EXCLUDES_MANIFEST);
helper.addArtifacts(globalContentsMap, "WEB-INF/");
@@ -130,4 +116,21 @@ public class PackageMojo extends AbstractSlingStartMojo {
projectHelper.attachArtifact(project, BuildConstants.TYPE_WAR, BuildConstants.CLASSIFIER_WEBAPP, outputFile);
}
}
+
+ /**
+ *
+ * @param isStandalone {@code true} if the standalone launchpad should be built, {@code false} if the webapp should be built.
+ * @return the absolute file name of the to be created artifact
+ */
+ private File getBuildFile(final String extension) {
+ final File buildDirectory = new File(this.project.getBuild().getDirectory());
+ final File buildFile;
+ if ( BuildConstants.PACKAGING_SLINGSTART.equals(project.getPackaging()) ) {
+ buildFile = new File(buildDirectory, this.project.getBuild().getFinalName() + extension);
+ } else {
+ // make sure this filename does not conflict with any other project artifacts (primary or secondary)
+ buildFile = new File(buildDirectory, this.project.getBuild().getFinalName() + ".launchpad" + extension);
+ }
+ return buildFile;
+ }
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.