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 2024/01/12 08:53:33 UTC
(maven-install-plugin) branch MINSTALL-197 created (now 2e9b68a)
This is an automated email from the ASF dual-hosted git repository.
cstamas pushed a change to branch MINSTALL-197
in repository https://gitbox.apache.org/repos/asf/maven-install-plugin.git
at 2e9b68a [MINSTALL-197] Update to parent 41, cleanup
This branch includes the following new commits:
new 2e9b68a [MINSTALL-197] Update to parent 41, cleanup
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.
(maven-install-plugin) 01/01: [MINSTALL-197] Update to parent 41, cleanup
Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cstamas pushed a commit to branch MINSTALL-197
in repository https://gitbox.apache.org/repos/asf/maven-install-plugin.git
commit 2e9b68a3a85a57eb2aa9d3bc1589306f9648c188
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Fri Jan 12 09:52:29 2024 +0100
[MINSTALL-197] Update to parent 41, cleanup
In general perform a cleanup of plugin, apply updates
where needed. The plugin now builds against 3.9.x latest,
and minimum is lifted to 3.6.3.
---
https://issues.apache.org/jira/browse/MINSTALL-197
---
pom.xml | 53 ++++++++++++++--------
.../maven/plugins/install/InstallFileMojo.java | 8 ++--
.../maven/plugins/install/InstallFileMojoTest.java | 8 +++-
.../maven/plugins/install/InstallMojoTest.java | 8 +++-
.../plugins/install/stubs/InstallArtifactStub.java | 6 +--
5 files changed, 56 insertions(+), 27 deletions(-)
diff --git a/pom.xml b/pom.xml
index 1f4d7c1..02bcf36 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugins</artifactId>
- <version>39</version>
+ <version>41</version>
<relativePath />
</parent>
@@ -46,7 +46,7 @@
</contributors>
<prerequisites>
- <maven>${mavenVersion}</maven>
+ <maven>3.6.3</maven>
</prerequisites>
<scm>
@@ -72,21 +72,21 @@
<properties>
<javaVersion>8</javaVersion>
- <mavenVersion>3.2.5</mavenVersion>
+ <mavenVersion>3.9.6</mavenVersion>
<!-- Maven bound -->
- <aetherVersion>1.0.0.v20140518</aetherVersion>
+ <resolverVersion>1.9.18</resolverVersion>
<!-- Maven bound -->
- <slf4jVersion>1.7.5</slf4jVersion>
+ <slf4jVersion>1.7.36</slf4jVersion>
<!-- plugin versions used in IT tests -->
<mavenAntrunPluginVersion>3.1.0</mavenAntrunPluginVersion>
- <mavenCompilerPluginVersion>3.10.1</mavenCompilerPluginVersion>
- <mavenEnforcerPluginVersion>3.1.0</mavenEnforcerPluginVersion>
+ <mavenCompilerPluginVersion>3.12.1</mavenCompilerPluginVersion>
+ <mavenEnforcerPluginVersion>3.4.1</mavenEnforcerPluginVersion>
<mavenJarPluginVersion>3.3.0</mavenJarPluginVersion>
- <mavenPluginPluginVersion>3.7.0</mavenPluginPluginVersion>
+ <mavenPluginPluginVersion>3.11.0</mavenPluginPluginVersion>
<mavenResourcesPluginVersion>3.3.0</mavenResourcesPluginVersion>
<mavenSourcePluginVersion>3.2.1</mavenSourcePluginVersion>
- <mavenSurefirePluginVersion>3.0.0-M7</mavenSurefirePluginVersion>
+ <mavenSurefirePluginVersion>3.2.5</mavenSurefirePluginVersion>
<project.build.outputTimestamp>2023-03-21T14:31:18Z</project.build.outputTimestamp>
</properties>
@@ -118,15 +118,15 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-api</artifactId>
- <version>${aetherVersion}</version>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-api</artifactId>
+ <version>${resolverVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-util</artifactId>
- <version>${aetherVersion}</version>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-util</artifactId>
+ <version>${resolverVersion}</version>
<!-- To work in Maven versions older than 3.9.0 -->
<scope>compile</scope>
</dependency>
@@ -134,6 +134,10 @@
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-xml</artifactId>
+ </dependency>
<!-- dependencies to annotations -->
<dependency>
@@ -180,13 +184,26 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-impl</artifactId>
- <version>${aetherVersion}</version>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-impl</artifactId>
+ <version>${resolverVersion}</version>
<scope>test</scope>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <proc>none</proc>
+ <showDeprecation>true</showDeprecation>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<profiles>
<profile>
<id>run-its</id>
diff --git a/src/main/java/org/apache/maven/plugins/install/InstallFileMojo.java b/src/main/java/org/apache/maven/plugins/install/InstallFileMojo.java
index 021b5c4..4ba6b64 100644
--- a/src/main/java/org/apache/maven/plugins/install/InstallFileMojo.java
+++ b/src/main/java/org/apache/maven/plugins/install/InstallFileMojo.java
@@ -67,7 +67,7 @@ import static java.util.Objects.nonNull;
*/
@Mojo(name = "install-file", requiresProject = false, aggregator = true, threadSafe = true)
public class InstallFileMojo extends AbstractMojo {
- private static final String LS = System.getProperty("line.separator");
+ private static final String LS = System.lineSeparator();
@Component
private RepositorySystem repositorySystem;
@@ -384,11 +384,11 @@ public class InstallFileMojo extends AbstractMojo {
private File generatePomFile() throws MojoExecutionException {
Model model = generateModel();
try {
- File tempPomFile = File.createTempFile("mvninstall", ".pom");
+ Path tempPomFile = Files.createTempFile("mvninstall", ".pom");
- try (OutputStream writer = Files.newOutputStream(tempPomFile.toPath())) {
+ try (OutputStream writer = Files.newOutputStream(tempPomFile)) {
new MavenXpp3Writer().write(writer, model);
- return tempPomFile;
+ return tempPomFile.toFile();
}
} catch (IOException e) {
throw new MojoExecutionException("Error writing temporary POM file: " + e.getMessage(), e);
diff --git a/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java b/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java
index 8174e8a..5094468 100644
--- a/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java
@@ -30,6 +30,9 @@ import org.apache.maven.project.ProjectBuildingRequest;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.xml.XmlStreamReader;
import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.internal.impl.DefaultLocalPathComposer;
+import org.eclipse.aether.internal.impl.DefaultLocalPathPrefixComposerFactory;
+import org.eclipse.aether.internal.impl.DefaultTrackingFileManager;
import org.eclipse.aether.internal.impl.EnhancedLocalRepositoryManagerFactory;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.NoLocalRepositoryManagerException;
@@ -341,7 +344,10 @@ public class InstallFileMojoTest extends AbstractMojoTestCase {
private MavenSession createMavenSession(String localRepositoryBaseDir) throws NoLocalRepositoryManagerException {
MavenSession session = mock(MavenSession.class);
DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
- repositorySession.setLocalRepositoryManager(new EnhancedLocalRepositoryManagerFactory()
+ repositorySession.setLocalRepositoryManager(new EnhancedLocalRepositoryManagerFactory(
+ new DefaultLocalPathComposer(),
+ new DefaultTrackingFileManager(),
+ new DefaultLocalPathPrefixComposerFactory())
.newInstance(repositorySession, new LocalRepository(localRepositoryBaseDir)));
ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest();
buildingRequest.setRepositorySession(repositorySession);
diff --git a/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java b/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java
index 1de40fe..1939d08 100644
--- a/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java
@@ -39,6 +39,9 @@ import org.apache.maven.project.ProjectBuildingRequest;
import org.codehaus.plexus.util.FileUtils;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.internal.impl.DefaultLocalPathComposer;
+import org.eclipse.aether.internal.impl.DefaultLocalPathPrefixComposerFactory;
+import org.eclipse.aether.internal.impl.DefaultTrackingFileManager;
import org.eclipse.aether.internal.impl.EnhancedLocalRepositoryManagerFactory;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.NoLocalRepositoryManagerException;
@@ -341,7 +344,10 @@ public class InstallMojoTest extends AbstractMojoTestCase {
private MavenSession createMavenSession() throws NoLocalRepositoryManagerException {
MavenSession session = mock(MavenSession.class);
DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
- repositorySession.setLocalRepositoryManager(new EnhancedLocalRepositoryManagerFactory()
+ repositorySession.setLocalRepositoryManager(new EnhancedLocalRepositoryManagerFactory(
+ new DefaultLocalPathComposer(),
+ new DefaultTrackingFileManager(),
+ new DefaultLocalPathPrefixComposerFactory())
.newInstance(repositorySession, new LocalRepository(LOCAL_REPO)));
ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest();
buildingRequest.setRepositorySession(repositorySession);
diff --git a/src/test/java/org/apache/maven/plugins/install/stubs/InstallArtifactStub.java b/src/test/java/org/apache/maven/plugins/install/stubs/InstallArtifactStub.java
index d081382..46d58c4 100644
--- a/src/test/java/org/apache/maven/plugins/install/stubs/InstallArtifactStub.java
+++ b/src/test/java/org/apache/maven/plugins/install/stubs/InstallArtifactStub.java
@@ -74,7 +74,7 @@ public class InstallArtifactStub extends ArtifactStub {
public void addMetadata(ArtifactMetadata metadata) {
if (metadataMap == null) {
- metadataMap = new HashMap<Object, ArtifactMetadata>();
+ metadataMap = new HashMap<>();
}
ArtifactMetadata m = metadataMap.get(metadata.getKey());
@@ -85,8 +85,8 @@ public class InstallArtifactStub extends ArtifactStub {
}
}
- public Collection getMetadataList() {
- return metadataMap == null ? Collections.EMPTY_LIST : metadataMap.values();
+ public Collection<ArtifactMetadata> getMetadataList() {
+ return metadataMap == null ? Collections.emptyList() : metadataMap.values();
}
public boolean isRelease() {