This is an automated email from the ASF dual-hosted git repository.
davidb pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/sling-slingfeature-maven-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new d94bcbd SLING-8034 - SlingStart-m-p and SlingFeature-m-p packagetype
clash
d94bcbd is described below
commit d94bcbd4ba22f59970283060558b70d2ecf2f41a
Author: David Bosschaert <[email protected]>
AuthorDate: Thu Nov 1 13:43:05 2018 +0000
SLING-8034 - SlingStart-m-p and SlingFeature-m-p packagetype clash
Committing on behalf os @simonetripodi with many thanks.
---
.../sling/feature/maven/FeatureConstants.java | 5 +-
src/main/resources/META-INF/plexus/components.xml | 8 +--
.../maven/mojos/AggregateFeaturesMojoTest.java | 65 +++++++++++-----------
3 files changed, 41 insertions(+), 37 deletions(-)
diff --git a/src/main/java/org/apache/sling/feature/maven/FeatureConstants.java
b/src/main/java/org/apache/sling/feature/maven/FeatureConstants.java
index 189acb8..f41a037 100644
--- a/src/main/java/org/apache/sling/feature/maven/FeatureConstants.java
+++ b/src/main/java/org/apache/sling/feature/maven/FeatureConstants.java
@@ -17,6 +17,9 @@
package org.apache.sling.feature.maven;
public abstract class FeatureConstants {
+ public static final String PACKAGING_FEATURE = "slingosgifeature";
- public static final String PACKAGING_FEATURE = "slingfeature";
+ public static final String CLASSIFIER_FEATURE = "feature";
+
+ public static final String CLASSIFIER_TEST_FEATURE = "testfeature";
}
diff --git a/src/main/resources/META-INF/plexus/components.xml
b/src/main/resources/META-INF/plexus/components.xml
index 4a0e114..7dac0ca 100644
--- a/src/main/resources/META-INF/plexus/components.xml
+++ b/src/main/resources/META-INF/plexus/components.xml
@@ -20,7 +20,7 @@
<components>
<component>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
- <role-hint>slingfeature</role-hint>
+ <role-hint>slingosgifeature</role-hint>
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
<configuration>
<lifecycles>
@@ -37,13 +37,13 @@
</component>
<component>
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
- <role-hint>slingfeature</role-hint>
+ <role-hint>slingosgifeature</role-hint>
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
<configuration>
- <type>slingfeature</type>
+ <type>slingosgifeature</type>
<includesDependencies>false</includesDependencies>
<language>json</language>
- <extension>slingfeature</extension>
+ <extension>slingosgifeature</extension>
<addedToClasspath>false</addedToClasspath>
</configuration>
</component>
diff --git
a/src/test/java/org/apache/sling/feature/maven/mojos/AggregateFeaturesMojoTest.java
b/src/test/java/org/apache/sling/feature/maven/mojos/AggregateFeaturesMojoTest.java
index d74ff47..bc44d80 100644
---
a/src/test/java/org/apache/sling/feature/maven/mojos/AggregateFeaturesMojoTest.java
+++
b/src/test/java/org/apache/sling/feature/maven/mojos/AggregateFeaturesMojoTest.java
@@ -16,6 +16,29 @@
*/
package org.apache.sling.feature.maven.mojos;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileReader;
+import java.lang.reflect.Field;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
+
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -31,6 +54,7 @@ import org.apache.maven.repository.RepositorySystem;
import org.apache.sling.feature.ArtifactId;
import org.apache.sling.feature.Feature;
import org.apache.sling.feature.io.json.FeatureJSONReader;
+import org.apache.sling.feature.maven.FeatureConstants;
import
org.apache.sling.feature.maven.mojos.AggregateFeaturesMojo.FeatureConfig;
import org.junit.After;
import org.junit.Before;
@@ -39,29 +63,6 @@ import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
-import java.io.File;
-import java.io.FileReader;
-import java.lang.reflect.Field;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.Set;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
public class AggregateFeaturesMojoTest {
private Path tempDir;
private static Map<String, ArtifactId> pluginCallbacks;
@@ -108,7 +109,7 @@ public class AggregateFeaturesMojoTest {
fc.setGroupId("gid1");
fc.setArtifactId("aid1");
fc.setVersion("1.2.3");
- fc.setType("slingfeature");
+ fc.setType(FeatureConstants.PACKAGING_FEATURE);
fc.setClassifier("clf1");
assertEquals(Arrays.asList("i1", "i2"), fc.includes);
@@ -117,7 +118,7 @@ public class AggregateFeaturesMojoTest {
assertEquals("gid1", fc.groupId);
assertEquals("aid1", fc.artifactId);
assertEquals("1.2.3", fc.version);
- assertEquals("slingfeature", fc.type);
+ assertEquals(FeatureConstants.PACKAGING_FEATURE, fc.type);
assertEquals("clf1", fc.classifier);
assertFalse(fc.isDirectory());
@@ -175,7 +176,7 @@ public class AggregateFeaturesMojoTest {
assertEquals("org.foo", id.getGroupId());
assertEquals("org.foo.bar", id.getArtifactId());
assertEquals("1.2.3-SNAPSHOT", id.getVersion());
- assertEquals("slingfeature", id.getType());
+ assertEquals(FeatureConstants.PACKAGING_FEATURE, id.getType());
assertEquals("aggregated", id.getClassifier());
Set<ArtifactId> expectedBundles = new HashSet<>();
@@ -252,7 +253,7 @@ public class AggregateFeaturesMojoTest {
assertEquals("org.foo", id.getGroupId());
assertEquals("org.foo.bar", id.getArtifactId());
assertEquals("1.2.3-SNAPSHOT", id.getVersion());
- assertEquals("slingfeature", id.getType());
+ assertEquals(FeatureConstants.PACKAGING_FEATURE, id.getType());
assertEquals("aggregated", id.getClassifier());
int numBundlesFound = 0;
@@ -424,7 +425,7 @@ public class AggregateFeaturesMojoTest {
assertEquals("g", id.getGroupId());
assertEquals("a", id.getArtifactId());
assertEquals("999", id.getVersion());
- assertEquals("slingfeature", id.getType());
+ assertEquals(FeatureConstants.PACKAGING_FEATURE, id.getType());
assertEquals("agg", id.getClassifier());
Map<String, Dictionary<String, Object>> expectedConfigs = new
HashMap<>();
@@ -455,7 +456,7 @@ public class AggregateFeaturesMojoTest {
fc.setGroupId("g1");
fc.setArtifactId("a1");
fc.setVersion("9.9.9");
- fc.setType("slingfeature");
+ fc.setType(FeatureConstants.PACKAGING_FEATURE);
fc.setClassifier("c1");
RepositorySystem mockRepo = createMockRepo();
@@ -496,7 +497,7 @@ public class AggregateFeaturesMojoTest {
assertEquals("g1", a.getGroupId());
assertEquals("a1", a.getArtifactId());
assertEquals("9.9.9", a.getVersion());
- assertEquals("slingfeature", a.getType());
+ assertEquals(FeatureConstants.PACKAGING_FEATURE,
a.getType());
assertEquals("c1", a.getClassifier());
assertSame(af.localRepository, arr.getLocalRepository());
@@ -516,7 +517,7 @@ public class AggregateFeaturesMojoTest {
assertEquals("mygroup", id.getGroupId());
assertEquals("myart", id.getArtifactId());
assertEquals("42", id.getVersion());
- assertEquals("slingfeature", id.getType());
+ assertEquals(FeatureConstants.PACKAGING_FEATURE, id.getType());
assertEquals("mynewfeature", id.getClassifier());
int numFound = 0;
@@ -570,7 +571,7 @@ public class AggregateFeaturesMojoTest {
assertEquals("Precondition", 0, pluginCallbacks.size());
af.execute();
- ArtifactId id = new ArtifactId("org.foo", "org.foo.bar",
"1.2.3-SNAPSHOT", "aggregated", "slingfeature");
+ ArtifactId id = new ArtifactId("org.foo", "org.foo.bar",
"1.2.3-SNAPSHOT", "aggregated", FeatureConstants.PACKAGING_FEATURE);
assertEquals(id, pluginCallbacks.get("TestPlugin1 - extension1"));
assertEquals(id, pluginCallbacks.get("TestPlugin1 - extension2"));
assertEquals(id, pluginCallbacks.get("TestPlugin1 - extension3"));