You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2022/07/17 16:38:44 UTC
[maven-rar-plugin] branch master updated: [MRAR-87] Upgrade to Maven 3.3.9 and drop legacy (#3)
This is an automated email from the ASF dual-hosted git repository.
cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-rar-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 1727a74 [MRAR-87] Upgrade to Maven 3.3.9 and drop legacy (#3)
1727a74 is described below
commit 1727a74ece02367cd70f74f9af938a05cb4e5c6f
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Sun Jul 17 18:38:41 2022 +0200
[MRAR-87] Upgrade to Maven 3.3.9 and drop legacy (#3)
Changes:
* update parent POM to 36
* update to Maven 3.3.9
* set provided scopes to maven bits
* drop unused maven-shared-utils
* drop plexus XML replace with JSR330
---
pom.xml | 47 ++++++---
src/it/default-extension/pom.xml | 47 +++++++++
src/it/default-extension/src/main/custom/ra.xml | 22 +++++
.../src/main/rar/SomeResource.txt | 18 ++++
src/it/default-extension/verify.bsh | 71 ++++++++++++++
.../META-INF/plexus/components.xml | 86 ----------------
.../plugins/rar/internal/RarArtifactHandler.java | 41 ++++++++
.../rar/internal/RarLifecycleMappingProvider.java | 109 +++++++++++++++++++++
8 files changed, 342 insertions(+), 99 deletions(-)
diff --git a/pom.xml b/pom.xml
index 61711e2..c0ed3dd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,8 +25,8 @@ under the License.
<parent>
<artifactId>maven-plugins</artifactId>
<groupId>org.apache.maven.plugins</groupId>
- <version>34</version>
- <relativePath>../../pom/maven/maven-plugins/pom.xml</relativePath>
+ <version>36</version>
+ <relativePath />
</parent>
<artifactId>maven-rar-plugin</artifactId>
@@ -53,7 +53,7 @@ under the License.
</issueManagement>
<ciManagement>
<system>Jenkins</system>
- <url>https://ci-builds.apache.org/job/Maven/job/maven-box/job/maven-rar-plugin/</url>
+ <url>https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-rar-plugin/</url>
</ciManagement>
<distributionManagement>
<site>
@@ -72,8 +72,8 @@ under the License.
</contributors>
<properties>
- <mavenVersion>3.0</mavenVersion>
<javaVersion>7</javaVersion>
+ <mavenVersion>3.3.9</mavenVersion>
<project.build.outputTimestamp>2020-04-07T21:04:00Z</project.build.outputTimestamp>
</properties>
@@ -82,16 +82,36 @@ under the License.
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>${mavenVersion}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${mavenVersion}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>${mavenVersion}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>${mavenVersion}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-settings</artifactId>
+ <version>${mavenVersion}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
@@ -101,17 +121,12 @@ under the License.
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-interpolation</artifactId>
- <version>1.25</version>
+ <version>1.26</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
- <version>3.3.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-shared-utils</artifactId>
- <version>3.3.3</version>
+ <version>3.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
@@ -126,7 +141,7 @@ under the License.
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-archiver</artifactId>
- <version>3.5.1</version>
+ <version>3.5.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -143,7 +158,7 @@ under the License.
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
- <version>2.1</version>
+ <version>3.3.0</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -171,6 +186,12 @@ under the License.
</plugin>
</plugins>
</pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.sisu</groupId>
+ <artifactId>sisu-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
</build>
<profiles>
diff --git a/src/it/default-extension/pom.xml b/src/it/default-extension/pom.xml
new file mode 100644
index 0000000..2c36351
--- /dev/null
+++ b/src/it/default-extension/pom.xml
@@ -0,0 +1,47 @@
+<?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.
+-->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.it0070</groupId>
+ <artifactId>maven-it-it0070</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>rar</packaging>
+
+ <name>Maven Integration Test :: it0070</name>
+ <description>Test a RAR generation.</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-rar-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ <configuration>
+ <includeJar>false</includeJar>
+ <raXmlFile>src/main/custom/ra.xml</raXmlFile>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/it/default-extension/src/main/custom/ra.xml b/src/it/default-extension/src/main/custom/ra.xml
new file mode 100644
index 0000000..e74236b
--- /dev/null
+++ b/src/it/default-extension/src/main/custom/ra.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+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.
+-->
+<connector>
+ <fake-content></fake-content>
+</connector>
\ No newline at end of file
diff --git a/src/it/default-extension/src/main/rar/SomeResource.txt b/src/it/default-extension/src/main/rar/SomeResource.txt
new file mode 100644
index 0000000..9c4d2c2
--- /dev/null
+++ b/src/it/default-extension/src/main/rar/SomeResource.txt
@@ -0,0 +1,18 @@
+# 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.
+
+foo=${project.version}
\ No newline at end of file
diff --git a/src/it/default-extension/verify.bsh b/src/it/default-extension/verify.bsh
new file mode 100644
index 0000000..78575e1
--- /dev/null
+++ b/src/it/default-extension/verify.bsh
@@ -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.
+ */
+
+import java.io.*;
+import java.util.*;
+import java.util.jar.*;
+import java.util.regex.*;
+import org.codehaus.plexus.util.*;
+
+try
+{
+ File jarFile = new File( basedir, "target/maven-it-it0070-1.0-SNAPSHOT.rar" );
+ System.out.println( "Checking for existence of " + jarFile );
+ if ( !jarFile.isFile() )
+ {
+ System.out.println( "FAILURE! rar file not found" );
+ return false;
+ }
+
+ JarFile jar = new JarFile( jarFile );
+
+ String[] includedEntries = {
+ "META-INF/ra.xml",
+ "SomeResource.txt",
+ };
+ for ( String included : includedEntries )
+ {
+ System.out.println( "Checking for existence of " + included );
+ if ( jar.getEntry( included ) == null )
+ {
+ System.out.println( "FAILURE! entry not in rar file" + included );
+ return false;
+ }
+ }
+
+ InputStream stream = jar.getInputStream( jar.getEntry("SomeResource.txt") );
+
+ String content = new String(IOUtil.toByteArray( stream ));
+
+ int idx = content.indexOf("${project.version}");
+
+ if (idx<1) {
+ System.out.println("SomeResource.txt not filtered");
+ return false;
+ }
+
+ jar.close();
+}
+catch( Throwable t )
+{
+ t.printStackTrace();
+ return false;
+}
+
+return true;
diff --git a/src/main/filtered-resources/META-INF/plexus/components.xml b/src/main/filtered-resources/META-INF/plexus/components.xml
deleted file mode 100644
index 18f1bc0..0000000
--- a/src/main/filtered-resources/META-INF/plexus/components.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?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.
--->
-
-<component-set>
- <components>
- <!--
- | RAR
- |-->
- <component>
- <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
- <role-hint>rar</role-hint>
- <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
- <configuration>
- <type>rar</type>
- <includesDependencies>true</includesDependencies>
- <language>java</language>
- <addedToClasspath>false</addedToClasspath>
- </configuration>
- </component>
-
- <!--
- | Defining the phases with their appropriate plugins
- ! and versions which will be executed during the 'default'
- ! life cycle.
- -->
- <component>
- <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
- <role-hint>rar</role-hint>
- <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
- <configuration>
- <lifecycles>
- <lifecycle>
- <id>default</id>
- <!-- START SNIPPET: rar-lifecycle -->
- <phases>
- <process-resources>
- org.apache.maven.plugins:maven-resources-plugin:3.0.2:resources
- </process-resources>
- <compile>
- org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile
- </compile>
- <process-test-resources>
- org.apache.maven.plugins:maven-resources-plugin:3.0.2:testResources
- </process-test-resources>
- <test-compile>
- org.apache.maven.plugins:maven-compiler-plugin:3.5.1:testCompile
- </test-compile>
- <test>
- org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test
- </test>
- <package>
- org.apache.maven.plugins:maven-rar-plugin:${project.version}:rar
- </package>
- <install>
- org.apache.maven.plugins:maven-install-plugin:2.5.2:install
- </install>
- <deploy>
- org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy
- </deploy>
- </phases>
- <!-- END SNIPPET: rar-lifecycle -->
- </lifecycle>
- </lifecycles>
- </configuration>
- </component>
-
- </components>
-</component-set>
diff --git a/src/main/java/org/apache/maven/plugins/rar/internal/RarArtifactHandler.java b/src/main/java/org/apache/maven/plugins/rar/internal/RarArtifactHandler.java
new file mode 100644
index 0000000..405cc76
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/rar/internal/RarArtifactHandler.java
@@ -0,0 +1,41 @@
+package org.apache.maven.plugins.rar.internal;
+
+/*
+ * 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.
+ */
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+
+/**
+ * RAR Artifact Handler.
+ */
+@Singleton
+@Named( "rar" )
+public class RarArtifactHandler extends DefaultArtifactHandler
+{
+ public RarArtifactHandler()
+ {
+ super( "rar" );
+ setIncludesDependencies( true );
+ setLanguage( "java" );
+ setAddedToClasspath( false );
+ }
+}
diff --git a/src/main/java/org/apache/maven/plugins/rar/internal/RarLifecycleMappingProvider.java b/src/main/java/org/apache/maven/plugins/rar/internal/RarLifecycleMappingProvider.java
new file mode 100644
index 0000000..964c8bb
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugins/rar/internal/RarLifecycleMappingProvider.java
@@ -0,0 +1,109 @@
+package org.apache.maven.plugins.rar.internal;
+
+/*
+ * 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.
+ */
+
+import javax.inject.Named;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.lifecycle.mapping.Lifecycle;
+import org.apache.maven.lifecycle.mapping.LifecycleMapping;
+import org.apache.maven.lifecycle.mapping.LifecyclePhase;
+
+/**
+ * {@code rar} packaging plugins bindings provider for {@code default} lifecycle.
+ */
+@Singleton
+@Named( "rar" )
+public final class RarLifecycleMappingProvider
+ implements Provider<LifecycleMapping>
+{
+ // Note: "this" plugin does NOT have to have version specified, as the version should be specified in
+ // effective POM, otherwise this lifecycle mapping would not be loaded at all. Hence, the version of
+ // "this" plugin (in this case maven-rar-plugin) version is NEVER considered, and will come from
+ // effective POM of project using this plugin.
+ @SuppressWarnings( "checkstyle:linelength" )
+ private static final String[] BINDINGS =
+ {
+ "process-resources", "org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources",
+ "compile", "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile",
+ "process-test-resources", "org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources",
+ "test-compile", "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile",
+ "test", "org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test",
+ "package", "org.apache.maven.plugins:maven-rar-plugin:rar",
+ "install", "org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install",
+ "deploy", "org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy"
+ };
+
+ private final Lifecycle defaultLifecycle;
+ private final LifecycleMapping lifecycleMapping;
+
+ public RarLifecycleMappingProvider()
+ {
+ HashMap<String, LifecyclePhase> bindings = new HashMap<>();
+ for ( int i = 0; i < BINDINGS.length; i = i + 2 )
+ {
+ bindings.put( BINDINGS[i], new LifecyclePhase( BINDINGS[i + 1] ) );
+ }
+ this.defaultLifecycle = new Lifecycle();
+ this.defaultLifecycle.setId( "default" );
+ this.defaultLifecycle.setLifecyclePhases( bindings );
+
+
+ this.lifecycleMapping = new LifecycleMapping()
+ {
+ @Override
+ public Map<String, Lifecycle> getLifecycles()
+ {
+ return Collections.singletonMap( "default", defaultLifecycle );
+ }
+
+ @Override
+ public List<String> getOptionalMojos( String lifecycle )
+ {
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getPhases( String lifecycle )
+ {
+ if ( "default".equals( lifecycle ) )
+ {
+ return defaultLifecycle.getPhases();
+ }
+ else
+ {
+ return null;
+ }
+ }
+ };
+ }
+
+ @Override
+ public LifecycleMapping get()
+ {
+ return lifecycleMapping;
+ }
+}