mirror of
https://github.com/bmlong137/maven-tiles
synced 2025-09-10 14:11:08 +00:00
Drop maven-compat and update dependendies
This commit drops the maven-compat dependency and switches to using maven-artifact-transfer and curret maven APIs. - Switched to using Maven 3.9.5 - Updated gmavenplus-plugin to 3.0.2 - Updated maven-enforcer-plugin to 3.4.1 - Updated maven-invoker-plugin to 3.6.0 - Updated maven-plugin-plugin to 3.9.0 - Updated maven-release-plugin to 3.0.1 - Updated maven-scm-plugin to 2.0.1 - Updated maven-source-plugin to 3.3.0 - Updated maven-surefire-plugin to 3.1.2 Switched usage of ArtifactResolver/ArtifactRepositoryFactory to MavenArtifactRepository and updated API calls and tests. Fixes #143. Change-Id: I34010aa815d0c7b46aaecc6eb7c30044b4cdf5a9
This commit is contained in:
@@ -2,6 +2,22 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
== 2.37
|
||||
|
||||
- Drop maven-compat and update dependendies
|
||||
- Switched to using Maven 3.9.5
|
||||
- Updated groovy to 4.0.15
|
||||
- Updated gmavenplus-plugin to 3.0.2
|
||||
- Updated maven-enforcer-plugin to 3.4.1
|
||||
- Updated maven-invoker-plugin to 3.6.0
|
||||
- Updated maven-plugin-plugin to 3.9.0
|
||||
- Updated maven-release-plugin to 3.0.1
|
||||
- Updated maven-scm-plugin to 2.0.1
|
||||
- Updated maven-source-plugin to 3.3.0
|
||||
- Updated maven-surefire-plugin to 3.1.2
|
||||
- Enablerd Reproducible Builds (Hervé Boutemy <hboutemy@apache.org>)
|
||||
- Add missing model version (Guillaume Nodet <gnodet@gmail.com>)
|
||||
|
||||
== 2.36
|
||||
|
||||
- Recompiled/released under Java 8 to resolve String.isBlack issue
|
||||
|
@@ -1,4 +1,4 @@
|
||||
= Tiles Maven Plugin - Version 2.36
|
||||
= Tiles Maven Plugin - Version 2.37
|
||||
|
||||
image:https://travis-ci.org/repaint-io/maven-tiles.svg[caption="Travis Build Status"] image:https://badges.gitter.im/repaint-io/maven-tiles.svg[link="https://gitter.im/repaint-io/maven-tiles?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"]
|
||||
|
||||
@@ -63,7 +63,7 @@ you specify a configuration.
|
||||
<plugin>
|
||||
<groupId>io.repaint.maven</groupId>
|
||||
<artifactId>tiles-maven-plugin</artifactId>
|
||||
<version>2.36</version>
|
||||
<version>2.37</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<filtering>false</filtering>
|
||||
@@ -309,7 +309,7 @@ be applied (in this case before `P`) resulting in the desired structure:
|
||||
<plugin>
|
||||
<groupId>io.repaint.maven</groupId>
|
||||
<artifactId>tiles-maven-plugin</artifactId>
|
||||
<version>2.36</version>
|
||||
<version>2.37</version>
|
||||
<configuration>
|
||||
<applyBefore>group:P</applyBefore>
|
||||
<tiles>
|
||||
|
27
pom.xml
27
pom.xml
@@ -49,7 +49,7 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<mavenVersion>3.8.4</mavenVersion>
|
||||
<mavenVersion>3.9.5</mavenVersion>
|
||||
<groovyVersion>4.0.15</groovyVersion>
|
||||
<repaint.release>dev</repaint.release>
|
||||
<project.build.outputTimestamp>2023-09-15T08:23:45Z</project.build.outputTimestamp>
|
||||
@@ -123,10 +123,9 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-compat</artifactId>
|
||||
<version>${mavenVersion}</version>
|
||||
<scope>provided</scope>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-artifact-transfer</artifactId>
|
||||
<version>0.13.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
@@ -195,7 +194,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-invoker-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<projectsDirectory>src/it</projectsDirectory>
|
||||
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
|
||||
@@ -234,18 +233,18 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-scm-plugin</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<version>2.0.1</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.1</version>
|
||||
<!-- Invocation is defined by the release plugin goal set hence no executions -->
|
||||
<configuration>
|
||||
<rules>
|
||||
<requireMavenVersion>
|
||||
<version>[3.3.9,)</version>
|
||||
<version>[3.9.5,)</version>
|
||||
</requireMavenVersion>
|
||||
<requireReleaseDeps>
|
||||
<!-- Don't allow releases with snapshop deps or parents -->
|
||||
@@ -266,7 +265,7 @@
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>3.0.1</version>
|
||||
<configuration>
|
||||
<mavenExecutorId>forked-path</mavenExecutorId>
|
||||
<arguments>-Drepaint.release=release</arguments>
|
||||
@@ -306,7 +305,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<version>3.8.2</version>
|
||||
<version>3.9.0</version>
|
||||
<configuration>
|
||||
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
|
||||
</configuration>
|
||||
@@ -331,14 +330,14 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.1.2</version>
|
||||
</plugin>
|
||||
|
||||
<!-- not supporting mixed java/groovy compilation -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.gmavenplus</groupId>
|
||||
<artifactId>gmavenplus-plugin</artifactId>
|
||||
<version>2.1.0</version>
|
||||
<version>3.0.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
@@ -354,7 +353,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<version>3.3.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
|
@@ -25,12 +25,13 @@ import org.apache.maven.RepositoryUtils
|
||||
import org.apache.maven.artifact.Artifact
|
||||
import org.apache.maven.artifact.DefaultArtifact
|
||||
import org.apache.maven.artifact.handler.DefaultArtifactHandler
|
||||
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository
|
||||
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy
|
||||
import org.apache.maven.artifact.repository.MavenArtifactRepository
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout
|
||||
import org.apache.maven.artifact.resolver.ArtifactNotFoundException
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolver
|
||||
import org.apache.maven.artifact.resolver.ResolutionErrorHandler
|
||||
import org.apache.maven.artifact.versioning.VersionRange
|
||||
import org.apache.maven.execution.MavenSession
|
||||
@@ -43,6 +44,7 @@ import org.apache.maven.model.Plugin
|
||||
import org.apache.maven.model.PluginExecution
|
||||
import org.apache.maven.model.PluginManagement
|
||||
import org.apache.maven.model.Repository
|
||||
import org.apache.maven.model.RepositoryPolicy
|
||||
import org.apache.maven.model.building.DefaultModelBuilder
|
||||
import org.apache.maven.model.building.DefaultModelBuildingRequest
|
||||
import org.apache.maven.model.building.FileModelSource
|
||||
@@ -63,6 +65,8 @@ import org.apache.maven.project.DefaultModelBuildingListener
|
||||
import org.apache.maven.project.MavenProject
|
||||
import org.apache.maven.project.ProjectBuilder
|
||||
import org.apache.maven.project.ProjectBuildingHelper
|
||||
import org.apache.maven.project.ProjectBuildingRequest
|
||||
import org.apache.maven.repository.RepositorySystem
|
||||
import org.apache.maven.shared.filtering.MavenFileFilter
|
||||
import org.apache.maven.shared.filtering.MavenResourcesFiltering
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom
|
||||
@@ -104,9 +108,6 @@ class TilesMavenLifecycleParticipant extends AbstractMavenLifecycleParticipant {
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(getClass())
|
||||
|
||||
@Inject
|
||||
ArtifactResolver resolver
|
||||
|
||||
@Inject
|
||||
ResolutionErrorHandler resolutionErrorHandler
|
||||
|
||||
@@ -123,7 +124,10 @@ class TilesMavenLifecycleParticipant extends AbstractMavenLifecycleParticipant {
|
||||
ProjectBuildingHelper projectBuildingHelper
|
||||
|
||||
@Inject
|
||||
ArtifactRepositoryFactory repositoryFactory
|
||||
MavenArtifactRepository repositoryFactory
|
||||
|
||||
@Inject
|
||||
RepositorySystem repository;
|
||||
|
||||
@Inject
|
||||
Map<String, ArtifactRepositoryLayout> repositoryLayouts
|
||||
@@ -200,7 +204,9 @@ class TilesMavenLifecycleParticipant extends AbstractMavenLifecycleParticipant {
|
||||
.setArtifact(tileArtifact)
|
||||
.setRemoteRepositories(project?.remoteArtifactRepositories)
|
||||
.setLocalRepository(mavenSession?.localRepository)
|
||||
resolutionErrorHandler.throwErrors(tileReq, resolver.resolve(tileReq))
|
||||
|
||||
def tilesResult = repository.resolve(tileReq);
|
||||
resolutionErrorHandler.throwErrors(tileReq, tilesResult)
|
||||
|
||||
// Resolve the .pom file for the tile
|
||||
Artifact pomArtifact = getPomArtifactForArtifact(tileArtifact)
|
||||
@@ -208,7 +214,9 @@ class TilesMavenLifecycleParticipant extends AbstractMavenLifecycleParticipant {
|
||||
.setArtifact(pomArtifact)
|
||||
.setRemoteRepositories(project?.remoteArtifactRepositories)
|
||||
.setLocalRepository(mavenSession?.localRepository)
|
||||
resolutionErrorHandler.throwErrors(pomReq, resolver.resolve(pomReq))
|
||||
|
||||
def pomResult = repository.resolve(pomReq)
|
||||
resolutionErrorHandler.throwErrors(pomReq, pomResult)
|
||||
|
||||
// When resolving from workspace (e.g. m2e, intellij) we might receive the path to pom.xml instead of the attached tile
|
||||
if (tileArtifact.file && tileArtifact.file.name == "pom.xml") {
|
||||
@@ -217,7 +225,9 @@ class TilesMavenLifecycleParticipant extends AbstractMavenLifecycleParticipant {
|
||||
throw new MavenExecutionException("Tile ${artifactGav(tileArtifact)} cannot be resolved.",
|
||||
tileFile as File)
|
||||
}
|
||||
MavenProject tileProject = projectBuilder.build(pomArtifact.file, mavenSession.request.projectBuildingRequest).getProject()
|
||||
|
||||
ProjectBuildingRequest pbr = mavenSession.request.projectBuildingRequest
|
||||
MavenProject tileProject = projectBuilder.build(pomResult.originatingArtifact, pbr).getProject()
|
||||
tileArtifact.file = FilteringHelper.getTile(tileProject, mavenSession, mavenFileFilter, mavenResourcesFiltering)
|
||||
}
|
||||
|
||||
@@ -332,6 +342,11 @@ class TilesMavenLifecycleParticipant extends AbstractMavenLifecycleParticipant {
|
||||
}
|
||||
}
|
||||
|
||||
ArtifactRepositoryPolicy getArtifactRepositoryPolicy(RepositoryPolicy policy) {
|
||||
return new ArtifactRepositoryPolicy(Boolean.valueOf(policy.enabled),
|
||||
policy.updatePolicy, policy.checksumPolicy)
|
||||
}
|
||||
|
||||
/**
|
||||
* If we get here, we have a Tiles project that might have a distribution management section but it is playing
|
||||
* dicky-birds and hasn't set up the distribution management repositories.
|
||||
@@ -340,18 +355,29 @@ class TilesMavenLifecycleParticipant extends AbstractMavenLifecycleParticipant {
|
||||
*/
|
||||
void discoverAndSetDistributionManagementArtifactoryRepositoriesIfTheyExist(MavenProject project) {
|
||||
DistributionManagement distributionManagement = project.model.distributionManagement
|
||||
Properties properties = project.properties;
|
||||
|
||||
if (distributionManagement) {
|
||||
if (distributionManagement.repository) {
|
||||
project.setReleaseArtifactRepository(repositoryFactory.createDeploymentArtifactRepository(
|
||||
distributionManagement.repository.id, getReleaseDistributionManagementRepositoryUrl(project),
|
||||
repositoryLayouts.get( distributionManagement.repository.layout ?: 'default' ), true ))
|
||||
|
||||
ArtifactRepository repo = new MavenArtifactRepository(
|
||||
distributionManagement.repository.id,
|
||||
getReleaseDistributionManagementRepositoryUrl(project),
|
||||
repositoryFactory.layout,
|
||||
getArtifactRepositoryPolicy(distributionManagement.repository.snapshots),
|
||||
getArtifactRepositoryPolicy(distributionManagement.repository.releases))
|
||||
project.setReleaseArtifactRepository(repo)
|
||||
|
||||
}
|
||||
if (distributionManagement.snapshotRepository) {
|
||||
project.setSnapshotArtifactRepository(repositoryFactory.createDeploymentArtifactRepository(
|
||||
distributionManagement.snapshotRepository.id, getSnapshotDistributionManagementRepositoryUrl(project),
|
||||
repositoryLayouts.get( distributionManagement.snapshotRepository.layout ?: 'default' ), true ))
|
||||
|
||||
ArtifactRepository repo = new MavenArtifactRepository(
|
||||
distributionManagement.repository.id,
|
||||
getSnapshotDistributionManagementRepositoryUrl(project),
|
||||
repositoryFactory.layout,
|
||||
getArtifactRepositoryPolicy(distributionManagement.snapshotRepository.snapshots),
|
||||
getArtifactRepositoryPolicy(distributionManagement.snapshotRepository.releases))
|
||||
project.setReleaseArtifactRepository(repo)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -600,7 +626,8 @@ class TilesMavenLifecycleParticipant extends AbstractMavenLifecycleParticipant {
|
||||
.setArtifact(artifact)
|
||||
.setRemoteRepositories(project?.remoteArtifactRepositories)
|
||||
.setLocalRepository(mavenSession?.localRepository)
|
||||
resolutionErrorHandler.throwErrors(req, resolver.resolve(req))
|
||||
|
||||
repository.resolve(req)
|
||||
|
||||
return createModelSource(artifact.file)
|
||||
}
|
||||
|
@@ -21,7 +21,6 @@ import org.apache.maven.artifact.Artifact
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionResult
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolver
|
||||
import org.apache.maven.artifact.resolver.DefaultResolutionErrorHandler
|
||||
import org.apache.maven.execution.MavenExecutionRequest
|
||||
import org.apache.maven.execution.MavenExecutionResult
|
||||
@@ -34,6 +33,7 @@ import org.apache.maven.model.PluginExecution
|
||||
import org.apache.maven.model.building.ModelBuildingRequest
|
||||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader
|
||||
import org.apache.maven.project.MavenProject
|
||||
import org.apache.maven.repository.RepositorySystem
|
||||
import org.apache.maven.shared.filtering.DefaultMavenFileFilter
|
||||
import org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom
|
||||
@@ -53,6 +53,7 @@ import static io.repaint.maven.tiles.GavUtil.artifactName
|
||||
import static org.junit.Assert.assertEquals
|
||||
import static org.mockito.Mockito.mock
|
||||
import static org.mockito.Mockito.when
|
||||
|
||||
/**
|
||||
* If testMergeTile fails with java.io.FileNotFoundException: src/test/resources/licenses-tiles-pom.xml
|
||||
* (No such file or directory)) when running the test from your IDE, make sure you configure the Working
|
||||
@@ -101,17 +102,18 @@ public class TilesMavenLifecycleParticipantTest {
|
||||
void stuffParticipant() {
|
||||
participant.logger = logger
|
||||
participant.mavenSession = mockMavenSession
|
||||
participant.resolver = [
|
||||
resolve: { ArtifactResolutionRequest request ->
|
||||
return new ArtifactResolutionResult()
|
||||
participant.repository = [
|
||||
resolve: { ArtifactResolutionRequest req ->
|
||||
new ArtifactResolutionResult()
|
||||
}
|
||||
] as ArtifactResolver
|
||||
] as RepositorySystem
|
||||
participant.resolutionErrorHandler = new DefaultResolutionErrorHandler()
|
||||
participant.versionRangeResolver = [
|
||||
resolveVersionRange: { session, request ->
|
||||
return null
|
||||
}
|
||||
] as VersionRangeResolver
|
||||
|
||||
}
|
||||
|
||||
public Artifact getTileTestCoordinates() {
|
||||
@@ -131,20 +133,20 @@ public class TilesMavenLifecycleParticipantTest {
|
||||
public void ensureBadArtifactsFail() {
|
||||
Artifact badbadbad = participant.getArtifactFromCoordinates("bad", "bad", "bad", "bad", "bad")
|
||||
|
||||
participant.resolver = [
|
||||
participant.repository = [
|
||||
resolve: { ArtifactResolutionRequest request ->
|
||||
new ArtifactResolutionResult().addErrorArtifactException(new ArtifactResolutionException("failed", badbadbad))
|
||||
}
|
||||
] as ArtifactResolver
|
||||
] as RepositorySystem
|
||||
|
||||
shouldFail(MavenExecutionException) {
|
||||
participant.resolveTile(null, null, badbadbad)
|
||||
}
|
||||
participant.resolver = [
|
||||
participant.repository = [
|
||||
resolve: { ArtifactResolutionRequest request ->
|
||||
new ArtifactResolutionResult().addMissingArtifact(badbadbad)
|
||||
}
|
||||
] as ArtifactResolver
|
||||
] as RepositorySystem
|
||||
|
||||
shouldFail(MavenExecutionException) {
|
||||
participant.resolveTile(null, null, badbadbad)
|
||||
|
Reference in New Issue
Block a user