You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by kw...@apache.org on 2022/07/14 08:23:50 UTC

[jackrabbit-filevault-package-maven-plugin] branch feature/drop-plexus-xml created (now 9adeffc)

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a change to branch feature/drop-plexus-xml
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault-package-maven-plugin.git


      at 9adeffc  JCRVLT-642 replace plexus components by JSR 330

This branch includes the following new commits:

     new 9adeffc  JCRVLT-642 replace plexus components by JSR 330

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[jackrabbit-filevault-package-maven-plugin] 01/01: JCRVLT-642 replace plexus components by JSR 330

Posted by kw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch feature/drop-plexus-xml
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault-package-maven-plugin.git

commit 9adeffc59ebabc1d87478dfb81e7c3f68ee39876
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Thu Jul 14 10:23:45 2022 +0200

    JCRVLT-642 replace plexus components by JSR 330
    
    WIP: somehow this requires versions in contrast to plexus metadata...
---
 pom.xml                                            | 21 ++++-
 .../extensions/ContentPackageArtifactHandler.java  | 35 +++++++++
 .../ContentPackageLifecycleMappingProvider.java    | 89 ++++++++++++++++++++++
 src/main/resources/META-INF/plexus/components.xml  | 61 ---------------
 4 files changed, 144 insertions(+), 62 deletions(-)

diff --git a/pom.xml b/pom.xml
index e942a1f..07404f0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -126,6 +126,25 @@
                     </execution>
                 </executions>
             </plugin>
+            <!-- ====================================================================== -->
+            <!-- S I S U  P L U G I N                                                   -->
+            <!-- ====================================================================== -->
+            <plugin>
+                <groupId>org.eclipse.sisu</groupId>
+                <artifactId>sisu-maven-plugin</artifactId>
+                <version>0.3.5</version>
+                <executions>
+                    <execution>
+                        <id>index-project</id>
+                        <goals>
+                            <goal>main-index</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <!-- ====================================================================== -->
+            <!-- E N F O R C E R  P L U G I N                                           -->
+            <!-- ====================================================================== -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-enforcer-plugin</artifactId>
@@ -173,7 +192,7 @@
                         </configuration>
                     </execution>
                 </executions>
-              </plugin>
+            </plugin>
             <!-- ====================================================================== -->
             <!-- I N S T A L L   P L U G I N                                            -->
             <!-- ====================================================================== -->
diff --git a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/extensions/ContentPackageArtifactHandler.java b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/extensions/ContentPackageArtifactHandler.java
new file mode 100644
index 0000000..4609d7d
--- /dev/null
+++ b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/extensions/ContentPackageArtifactHandler.java
@@ -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.
+ */
+package org.apache.jackrabbit.filevault.maven.packaging.impl.extensions;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+
+@Singleton
+@Named("content-package")
+public class ContentPackageArtifactHandler extends DefaultArtifactHandler {
+
+    public ContentPackageArtifactHandler() {
+        super("content-package");
+        setIncludesDependencies(true);
+        setExtension("zip");
+        setLanguage("java");
+        setAddedToClasspath(true);
+    }
+}
diff --git a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/extensions/ContentPackageLifecycleMappingProvider.java b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/extensions/ContentPackageLifecycleMappingProvider.java
new file mode 100644
index 0000000..77adcf7
--- /dev/null
+++ b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/extensions/ContentPackageLifecycleMappingProvider.java
@@ -0,0 +1,89 @@
+/*
+ * 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.jackrabbit.filevault.maven.packaging.impl.extensions;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Named;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.apache.maven.lifecycle.mapping.Lifecycle;
+import org.apache.maven.lifecycle.mapping.LifecycleMapping;
+import org.apache.maven.lifecycle.mapping.LifecyclePhase;
+
+@Singleton
+@Named("content-package")
+public class ContentPackageLifecycleMappingProvider implements Provider<LifecycleMapping> {
+
+    private static final String DEFAULT_LIFECYCLE_KEY = "default";
+    private static final Map<String, LifecyclePhase> BINDINGS;
+    static {
+        BINDINGS = new HashMap<>();
+        BINDINGS.put("process-resources", new LifecyclePhase("org.apache.maven.plugins:maven-resources-plugin:resources"));
+        BINDINGS.put("compile", new LifecyclePhase("org.apache.maven.plugins:maven-compiler-plugin:compile"));
+        BINDINGS.put("generate-test-sources", new LifecyclePhase("apache.jackrabbit:filevault-package-maven-plugin:generate-metadata"));
+        BINDINGS.put("process-test-sources", new LifecyclePhase("org.apache.jackrabbit:filevault-package-maven-plugin:validate-files"));
+        BINDINGS.put("process-test-resources", new LifecyclePhase("org.apache.maven.plugins:maven-resources-plugin:testResources"));
+        BINDINGS.put("test-compile", new LifecyclePhase("org.apache.maven.plugins:maven-compiler-plugin:testCompile"));
+        BINDINGS.put("test", new LifecyclePhase("org.apache.maven.plugins:maven-surefire-plugin:test"));
+        BINDINGS.put("package", new LifecyclePhase("org.apache.jackrabbit:filevault-package-maven-plugin:package"));
+        BINDINGS.put("verify", new LifecyclePhase("org.apache.jackrabbit:filevault-package-maven-plugin:validate-package"));
+        BINDINGS.put("install", new LifecyclePhase("org.apache.maven.plugins:maven-install-plugin:install"));
+        BINDINGS.put("deploy", new LifecyclePhase("org.apache.maven.plugins:maven-deploy-plugin:deploy"));
+    }
+
+    private final Lifecycle defaultLifecycle;
+
+    private final LifecycleMapping lifecycleMapping;
+
+    public ContentPackageLifecycleMappingProvider() {
+        this.defaultLifecycle = new Lifecycle();
+        this.defaultLifecycle.setId(DEFAULT_LIFECYCLE_KEY);
+        this.defaultLifecycle.setLifecyclePhases(BINDINGS);
+
+        this.lifecycleMapping = new LifecycleMapping() {
+            @Override
+            public Map<String, Lifecycle> getLifecycles() {
+                return Collections.singletonMap(DEFAULT_LIFECYCLE_KEY, defaultLifecycle);
+            }
+
+            @Override
+            public List<String> getOptionalMojos(String lifecycle) {
+                return null;
+            }
+
+            @Override
+            public Map<String, String> getPhases(String lifecycle) {
+                if (DEFAULT_LIFECYCLE_KEY.equals(lifecycle)) {
+                    return defaultLifecycle.getPhases();
+                } else {
+                    return null;
+                }
+            }
+        };
+    }
+
+    @Override
+    public LifecycleMapping get() {
+        return lifecycleMapping;
+    }
+
+}
diff --git a/src/main/resources/META-INF/plexus/components.xml b/src/main/resources/META-INF/plexus/components.xml
deleted file mode 100644
index 1c79ef4..0000000
--- a/src/main/resources/META-INF/plexus/components.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<!--
-  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.
-  -->
-<component-set>
-    <components>
-        <component>
-            <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
-            <role-hint>content-package</role-hint>
-            <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
-            <configuration>
-                <lifecycles>
-                    <lifecycle>
-                        <id>default</id>
-                        <!-- START SNIPPET: content-package lifecycle -->
-                        <phases>
-                            <process-resources>org.apache.maven.plugins:maven-resources-plugin:resources
-                            </process-resources>
-                            <compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
-                            <generate-test-sources>org.apache.jackrabbit:filevault-package-maven-plugin:generate-metadata</generate-test-sources>
-                            <process-test-sources>org.apache.jackrabbit:filevault-package-maven-plugin:validate-files</process-test-sources>
-                            <process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
-                            <test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
-                            <test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
-                            <package>org.apache.jackrabbit:filevault-package-maven-plugin:package</package>
-                            <verify>org.apache.jackrabbit:filevault-package-maven-plugin:validate-package</verify>
-                            <install>org.apache.maven.plugins:maven-install-plugin:install</install>
-                            <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
-                        </phases>
-                        <!-- END SNIPPET: content package lifecycle -->
-                    </lifecycle>
-                </lifecycles>
-            </configuration>
-        </component>
-        <component>
-            <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
-            <role-hint>content-package</role-hint>
-            <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
-            <configuration>
-                <type>content-package</type>
-                <includesDependencies>true</includesDependencies>
-                <language>java</language>
-                <extension>zip</extension>
-                <packaging>content-package</packaging>
-                <addedToClasspath>true</addedToClasspath>
-            </configuration>
-        </component>
-    </components>
-</component-set>