Skip to content

Commit

Permalink
[MINSTALL-197] Update to parent 41, cleanup
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cstamas committed Jan 12, 2024
1 parent 30d2b53 commit 2e9b68a
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 27 deletions.
53 changes: 35 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugins</artifactId>
<version>39</version>
<version>41</version>
<relativePath />
</parent>

Expand All @@ -46,7 +46,7 @@
</contributors>

<prerequisites>
<maven>${mavenVersion}</maven>
<maven>3.6.3</maven>
</prerequisites>

<scm>
Expand All @@ -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>
Expand Down Expand Up @@ -118,22 +118,26 @@
<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>
<dependency>
<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>
Expand Down Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
*/
@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;
Expand Down Expand Up @@ -384,11 +384,11 @@ private Model generateModel() {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
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;
Expand Down Expand Up @@ -341,7 +344,10 @@ private String dotToSlashReplacer(String parameter) {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
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;
Expand Down Expand Up @@ -341,7 +344,10 @@ private String dotToSlashReplacer(String parameter) {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public String getExtension() {

public void addMetadata(ArtifactMetadata metadata) {
if (metadataMap == null) {
metadataMap = new HashMap<Object, ArtifactMetadata>();
metadataMap = new HashMap<>();
}

ArtifactMetadata m = metadataMap.get(metadata.getKey());
Expand All @@ -85,8 +85,8 @@ public void addMetadata(ArtifactMetadata metadata) {
}
}

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() {
Expand Down

0 comments on commit 2e9b68a

Please sign in to comment.