This is an automated email from the ASF dual-hosted git repository. alien11689 pushed a commit to branch update-maven-plugins-to-maven-3.x in repository https://gitbox.apache.org/repos/asf/aries.git
commit f36dd31134888b1994c9b72593b17aa15352dcc7 Author: Dominik Przybysz <[email protected]> AuthorDate: Thu Mar 27 05:55:40 2025 +0100 [MAINTENANCE] Update maven plugins dependencies to maven 3.x --- eba-maven-plugin/pom.xml | 33 +++++--- .../java/org/apache/aries/plugin/eba/EbaMojo.java | 10 +-- esa-maven-plugin/pom.xml | 33 +++++--- .../java/org/apache/aries/plugin/esa/EsaMojo.java | 88 +++++++++++----------- .../org/apache/aries/plugin/esa/EsaMojoTest.java | 4 +- 5 files changed, 92 insertions(+), 76 deletions(-) diff --git a/eba-maven-plugin/pom.xml b/eba-maven-plugin/pom.xml index 008415a04..7e79f3f75 100644 --- a/eba-maven-plugin/pom.xml +++ b/eba-maven-plugin/pom.xml @@ -43,14 +43,14 @@ <properties> <biz.aQute.bndlib.version>6.4.1</biz.aQute.bndlib.version> - <maven-archiver.version>2.6</maven-archiver.version> - <maven.version>2.2.1</maven.version> + <maven.version>3.9.9</maven.version> + <maven-archiver.version>3.6.3</maven-archiver.version> <maven-bundle-plugin.version>5.1.9</maven-bundle-plugin.version> <maven-invoker-plugin.version>3.9.0</maven-invoker-plugin.version> - <maven-plugin-testing-harness.version>1.3</maven-plugin-testing-harness.version> - <plexus-archiver.version>3.7.0</plexus-archiver.version> + <maven-plugin-testing-harness.version>3.3.0</maven-plugin-testing-harness.version> + <plexus-archiver.version>4.10.0</plexus-archiver.version> + <plexus-container-default.version>2.1.1</plexus-container-default.version> <plexus-utils.version>4.0.2</plexus-utils.version> - <plexus-xml.version>4.0.4</plexus-xml.version> </properties> <dependencies> @@ -68,16 +68,19 @@ <groupId>org.apache.maven</groupId> <artifactId>maven-plugin-api</artifactId> <version>${maven.version}</version> + <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> + <artifactId>maven-core</artifactId> <version>${maven.version}</version> + <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-artifact</artifactId> <version>${maven.version}</version> + <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.maven</groupId> @@ -88,6 +91,13 @@ <groupId>org.apache.maven</groupId> <artifactId>maven-model</artifactId> <version>${maven.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-compat</artifactId> + <version>${maven.version}</version> + <scope>provided</scope> </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> @@ -99,17 +109,18 @@ <artifactId>plexus-utils</artifactId> <version>${plexus-utils.version}</version> </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-xml</artifactId> - <version>${plexus-xml.version}</version> - </dependency> <dependency> <groupId>org.apache.maven.plugin-testing</groupId> <artifactId>maven-plugin-testing-harness</artifactId> <version>${maven-plugin-testing-harness.version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-container-default</artifactId> + <version>${plexus-container-default.version}</version> + <scope>test</scope> + </dependency> </dependencies> <profiles> diff --git a/eba-maven-plugin/src/main/java/org/apache/aries/plugin/eba/EbaMojo.java b/eba-maven-plugin/src/main/java/org/apache/aries/plugin/eba/EbaMojo.java index c68bc8057..a0e110601 100644 --- a/eba-maven-plugin/src/main/java/org/apache/aries/plugin/eba/EbaMojo.java +++ b/eba-maven-plugin/src/main/java/org/apache/aries/plugin/eba/EbaMojo.java @@ -48,9 +48,7 @@ import java.util.Set; * @phase package * @requiresDependencyResolution test */ -public class EbaMojo - extends AbstractMojo -{ +public class EbaMojo extends AbstractMojo { public static final String APPLICATION_MF_URI = "META-INF/APPLICATION.MF"; @@ -167,7 +165,7 @@ public class EbaMojo * * @parameter */ - private Map instructions = new LinkedHashMap();; + private Map<?,?> instructions = new LinkedHashMap<>(); /** * Adding pom.xml and pom.properties to the archive. @@ -386,7 +384,7 @@ public class EbaMojo PomPropertiesUtil pomPropertiesUtil = new PomPropertiesUtil(); File dir = new File(project.getBuild().getDirectory(), "maven-zip-plugin"); File pomPropertiesFile = new File(dir, "pom.properties"); - pomPropertiesUtil.createPomProperties(project, zipArchiver, pomPropertiesFile, forceCreation); + pomPropertiesUtil.createPomProperties(project, zipArchiver, null, pomPropertiesFile, forceCreation); } File ebaFile = new File( outputDirectory, finalName + ".eba" ); zipArchiver.setDestFile(ebaFile); @@ -525,7 +523,7 @@ public class EbaMojo */ private Set<Artifact> selectArtifacts(Set<Artifact> artifacts) { - Set<Artifact> selected = new LinkedHashSet<Artifact>(); + Set<Artifact> selected = new LinkedHashSet<>(); for (Artifact artifact : artifacts) { String scope = artifact.getScope(); if (scope == null diff --git a/esa-maven-plugin/pom.xml b/esa-maven-plugin/pom.xml index 69afa2b76..42fece5c6 100644 --- a/esa-maven-plugin/pom.xml +++ b/esa-maven-plugin/pom.xml @@ -43,15 +43,15 @@ <properties> <biz.aQute.bndlib.version>6.4.1</biz.aQute.bndlib.version> - <maven.version>2.2.1</maven.version> - <maven-archiver.version>2.6</maven-archiver.version> + <maven.version>3.9.9</maven.version> + <maven-archiver.version>3.6.3</maven-archiver.version> <maven-bundle-plugin.version>5.1.9</maven-bundle-plugin.version> <maven-invoker-plugin.version>3.9.0</maven-invoker-plugin.version> - <maven-plugin-testing-harness.version>1.3</maven-plugin-testing-harness.version> + <maven-plugin-testing-harness.version>3.3.0</maven-plugin-testing-harness.version> <org.apache.aries.util.version>1.1.3</org.apache.aries.util.version> - <plexus-archiver.version>3.7.0</plexus-archiver.version> + <plexus-archiver.version>4.10.0</plexus-archiver.version> + <plexus-container-default.version>2.1.1</plexus-container-default.version> <plexus-utils.version>4.0.2</plexus-utils.version> - <plexus-xml.version>4.0.4</plexus-xml.version> </properties> <dependencies> @@ -74,16 +74,19 @@ <groupId>org.apache.maven</groupId> <artifactId>maven-plugin-api</artifactId> <version>${maven.version}</version> + <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> + <artifactId>maven-core</artifactId> <version>${maven.version}</version> + <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-artifact</artifactId> <version>${maven.version}</version> + <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.maven</groupId> @@ -94,6 +97,13 @@ <groupId>org.apache.maven</groupId> <artifactId>maven-model</artifactId> <version>${maven.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-compat</artifactId> + <version>${maven.version}</version> + <scope>provided</scope> </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> @@ -105,17 +115,18 @@ <artifactId>plexus-utils</artifactId> <version>${plexus-utils.version}</version> </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-xml</artifactId> - <version>${plexus-xml.version}</version> - </dependency> <dependency> <groupId>org.apache.maven.plugin-testing</groupId> <artifactId>maven-plugin-testing-harness</artifactId> <version>${maven-plugin-testing-harness.version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-container-default</artifactId> + <version>${plexus-container-default.version}</version> + <scope>test</scope> + </dependency> </dependencies> <profiles> diff --git a/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java b/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java index b27ec8a02..7d39e8074 100644 --- a/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java +++ b/esa-maven-plugin/src/main/java/org/apache/aries/plugin/esa/EsaMojo.java @@ -50,19 +50,17 @@ import org.codehaus.plexus.util.FileUtils; * @phase package * @requiresDependencyResolution test */ -public class EsaMojo - extends AbstractMojo -{ +public class EsaMojo extends AbstractMojo { - public enum EsaContent {none, all, content}; + public enum EsaContent {none, all, content} + + public enum EsaManifestContent {all, content} - public enum EsaManifestContent {all, content}; - public static final String SUBSYSTEM_MF_URI = "OSGI-INF/SUBSYSTEM.MF"; private static final String[] DEFAULT_INCLUDES = {"**/**"}; - private static final Set<String> SKIP_INSTRUCTIONS = new HashSet<String>(); + private static final Set<String> SKIP_INSTRUCTIONS = new HashSet<>(); static { SKIP_INSTRUCTIONS.add(Constants.SUBSYSTEM_MANIFESTVERSION); @@ -158,7 +156,7 @@ public class EsaMojo * @parameter */ private Map instructions = new LinkedHashMap(); - + /** * Adding pom.xml and pom.properties to the archive. * @@ -182,9 +180,9 @@ public class EsaMojo /** * Define which bundles to include in the archive. - * none - no bundles are included + * none - no bundles are included * content - direct dependencies go into the content - * all - direct and transitive dependencies go into the content + * all - direct and transitive dependencies go into the content * * @parameter expression="${archiveContent}" default-value="content" */ @@ -219,20 +217,20 @@ public class EsaMojo Set<Artifact> artifacts = null; switch (EsaContent.valueOf(archiveContent)) { case none: - getLog().info("archiveContent=none: subsystem archive will not contain any bundles."); + getLog().info("archiveContent=none: subsystem archive will not contain any bundles."); break; case content: // only include the direct dependencies in the archive - artifacts = project.getDependencyArtifacts(); + artifacts = project.getDependencyArtifacts(); break; case all: // include direct and transitive dependencies in the archive - artifacts = project.getArtifacts(); + artifacts = project.getArtifacts(); break; default: - throw new MojoExecutionException("Invalid configuration for <archiveContent/>. Valid values are none, content and all." ); + throw new MojoExecutionException("Invalid configuration for <archiveContent/>. Valid values are none, content and all." ); } - + if (artifacts != null) { // Explicitly add self to bundle set (used when pom packaging // type != "esa" AND a file is present (no point to add to @@ -242,19 +240,19 @@ public class EsaMojo getLog().info("Explicitly adding artifact[" + selfArtifact.getGroupId() + ", " + selfArtifact.getId() + ", " + selfArtifact.getScope() + "]"); artifacts.add(project.getArtifact()); } - + artifacts = selectArtifactsInCompileOrRuntimeScope(artifacts); artifacts = selectNonJarArtifactsAndBundles(artifacts); int cnt = 0; - for (Artifact artifact : artifacts) { + for (Artifact artifact : artifacts) { if (!artifact.isOptional() /*&& filter.include(artifact)*/) { getLog().info("Copying artifact[" + artifact.getGroupId() + ", " + artifact.getId() + ", " + artifact.getScope() + "]"); zipArchiver.addFile(artifact.getFile(), artifact.getArtifactId() + "-" + artifact.getVersion() + "." + (artifact.getType() == null ? "jar" : artifact.getType())); cnt++; } - } + } getLog().info(String.format("Added %s artifacts to subsystem subsystem archive.", cnt)); } } @@ -264,11 +262,11 @@ public class EsaMojo } } - + /** - * + * * Copies source files to the esa - * + * * @throws MojoExecutionException */ private void copyEsaSourceFiles() throws MojoExecutionException { @@ -310,7 +308,7 @@ public class EsaMojo throw new MojoExecutionException( "Error copying esa resources", e ); } } - + private void includeCustomManifest() throws MojoExecutionException { try { @@ -323,7 +321,7 @@ public class EsaMojo throw new MojoExecutionException( "Error copying SUBSYSTEM.MF file", e ); } } - + private void generateSubsystemManifest() throws MojoExecutionException { if (generateManifest) { String fileName = new String(getBuildDir() + "/" @@ -345,7 +343,7 @@ public class EsaMojo "Error generating SUBSYSTEM.MF file: " + fileName, e); } } - + // Check the manifest exists File ddFile = new File( getBuildDir(), SUBSYSTEM_MF_URI); if ( !ddFile.exists() ) @@ -355,7 +353,7 @@ public class EsaMojo } } - + private void addMavenDescriptor() throws MojoExecutionException { try { @@ -374,15 +372,15 @@ public class EsaMojo File dir = new File(project.getBuild().getDirectory(), "maven-zip-plugin"); File pomPropertiesFile = new File(dir, "pom.properties"); - pomPropertiesUtil.createPomProperties(project, zipArchiver, + pomPropertiesUtil.createPomProperties(project, zipArchiver, null, pomPropertiesFile, forceCreation); } } catch (Exception e) { throw new MojoExecutionException("Error assembling esa", e); } } - - + + private void init() { getLog().debug( " ======= esaMojo settings =======" ); getLog().debug( "esaSourceDirectory[" + esaSourceDirectory + "]" ); @@ -409,9 +407,9 @@ public class EsaMojo zipArchiver.setIncludeEmptyDirs( includeEmptyDirs ); zipArchiver.setCompress( true ); - zipArchiver.setForced( forceCreation ); + zipArchiver.setForced( forceCreation ); } - + private void writeSubsystemManifest(String fileName) throws MojoExecutionException { @@ -462,7 +460,7 @@ public class EsaMojo } String entry = info.getContentLine(); if ("dependencies".equals(startOrder)) { - entry += ";start-order:=\"" + order + "\""; + entry += ";start-order:=\"" + order + "\""; } if (iter.hasNext()) { entry += ",\n "; @@ -500,35 +498,35 @@ public class EsaMojo } return artifact.getGroupId() + "." + artifact.getArtifactId(); } - + private String getSubsystemVersion() { if (instructions.containsKey(Constants.SUBSYSTEM_VERSION)) { return instructions.get(Constants.SUBSYSTEM_VERSION).toString(); } return Analyzer.cleanupVersion(project.getVersion()); } - + private String getSubsystemName() { if (instructions.containsKey(Constants.SUBSYSTEM_NAME)) { return instructions.get(Constants.SUBSYSTEM_NAME).toString(); } return project.getName(); } - + private String getSubsystemDescription() { if (instructions.containsKey(Constants.SUBSYSTEM_DESCRIPTION)) { return instructions.get(Constants.SUBSYSTEM_DESCRIPTION).toString(); } return project.getDescription(); } - + private File getBuildDir() { if (buildDir == null) { buildDir = new File(workDirectory); } return buildDir; } - + private void addBuildDir() throws MojoExecutionException { try { if (buildDir.isDirectory()) { @@ -554,7 +552,7 @@ public class EsaMojo FileUtils.copyFileToDirectory( appMfFile, osgiInfDir); } } - + /** * Return non-pom artifacts in 'compile' or 'runtime' scope only. */ @@ -563,7 +561,7 @@ public class EsaMojo Set<Artifact> selected = new LinkedHashSet<Artifact>(); for (Artifact artifact : artifacts) { String scope = artifact.getScope(); - if (scope == null + if (scope == null || Artifact.SCOPE_COMPILE.equals(scope) || Artifact.SCOPE_RUNTIME.equals(scope)) { if (artifact.getType() == null || !artifact.getType().equals("pom")) { @@ -616,7 +614,7 @@ public class EsaMojo /** * Creates the final archive. - * + * * @throws MojoExecutionException */ private void createEsaFile() throws MojoExecutionException { @@ -636,26 +634,26 @@ public class EsaMojo } } - + public void execute() throws MojoExecutionException { init(); addDependenciesToArchive(); - + copyEsaSourceFiles(); includeCustomManifest(); - + generateSubsystemManifest(); addMavenDescriptor(); - + addBuildDir(); - + includeSharedResources(); - + createEsaFile(); } } diff --git a/esa-maven-plugin/src/test/java/org/apache/aries/plugin/esa/EsaMojoTest.java b/esa-maven-plugin/src/test/java/org/apache/aries/plugin/esa/EsaMojoTest.java index 35c22cf3b..5808925dd 100644 --- a/esa-maven-plugin/src/test/java/org/apache/aries/plugin/esa/EsaMojoTest.java +++ b/esa-maven-plugin/src/test/java/org/apache/aries/plugin/esa/EsaMojoTest.java @@ -39,9 +39,7 @@ import aQute.bnd.osgi.Analyzer; /** * @author <a href="mailto:[email protected]">Allan Ramirez</a> */ -public class EsaMojoTest - extends AbstractMojoTestCase -{ +public class EsaMojoTest extends AbstractMojoTestCase { public void testEsaTestEnvironment() throws Exception {
