You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by an...@apache.org on 2019/06/27 02:11:32 UTC
[sling-whiteboard] 02/02: SLING-8490 - Added a target mode allowing
a POM to convert packages added as dependencies
This is an automated email from the ASF dual-hosted git repository.
andysch pushed a commit to branch feature/sling-cpconverter-maven-plugin
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git
commit 21be47c73df4ccd22651cc5e3d040fbc5469bde1
Author: Andreas Schaefer <sc...@iMac.local>
AuthorDate: Wed Jun 26 19:11:13 2019 -0700
SLING-8490 - Added a target mode allowing a POM to convert packages added as dependencies
This way all the necessary CP can be converted and used in the location it is used
---
.../core/pom.xml | 4 +-
.../pom.xml | 4 +-
.../ui.apps/pom.xml | 8 +-
.../verify.bsh | 8 +-
.../core/pom.xml | 4 +-
.../test/cqconverter/SampleRequestModel.java | 53 ++++++++++
.../cpconverter/test/servlet/ByPathServlet.java | 71 +++++++++++++
.../test/servlet/ByResourceTypeServlet.java | 77 ++++++++++++++
.../test/servlet/ByPathServletTest.java | 33 ++++++
.../fm.launcher}/pom.xml | 53 ++--------
.../invoker.properties | 17 +++
.../pom.xml | 5 +-
.../ui.apps/pom.xml | 24 +----
.../src/main/content/META-INF/vault/filter.xml | 40 ++++++++
.../src/main/content/META-INF/vault/settings.xml | 17 +++
.../content/jcr_root/apps/cqconverter/.content.xml | 24 +++++
.../jcr_root/apps/cqconverter/home/.content.xml | 20 ++++
.../jcr_root/apps/cqconverter/home/body.html | 24 +++++
.../jcr_root/apps/cqconverter/home/head.html | 23 +++++
.../jcr_root/apps/cqconverter/install/.content.xml | 23 +++++
.../jcr_root/apps/cqconverter/page/.content.xml | 19 ++++
.../jcr_root/apps/cqconverter/page/body.html | 21 ++++
.../jcr_root/apps/cqconverter/page/footer.html | 19 ++++
.../jcr_root/apps/cqconverter/page/head.html | 23 +++++
.../jcr_root/apps/cqconverter/page/page.html | 35 +++++++
.../jcr_root/content/cpconverter/.content.xml | 18 ++++
.../jcr_root/content/cpconverter/home/.content.xml | 20 ++++
.../content/cpconverter/home/welcome/.content.xml | 25 +++++
.../verify.bsh | 13 +--
.../core/pom.xml | 4 +-
.../pom.xml | 4 +-
.../ui.apps/pom.xml | 8 +-
.../verify.bsh | 8 +-
.../cpconverter/maven/mojos/ContentPackage.java | 114 +++++++++++++++++++++
.../cpconverter/maven/mojos/ConvertCPMojo.java | 84 ++++++++++-----
35 files changed, 828 insertions(+), 119 deletions(-)
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/core/pom.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/core/pom.xml
index a48b83a..cc7f813 100644
--- a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/core/pom.xml
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/core/pom.xml
@@ -22,13 +22,13 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>sling-cpconverter-maven-plugin-test</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-no-param</artifactId>
<groupId>org.apache.sling</groupId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>sling-cpconverter-maven-plugin-test.core</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-no-param.core</artifactId>
<packaging>bundle</packaging>
<name>CQ Converter Test - Core</name>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/pom.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/pom.xml
index a0a969f..5ddd115 100644
--- a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/pom.xml
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/pom.xml
@@ -14,10 +14,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.sling</groupId>
- <artifactId>sling-cpconverter-maven-plugin-test</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-no-param</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
- <name>Apache Sling Features Maven plugin test</name>
+ <name>Apache Sling Features Maven plugin test - no parameter</name>
<description>This is just an Apache Sling Content Package Maven plugin test to convert a package with a single
bundle
</description>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/ui.apps/pom.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/ui.apps/pom.xml
index 3f43e36..4ec8713 100644
--- a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/ui.apps/pom.xml
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/ui.apps/pom.xml
@@ -23,13 +23,13 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>sling-cpconverter-maven-plugin-test</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-no-param</artifactId>
<groupId>org.apache.sling</groupId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>sling-cpconverter-maven-plugin-test.ui.apps</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-no-param.ui.apps</artifactId>
<packaging>content-package</packaging>
<name>CQ Converter Test - UI Apps</name>
@@ -54,7 +54,7 @@
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>sling-cpconverter-maven-plugin-test.core</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-no-param.core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -75,7 +75,7 @@
<embeddeds>
<embedded>
<groupId>${project.groupId}</groupId>
- <artifactId>sling-cpconverter-maven-plugin-test.core</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-no-param.core</artifactId>
<filter>true</filter>
</embedded>
</embeddeds>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/verify.bsh b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/verify.bsh
index 9c29fda..88da15c 100644
--- a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/verify.bsh
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/verify.bsh
@@ -19,8 +19,8 @@ import java.util.*;
import org.codehaus.plexus.util.*;
boolean check() {
- String projectName = "sling-cpconverter-maven-plugin-test.ui.apps";
- String projectCoreName = "sling-cpconverter-maven-plugin-test.core";
+ String projectName = "sling-cpconverter-maven-plugin-test-no-param.ui.apps";
+ String projectCoreName = "sling-cpconverter-maven-plugin-test-no-param.core";
String projectVersion = "1.0.0-SNAPSHOT";
String projectGroup = "org.apache.sling";
String projectGroupPath = projectGroup.replaceAll("\\.", "/");
@@ -31,8 +31,8 @@ import org.codehaus.plexus.util.*;
System.out.println("Content Package was not created: " + packageFile);
return false;
}
- File outputFolder = new File(targetFolder, "classes");
- File featureModelFolder = new File(outputFolder, "cp-conversion");
+ File outputFolder = new File(targetFolder, "cp-conversion");
+ File featureModelFolder = new File(outputFolder, "fm.out");
if(!featureModelFolder.exists()) {
System.out.println("Feature Model Folder was not created" + featureModelFolder);
return false;
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/core/pom.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/core/pom.xml
similarity index 97%
copy from sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/core/pom.xml
copy to sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/core/pom.xml
index a48b83a..e9a550d 100644
--- a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/core/pom.xml
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/core/pom.xml
@@ -22,13 +22,13 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>sling-cpconverter-maven-plugin-test</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-target-mode</artifactId>
<groupId>org.apache.sling</groupId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>sling-cpconverter-maven-plugin-test.core</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-target-mode.core</artifactId>
<packaging>bundle</packaging>
<name>CQ Converter Test - Core</name>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/core/src/main/java/org/apache/sling/cpconverter/test/cqconverter/SampleRequestModel.java b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/core/src/main/java/org/apache/sling/cpconverter/test/cqconverter/SampleRequestModel.java
new file mode 100644
index 0000000..a015bb8
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/core/src/main/java/org/apache/sling/cpconverter/test/cqconverter/SampleRequestModel.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.cpconverter.test.cqconverter;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.models.annotations.Model;
+import org.apache.sling.models.annotations.injectorspecific.SlingObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jcr.Session;
+
+@Model(adaptables = {Resource.class, SlingHttpServletRequest.class})
+public class SampleRequestModel {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(SampleRequestModel.class);
+
+ @SlingObject
+ private ResourceResolver resourceResolver;
+
+ public SampleRequestModel() {
+ LOGGER.trace("Model Instance created");
+ }
+
+ /** @return User Name of the Current User **/
+ public String getCurrentUser() {
+ String answer = "No User";
+
+ // Adapt to a session and get the current User ID.
+ Session session = resourceResolver.adaptTo(Session.class);
+ LOGGER.trace("Found Session from Resolver: '{}'", session);
+ if(session != null) {
+ answer = session.getUserID();
+ }
+ return answer;
+ }
+}
\ No newline at end of file
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/core/src/main/java/org/apache/sling/cpconverter/test/servlet/ByPathServlet.java b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/core/src/main/java/org/apache/sling/cpconverter/test/servlet/ByPathServlet.java
new file mode 100644
index 0000000..27db4f4
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/core/src/main/java/org/apache/sling/cpconverter/test/servlet/ByPathServlet.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.cpconverter.test.servlet;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+
+import org.osgi.framework.Constants;
+import org.osgi.service.component.annotations.Component;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Hello World Servlet registered by path
+ */
+@Component(
+ service = Servlet.class,
+ property = {
+ Constants.SERVICE_DESCRIPTION + "=Hello World Path Servlet",
+ Constants.SERVICE_VENDOR + "=The Apache Software Foundation",
+ "sling.servlet.paths=/hello-world-servlet"
+ }
+)
+@SuppressWarnings("serial")
+public class ByPathServlet extends SlingSafeMethodsServlet {
+
+ private final Logger log = LoggerFactory.getLogger(ByPathServlet.class);
+
+ @Override
+ protected void doGet(SlingHttpServletRequest request,
+ SlingHttpServletResponse response) throws ServletException,
+ IOException {
+
+ Writer w = response.getWriter();
+ w.write("<!DOCTYPE html PUBLIC \"-//IETF//DTD HTML 2.0//EN\">");
+ w.write("<html>");
+ w.write("<head>");
+ w.write("<title>Hello World Servlet</title>");
+ w.write("</head>");
+ w.write("<body>");
+ w.write("<h1>Hello World!</h1>");
+ w.write("</body>");
+ w.write("</html>");
+
+ log.info("Hello World Servlet");
+
+ }
+
+}
+
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/core/src/main/java/org/apache/sling/cpconverter/test/servlet/ByResourceTypeServlet.java b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/core/src/main/java/org/apache/sling/cpconverter/test/servlet/ByResourceTypeServlet.java
new file mode 100644
index 0000000..da24407
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/core/src/main/java/org/apache/sling/cpconverter/test/servlet/ByResourceTypeServlet.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.cpconverter.test.servlet;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+
+import org.osgi.framework.Constants;
+import org.osgi.service.component.annotations.Component;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Hello World Servlet registered by resource type
+ */
+@Component(
+ service = Servlet.class,
+ property = {
+ Constants.SERVICE_DESCRIPTION + "=Hello World Path Servlet",
+ Constants.SERVICE_VENDOR + "=The Apache Software Foundation",
+ "sling.servlet.resourceTypes=sling/servlet/default",
+ "sling.servlet.selectors=hello",
+ "sling.servlet.extensions=html",
+ }
+)
+@SuppressWarnings("serial")
+public class ByResourceTypeServlet extends SlingSafeMethodsServlet {
+
+ private final Logger log = LoggerFactory.getLogger(ByResourceTypeServlet.class);
+
+ @Override
+ protected void doGet(SlingHttpServletRequest request,
+ SlingHttpServletResponse response) throws ServletException,
+ IOException {
+ Resource resource = request.getResource();
+
+ Writer w = response.getWriter();
+ w.write("<!DOCTYPE html PUBLIC \"-//IETF//DTD HTML 2.0//EN\">");
+ w.write("<html>");
+ w.write("<head>");
+ w.write("<title>Hello World Servlet</title>");
+ w.write("</head>");
+ w.write("<body>");
+ w.write("<h1>Hello ");
+ w.write(resource.getPath());
+ w.write("</h1>");
+ w.write("</body>");
+ w.write("</html>");
+
+ log.info("Hello World Servlet");
+
+ }
+
+}
+
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/core/src/test/java/org/apache/sling/cpconverter/test/org/apache/sling/cpconverter/test/servlet/ByPathServletTest.java b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/core/src/test/java/org/apache/sling/cpconverter/test/org/apache/sling/cpconverter/test/servlet/ByPathServletTest.java
new file mode 100644
index 0000000..f2f5286
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/core/src/test/java/org/apache/sling/cpconverter/test/org/apache/sling/cpconverter/test/servlet/ByPathServletTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.sling.cpconverter.test.servlet;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit test for By Path Servlet.
+ */
+public class ByPathServletTest extends TestCase {
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testByPathServlet() {
+ assertTrue(true);
+ }
+
+}
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/ui.apps/pom.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/fm.launcher/pom.xml
similarity index 64%
copy from sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/ui.apps/pom.xml
copy to sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/fm.launcher/pom.xml
index cd31d67..ee2a9c9 100644
--- a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/ui.apps/pom.xml
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/fm.launcher/pom.xml
@@ -23,14 +23,14 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>sling-cpconverter-maven-plugin-test</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-target-mode</artifactId>
<groupId>org.apache.sling</groupId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>sling-cpconverter-maven-plugin-test.ui.apps</artifactId>
- <packaging>content-package</packaging>
+ <artifactId>sling-cpconverter-maven-plugin-test-target-mode.fm.launcher</artifactId>
+ <packaging>jar</packaging>
<name>CQ Converter Test - UI Apps</name>
<description>
@@ -54,8 +54,9 @@
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>sling-cpconverter-maven-plugin-test.core</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-target-mode.ui.apps</artifactId>
<version>${project.version}</version>
+ <type>zip</type>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
@@ -67,22 +68,6 @@
<build>
<plugins>
<plugin>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>filevault-package-maven-plugin</artifactId>
- <configuration>
- <filterSource>${basedir}/src/main/content/META-INF/vault/filter.xml</filterSource>
- <embeddedTarget>/apps/cqconverter/install</embeddedTarget>
- <embeddeds>
- <embedded>
- <groupId>${project.groupId}</groupId>
- <artifactId>sling-cpconverter-maven-plugin-test.core</artifactId>
- <filter>true</filter>
- </embedded>
- </embeddeds>
- </configuration>
- </plugin>
-
- <plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
@@ -98,32 +83,16 @@
<!-- NOTE: ${} is replaced no matter what so this trick seems to work by adding a zero-width-whitespace character (​)-->
<artifactIdOverride>$​{project.groupId}:$​{project.artifactId}:slingosgifeature:@project.artifactId@:$​{project.version}</artifactIdOverride>
<installConvertedPackage>true</installConvertedPackage>
+ <contentPackages>
+ <contentPackage>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sling-cpconverter-maven-plugin-test-target-mode.ui.apps</artifactId>
+ </contentPackage>
+ </contentPackages>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
- <profiles>
- <!-- ATTENTION: It is highly recomended not to deploy this with this Profile if this Package was or will be deployed with the All package -->
- <profile>
- <id>autoInstallPackage</id>
- <build>
- <plugins>
- <plugin>
- <groupId>io.wcm.maven.plugins</groupId>
- <artifactId>wcmio-content-package-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>install-package</id>
- <goals>
- <goal>install</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
</project>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/invoker.properties b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/invoker.properties
new file mode 100644
index 0000000..209b6ef
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/invoker.properties
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+invoker.goals = clean install
+invoker.debug = true
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/pom.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/pom.xml
similarity index 99%
copy from sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/pom.xml
copy to sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/pom.xml
index a0a969f..c671441 100644
--- a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/pom.xml
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/pom.xml
@@ -14,10 +14,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.sling</groupId>
- <artifactId>sling-cpconverter-maven-plugin-test</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-target-mode</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
- <name>Apache Sling Features Maven plugin test</name>
+ <name>Apache Sling Features Maven plugin test - target mode</name>
<description>This is just an Apache Sling Content Package Maven plugin test to convert a package with a single
bundle
</description>
@@ -413,6 +413,7 @@
<modules>
<module>core</module>
<module>ui.apps</module>
+ <module>fm.launcher</module>
</modules>
</project>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/ui.apps/pom.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/pom.xml
similarity index 83%
copy from sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/ui.apps/pom.xml
copy to sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/pom.xml
index 3f43e36..393a432 100644
--- a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-no-parameters/ui.apps/pom.xml
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/pom.xml
@@ -23,13 +23,13 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>sling-cpconverter-maven-plugin-test</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-target-mode</artifactId>
<groupId>org.apache.sling</groupId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>sling-cpconverter-maven-plugin-test.ui.apps</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-target-mode.ui.apps</artifactId>
<packaging>content-package</packaging>
<name>CQ Converter Test - UI Apps</name>
@@ -54,7 +54,7 @@
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>sling-cpconverter-maven-plugin-test.core</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-target-mode.core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -75,28 +75,12 @@
<embeddeds>
<embedded>
<groupId>${project.groupId}</groupId>
- <artifactId>sling-cpconverter-maven-plugin-test.core</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-target-mode.core</artifactId>
<filter>true</filter>
</embedded>
</embeddeds>
</configuration>
</plugin>
-
- <plugin>
- <groupId>@project.groupId@</groupId>
- <artifactId>@project.artifactId@</artifactId>
- <version>@project.version@</version>
- <extensions>true</extensions>
- <executions>
- <execution>
- <id>convert-cp</id>
- <phase>verify</phase>
- <goals>
- <goal>convert-cp</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
<profiles>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/META-INF/vault/filter.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/META-INF/vault/filter.xml
new file mode 100644
index 0000000..e022dcc
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/META-INF/vault/filter.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ agreements. See the NOTICE file distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file to you under the Apache License,
+ Version 2.0 (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ either express or implied. See the License for the specific language governing permissions
+ and limitations under the License.
+-->
+
+<workspaceFilter version="1.0">
+ <!--
+ Any node that will contain customer data needs to be excluded
+ otherwise a Pacakge Installation will wipe them.
+
+ If there is a mix then all provided nodes must be included and
+ all custom nodes excluded.
+
+ If unsure what to do then go to the Composum Package Manager
+ (/bin/packages.html) and create a test package. To to the package
+ filter list and add filter entries until all of the app provides
+ nodes are included but none of the customer generatedd nodes.
+
+ Also any sub pckage of this module needs to exclude /apps/cqconverter/install
+ folder otherwise they wipe all installed bundles.
+ -->
+ <filter root="/content/cpconverter"/>
+ <!--
+ Need to exclude the Install folder otherwise the Bundle will be undeployed
+ as it is in the '/apps/cqconverter/install' folder (see the 'all'
+ package).
+ -->
+ <filter root="/apps/cqconverter">
+ <exclude pattern="/apps/cqconverter/install/.*"/>
+ </filter>
+</workspaceFilter>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/META-INF/vault/settings.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/META-INF/vault/settings.xml
new file mode 100644
index 0000000..b70c9b9
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/META-INF/vault/settings.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ agreements. See the NOTICE file distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file to you under the Apache License,
+ Version 2.0 (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ either express or implied. See the License for the specific language governing permissions
+ and limitations under the License.
+-->
+<vault version="1.0">
+ <ignore name=".svn"/>
+ <ignore name=".git"/>
+</vault>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/.content.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/.content.xml
new file mode 100644
index 0000000..1a8424c
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/.content.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
+ jcr:primaryType="sling:Folder"
+ jcr:title="CQ Converter Test Root"
+ jcr:description="CQ Converter Test Apps Root folder"
+/>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/home/.content.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/home/.content.xml
new file mode 100644
index 0000000..99124e4
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/home/.content.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ agreements. See the NOTICE file distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file to you under the Apache License,
+ Version 2.0 (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ either express or implied. See the License for the specific language governing permissions
+ and limitations under the License.
+-->
+<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
+ jcr:primaryType="sling:Folder"
+ jcr:title="CQ Converter Test Home Page Component"
+ jcr:description="CQ Converter Test Home Page Component with HTL"
+ sling:resourceSuperType="cqconverter/page"
+>
+</jcr:root>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/home/body.html b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/home/body.html
new file mode 100644
index 0000000..dd8f148
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/home/body.html
@@ -0,0 +1,24 @@
+<!-- /*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/ -->
+<h2>${properties.jcr:title}</h2>
+<p>CQ Converter Test Home Page from Sling Project Archetype</p>
+<p><b><i>Description: </i></b>${properties.jcr:description}</p>
+<div data-sly-use.sampleRequest="org.apache.sling.cpconverter.test.cqconverter.SampleRequestModel">
+ <p>Current User: ${sampleRequest.currentUser}</p>
+</div>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/home/head.html b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/home/head.html
new file mode 100644
index 0000000..67576c8
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/home/head.html
@@ -0,0 +1,23 @@
+<!-- /*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/ -->
+<meta charset="utf-8">
+<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>CQ Converter Test Home Page</title>
+<!-- ${properties.jcr:title} -->
\ No newline at end of file
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/install/.content.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/install/.content.xml
new file mode 100644
index 0000000..42debc9
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/install/.content.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
+ jcr:primaryType="sling:Folder"
+ jcr:title="Install Folder"
+/>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/page/.content.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/page/.content.xml
new file mode 100644
index 0000000..b822f2a
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/page/.content.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ agreements. See the NOTICE file distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file to you under the Apache License,
+ Version 2.0 (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ either express or implied. See the License for the specific language governing permissions
+ and limitations under the License.
+-->
+<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
+ jcr:primaryType="sling:Folder"
+ jcr:title="CQ Converter Test Page Component"
+ jcr:description="CQ Converter Test Page Component with HTL"
+>
+</jcr:root>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/page/body.html b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/page/body.html
new file mode 100644
index 0000000..35078a3
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/page/body.html
@@ -0,0 +1,21 @@
+<!-- /*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/ -->
+<h2>${properties.jcr:title}</h2>
+<p>CQ Converter Test Page from Sling Project Archetype</p>
+<p><b>Description: </b>${properties.jcr:description}</p>
\ No newline at end of file
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/page/footer.html b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/page/footer.html
new file mode 100644
index 0000000..33f7cba
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/page/footer.html
@@ -0,0 +1,19 @@
+<!-- /*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/ -->
+CQ Converter Test Footer
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/page/head.html b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/page/head.html
new file mode 100644
index 0000000..1e72971
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/page/head.html
@@ -0,0 +1,23 @@
+<!-- /*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/ -->
+<meta charset="utf-8">
+<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>CQ Converter Test Page</title>
+<!-- ${properties.jcr:title} -->
\ No newline at end of file
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/page/page.html b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/page/page.html
new file mode 100644
index 0000000..5dad451
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/apps/cqconverter/page/page.html
@@ -0,0 +1,35 @@
+<!-- /*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/ -->
+<!DOCTYPE html>
+<html>
+<head>
+ <sly data-sly-include="${'head.html'}"/>
+</head>
+ <body>
+ <h3>Navigation</h3>
+ <div data-sly-list.child="${resource.listChildren}">
+ <a href="${child.path}.html">${child.name}</a>
+ </div>
+ <br/>
+ <sly data-sly-include="${'body.html'}"/>
+ <footer>
+ <sly data-sly-include="${'footer.html'}"/>
+ </footer>
+ </body>
+</html>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/content/cpconverter/.content.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/content/cpconverter/.content.xml
new file mode 100644
index 0000000..61ba9d7
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/content/cpconverter/.content.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ agreements. See the NOTICE file distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file to you under the Apache License,
+ Version 2.0 (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ either express or implied. See the License for the specific language governing permissions
+ and limitations under the License.
+-->
+<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
+ jcr:primaryType="sling:Folder"
+ jcr:title="CQ Converter Test Content Root"
+ jcr:description="CQ Converter Test Content Root Page"
+/>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/content/cpconverter/home/.content.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/content/cpconverter/home/.content.xml
new file mode 100644
index 0000000..821a340
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/content/cpconverter/home/.content.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ agreements. See the NOTICE file distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file to you under the Apache License,
+ Version 2.0 (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ either express or implied. See the License for the specific language governing permissions
+ and limitations under the License.
+-->
+<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
+ jcr:primaryType="sling:Folder"
+ jcr:title="CQ Converter Test Home"
+ jcr:description="CQ Converter Test Home Page"
+ sling:resourceType="cqconverter/home"
+>
+</jcr:root>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/content/cpconverter/home/welcome/.content.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/content/cpconverter/home/welcome/.content.xml
new file mode 100644
index 0000000..48e6832
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/ui.apps/src/main/content/jcr_root/content/cpconverter/home/welcome/.content.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+--><jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
+ jcr:primaryType="sling:Folder"
+ jcr:title="CQ Converter Test Welcome"
+ jcr:description="CQ Converter Test Welcome Page"
+ sling:resourceType="cqconverter/page"
+>
+</jcr:root>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/verify.bsh b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/verify.bsh
similarity index 91%
copy from sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/verify.bsh
copy to sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/verify.bsh
index 77e6e17..0200786 100644
--- a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/verify.bsh
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-target-mode/verify.bsh
@@ -19,20 +19,21 @@ import java.util.*;
import org.codehaus.plexus.util.*;
boolean check() {
- String projectName = "sling-cpconverter-maven-plugin-test.ui.apps";
- String projectCoreName = "sling-cpconverter-maven-plugin-test.core";
+ String projectName = "sling-cpconverter-maven-plugin-test-target-mode.ui.apps";
+ String projectCoreName = "sling-cpconverter-maven-plugin-test-target-mode.core";
String projectVersion = "1.0.0-SNAPSHOT";
String projectGroup = "org.apache.sling";
String projectGroupPath = projectGroup.replaceAll("\\.", "/");
- File targetFolder = new File(basedir, "ui.apps/target");
- File packageFile = new File(targetFolder, projectName + "-" + projectVersion + ".zip");
+ File cpTargetFolder = new File(basedir, "ui.apps/target");
+ File packageFile = new File(cpTargetFolder, projectName + "-" + projectVersion + ".zip");
if(!packageFile.exists()) {
System.out.println("Content Package was not created: " + packageFile);
return false;
}
- File outputFolder = new File(targetFolder, "classes");
- File featureModelFolder = new File(outputFolder, "cp-conversion");
+ File targetFolder = new File(basedir, "fm.launcher/target");
+ File outputFolder = new File(targetFolder, "cp-conversion");
+ File featureModelFolder = new File(outputFolder, "fm.out");
if(!featureModelFolder.exists()) {
System.out.println("Feature Model Folder was not created" + featureModelFolder);
return false;
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/core/pom.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/core/pom.xml
index a48b83a..1fc3757 100644
--- a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/core/pom.xml
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/core/pom.xml
@@ -22,13 +22,13 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>sling-cpconverter-maven-plugin-test</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-with-param</artifactId>
<groupId>org.apache.sling</groupId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>sling-cpconverter-maven-plugin-test.core</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-with-param.core</artifactId>
<packaging>bundle</packaging>
<name>CQ Converter Test - Core</name>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/pom.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/pom.xml
index a0a969f..5df12ef 100644
--- a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/pom.xml
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/pom.xml
@@ -14,10 +14,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.sling</groupId>
- <artifactId>sling-cpconverter-maven-plugin-test</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-with-param</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
- <name>Apache Sling Features Maven plugin test</name>
+ <name>Apache Sling Features Maven plugin test - with parameter</name>
<description>This is just an Apache Sling Content Package Maven plugin test to convert a package with a single
bundle
</description>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/ui.apps/pom.xml b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/ui.apps/pom.xml
index cd31d67..a3d1a68 100644
--- a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/ui.apps/pom.xml
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/ui.apps/pom.xml
@@ -23,13 +23,13 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>sling-cpconverter-maven-plugin-test</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-with-param</artifactId>
<groupId>org.apache.sling</groupId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>sling-cpconverter-maven-plugin-test.ui.apps</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-with-param.ui.apps</artifactId>
<packaging>content-package</packaging>
<name>CQ Converter Test - UI Apps</name>
@@ -54,7 +54,7 @@
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>sling-cpconverter-maven-plugin-test.core</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-with-param.core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -75,7 +75,7 @@
<embeddeds>
<embedded>
<groupId>${project.groupId}</groupId>
- <artifactId>sling-cpconverter-maven-plugin-test.core</artifactId>
+ <artifactId>sling-cpconverter-maven-plugin-test-with-param.core</artifactId>
<filter>true</filter>
</embedded>
</embeddeds>
diff --git a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/verify.bsh b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/verify.bsh
index 77e6e17..d512198 100644
--- a/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/verify.bsh
+++ b/sling-cpconverter-maven-plugin/src/it/package-with-single-bundle-with-parameters/verify.bsh
@@ -19,8 +19,8 @@ import java.util.*;
import org.codehaus.plexus.util.*;
boolean check() {
- String projectName = "sling-cpconverter-maven-plugin-test.ui.apps";
- String projectCoreName = "sling-cpconverter-maven-plugin-test.core";
+ String projectName = "sling-cpconverter-maven-plugin-test-with-param.ui.apps";
+ String projectCoreName = "sling-cpconverter-maven-plugin-test-with-param.core";
String projectVersion = "1.0.0-SNAPSHOT";
String projectGroup = "org.apache.sling";
String projectGroupPath = projectGroup.replaceAll("\\.", "/");
@@ -31,8 +31,8 @@ import org.codehaus.plexus.util.*;
System.out.println("Content Package was not created: " + packageFile);
return false;
}
- File outputFolder = new File(targetFolder, "classes");
- File featureModelFolder = new File(outputFolder, "cp-conversion");
+ File outputFolder = new File(targetFolder, "cp-conversion");
+ File featureModelFolder = new File(outputFolder, "fm.out");
if(!featureModelFolder.exists()) {
System.out.println("Feature Model Folder was not created" + featureModelFolder);
return false;
diff --git a/sling-cpconverter-maven-plugin/src/main/java/org/apache/sling/cpconverter/maven/mojos/ContentPackage.java b/sling-cpconverter-maven-plugin/src/main/java/org/apache/sling/cpconverter/maven/mojos/ContentPackage.java
new file mode 100644
index 0000000..0b2b36c
--- /dev/null
+++ b/sling-cpconverter-maven-plugin/src/main/java/org/apache/sling/cpconverter/maven/mojos/ContentPackage.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.cpconverter.maven.mojos;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.project.MavenProject;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+public class ContentPackage {
+
+ /**
+ * The content package Group Id
+ */
+ private String groupId = "";
+
+ /**
+ * The content package Artifact Id
+ */
+ private String artifactId = "";
+
+ private String type = "zip";
+
+ // TODO: Classifier should not be set as we have the one from the converter
+ private String classifier = "";
+
+ private boolean excludeTransitive;
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId == null ? "" : groupId;
+ }
+
+ public void setArtifactId(String artifactId) {
+ this.artifactId = artifactId == null ? "" : artifactId;
+ }
+
+ public void setExcludeTransitive(boolean excludeTransitive) {
+ this.excludeTransitive = excludeTransitive;
+ }
+
+ public boolean isExcludeTransitive() {
+ return excludeTransitive;
+ }
+
+ public Collection<Artifact> getMatchingArtifacts(final MavenProject project) {
+ // get artifacts depending on whether we exclude transitives or not
+ final Set<Artifact> artifacts;
+ // TODO: when I ran the tests the artifacts where only available in the Dependency Artifacts and
+ // getArtifacts() returned an empty set
+ if (excludeTransitive) {
+ // only direct dependencies, transitives excluded
+ artifacts = project.getDependencyArtifacts();
+ } else {
+ // all dependencies, transitives included
+ artifacts = project.getArtifacts();
+ }
+ return getMatchingArtifacts(artifacts);
+ }
+
+ public Collection<Artifact> getMatchingArtifacts(final Collection<Artifact> artifacts) {
+ final List<Artifact> matches = new ArrayList<Artifact>();
+ for (Artifact artifact : artifacts) {
+ if(groupId.equals(artifact.getGroupId())
+ && artifactId.equals(artifact.getArtifactId())
+ && type.equals(artifact.getType())
+ && (classifier.equals(artifact.getClassifier()) || (classifier.equals("") && artifact.getClassifier() == null))
+ ) {
+ matches.add(artifact);
+ }
+ }
+ return matches;
+ }
+
+ @Nonnull
+ public StringBuilder toString(@Nullable StringBuilder builder) {
+ if (builder == null) {
+ builder = new StringBuilder();
+ }
+ builder.append("groupId=").append(groupId).append(",");
+ builder.append("artifactId=").append(artifactId).append(",");
+
+ if (type != null) {
+ builder.append("type=").append(type).append(",");
+ }
+ if (classifier != null) {
+ builder.append("classifier=").append(classifier).append(",");
+ }
+ builder.append(",excludeTransitive=").append(excludeTransitive);
+ return builder;
+ }
+
+ public String toString() {
+ return toString(null).toString();
+ }
+}
diff --git a/sling-cpconverter-maven-plugin/src/main/java/org/apache/sling/cpconverter/maven/mojos/ConvertCPMojo.java b/sling-cpconverter-maven-plugin/src/main/java/org/apache/sling/cpconverter/maven/mojos/ConvertCPMojo.java
index de13b9a..ad3dc60 100644
--- a/sling-cpconverter-maven-plugin/src/main/java/org/apache/sling/cpconverter/maven/mojos/ConvertCPMojo.java
+++ b/sling-cpconverter-maven-plugin/src/main/java/org/apache/sling/cpconverter/maven/mojos/ConvertCPMojo.java
@@ -20,6 +20,7 @@ import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
import org.apache.maven.execution.MavenSession;
+import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -36,6 +37,7 @@ import org.apache.sling.feature.cpconverter.acl.DefaultAclManager;
import org.apache.sling.feature.cpconverter.artifacts.DefaultArtifactsDeployer;
import org.apache.sling.feature.cpconverter.features.DefaultFeaturesManager;
import org.apache.sling.feature.cpconverter.handlers.DefaultEntryHandlersManager;
+import org.codehaus.plexus.util.FileUtils;
import java.io.File;
import java.util.ArrayList;
@@ -68,7 +70,9 @@ public final class ConvertCPMojo extends AbstractMojo {
public static final String CFG_CONVERTED_CP_OUTPUT_DIRECTORY = "convertedContentPackageOutputDirectory";
- public static final String CFG_SYSTEM_PROPERTIES = "cp.system.properties";
+ public static final String CFG_SYSTEM_PROPERTIES = "cpSystemProperties";
+
+ public static final String CFG_CONTENT_PACKAGES = "packages";
public static final boolean DEFAULT_STRING_VALIDATION = false;
@@ -78,9 +82,9 @@ public final class ConvertCPMojo extends AbstractMojo {
public static final boolean DEFAULT_INSTALL_CONVERTED_PACKAGE = true;
- public static final String DEFAULT_FM_OUTPUT_DIRECTORY = "${project.build.outputDirectory}/cp-conversion";
+ public static final String DEFAULT_CONVERTED_CP_OUTPUT_DIRECTORY = "${project.build.directory}/cp-conversion";
- public static final String DEFAULT_CONVERTED_CP_OUTPUT_DIRECTORY = "${project.build.outputDirectory}";
+ public static final String DEFAULT_FM_OUTPUT_DIRECTORY = DEFAULT_CONVERTED_CP_OUTPUT_DIRECTORY + "/fm.out";
/**
* If set to {@code true} the Content Package is strictly validated.
@@ -132,6 +136,11 @@ public final class ConvertCPMojo extends AbstractMojo {
private List<String> systemProperties;
/**
+ * List of Content Packages to be converted
+ */
+ @Parameter(property = CFG_CONTENT_PACKAGES)
+ private List<ContentPackage> contentPackages;
+ /**
* The Maven project.
*/
@Parameter( defaultValue = "${project}", readonly = true )
@@ -188,39 +197,68 @@ public final class ConvertCPMojo extends AbstractMojo {
new DefaultAclManager()
);
- getLog().info("Artifact File: " + project.getArtifact());
- getLog().info("Final Name: " + project.getModel().getBuild().getFinalName());
- String targetPath = project.getModel().getBuild().getDirectory() + "/"
- + project.getModel().getBuild().getFinalName()
- + "." + ZIP_TYPE;
- File targetFile = new File(targetPath);
- if(targetFile.exists() && targetFile.isFile() && targetFile.canRead()) {
- converter.convert(project.getArtifact().getFile());
+ if(contentPackages == null || contentPackages.isEmpty()) {
+ getLog().info("Project Artifact File: " + project.getArtifact());
+ String targetPath = project.getModel().getBuild().getDirectory() + "/"
+ + project.getModel().getBuild().getFinalName()
+ + "." + ZIP_TYPE;
+ File targetFile = new File(targetPath);
+ if (targetFile.exists() && targetFile.isFile() && targetFile.canRead()) {
+ converter.convert(project.getArtifact().getFile());
+ Artifact convertedPackage = new DefaultArtifact(
+ project.getGroupId(), project.getArtifactId(), project.getVersion(),
+ "compile", ZIP_TYPE, PACKAGE_CLASSIFIER, artifactHandlerManager.getArtifactHandler(ZIP_TYPE)
+ );
+ installConvertedCP(convertedPackage);
+ } else {
+ getLog().error("Artifact is not found: " + targetPath);
+ }
} else {
- getLog().error("Artifact is not found: " + targetPath);
+ for(ContentPackage contentPackage: contentPackages) {
+ getLog().info("Content Package Artifact File: " + contentPackage.toString());
+ contentPackage.setExcludeTransitive(true);
+ final Collection<Artifact> artifacts = contentPackage.getMatchingArtifacts(project);
+ if (artifacts.isEmpty()) {
+ getLog().warn("No matching artifacts for " + contentPackage);
+ continue;
+ }
+ getLog().info("Target Convert CP of --- " + contentPackage + " ---");
+ for (final Artifact artifact : artifacts) {
+ final File source = artifact.getFile();
+ if (source.exists() && source.isFile() && source.canRead()) {
+ converter.convert(source);
+ Artifact convertedPackage = new DefaultArtifact(
+ artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
+ "compile", ZIP_TYPE, PACKAGE_CLASSIFIER, artifactHandlerManager.getArtifactHandler(ZIP_TYPE)
+ );
+ installConvertedCP(convertedPackage);
+ } else {
+ getLog().error("Artifact is not found: " + artifact);
+ }
+ }
+ }
}
} catch (Throwable t) {
throw new MojoExecutionException("Content Package Converter Exception", t);
}
+ }
+
+ private void installConvertedCP(Artifact artifact) throws MojoFailureException, MojoExecutionException {
if(installConvertedCP) {
Collection<Artifact> artifacts = Collections.synchronizedCollection(new ArrayList<>());
- Artifact convertedPackage = new DefaultArtifact(
- project.getGroupId(), project.getArtifactId(), project.getVersion(),
- "compile", ZIP_TYPE, PACKAGE_CLASSIFIER, artifactHandlerManager.getArtifactHandler(ZIP_TYPE)
- );
// Rebuild the converted package path
- String convertedPackagePath = project.getGroupId().replaceAll("\\.", "/")
- + "/" + project.getArtifactId()
- + "/" + project.getVersion()
- + "/" + project.getArtifactId()
- + "-" + project.getVersion()
+ String convertedPackagePath = artifact.getGroupId().replaceAll("\\.", "/")
+ + "/" + artifact.getArtifactId()
+ + "/" + artifact.getVersion()
+ + "/" + artifact.getArtifactId()
+ + "-" + artifact.getVersion()
+ "-" + PACKAGE_CLASSIFIER
+ "." + ZIP_TYPE;
File convertedPackageFile = new File(convertedCPOutput, convertedPackagePath);
if(convertedPackageFile.exists() && convertedPackageFile.canRead()) {
- convertedPackage.setFile(convertedPackageFile);
- artifacts.add(convertedPackage);
+ artifact.setFile(convertedPackageFile);
+ artifacts.add(artifact);
installArtifact(mavenSession.getProjectBuildingRequest(), artifacts);
} else {
getLog().error("Could not find Converted Package: " + convertedPackageFile);