diff --git a/.github/workflows/java8_m4.yml b/.github/workflows/java8_m4.yml index 536c287..8144eae 100644 --- a/.github/workflows/java8_m4.yml +++ b/.github/workflows/java8_m4.yml @@ -1,4 +1,4 @@ -name: Integration Tests on Java 8 and Maven 4.0.0-alpha-7 +name: Integration Tests on Java 8 and Maven 4.0.0-alpha-8 on: push: @@ -19,7 +19,7 @@ jobs: java-version: 8 - name: Switch To Maven 4 run: | - echo "distributionUrl=https://dlcdn.apache.org/maven/maven-4/4.0.0-alpha-7/binaries/apache-maven-4.0.0-alpha-7-bin.zip" > .mvn/wrapper/maven-wrapper.properties + echo "distributionUrl=https://dlcdn.apache.org/maven/maven-4/4.0.0-alpha-8/binaries/apache-maven-4.0.0-alpha-8-bin.zip" > .mvn/wrapper/maven-wrapper.properties echo "wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" >> .mvn/wrapper/maven-wrapper.properties - name: Build with Maven run: ./mvnw --batch-mode --update-snapshots install -Prun-its diff --git a/pom.xml b/pom.xml index bc3b707..805c17b 100644 --- a/pom.xml +++ b/pom.xml @@ -101,13 +101,13 @@ org.slf4j slf4j-api - 2.0.7 + 2.0.9 provided org.slf4j slf4j-simple - 2.0.7 + 2.0.9 test @@ -119,7 +119,7 @@ org.apache.maven.plugin-tools maven-plugin-annotations - 3.9.0 + 3.10.2 provided diff --git a/src/it/distributionManagemetTile/invoker.properties b/src/it/distributionManagemetTile/invoker.properties new file mode 100644 index 0000000..1265339 --- /dev/null +++ b/src/it/distributionManagemetTile/invoker.properties @@ -0,0 +1 @@ +invoker.goals = clean dependency:go-offline help:effective-pom deploy diff --git a/src/it/distributionManagemetTile/pom.xml b/src/it/distributionManagemetTile/pom.xml new file mode 100644 index 0000000..54b50e9 --- /dev/null +++ b/src/it/distributionManagemetTile/pom.xml @@ -0,0 +1,31 @@ + + + 4.0.0 + + io.repaint.maven + distribution-management-test + 1.0-SNAPSHOT + pom + + Maven Tiles Distribution Management Test + + + tileA + projectA + + + + + + org.apache.maven.plugins + maven-deploy-plugin + 3.1.1 + + true + + + + + + diff --git a/src/it/distributionManagemetTile/projectA/pom.xml b/src/it/distributionManagemetTile/projectA/pom.xml new file mode 100644 index 0000000..bb560e1 --- /dev/null +++ b/src/it/distributionManagemetTile/projectA/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + + io.repaint.maven + projectA + 1 + pom + + Maven Distribution Management Test + + + + + io.repaint.maven + tiles-maven-plugin + @project.version@ + true + + + io.repaint.maven:tileA:1 + + + + + + diff --git a/src/it/distributionManagemetTile/tileA/pom.xml b/src/it/distributionManagemetTile/tileA/pom.xml new file mode 100644 index 0000000..7e17ab9 --- /dev/null +++ b/src/it/distributionManagemetTile/tileA/pom.xml @@ -0,0 +1,36 @@ + + + 4.0.0 + + io.repaint.maven + tileA + 1 + tile + + Maven Tiles Distribution Management Test - TileA + + + + repaint-staging + io.repaint Staging Repository + file:///tmp/maven-tiles/staging/ + + + repaint-snapshots + io.repaint Snapshot Repository + file:///tmp/maven-tiles/snapshot/ + + + + + + + io.repaint.maven + tiles-maven-plugin + @project.version@ + true + + + + + diff --git a/src/it/distributionManagemetTile/tileA/tile.xml b/src/it/distributionManagemetTile/tileA/tile.xml new file mode 100644 index 0000000..5773dcb --- /dev/null +++ b/src/it/distributionManagemetTile/tileA/tile.xml @@ -0,0 +1,18 @@ + + + 4.0.0 + + + + repaint-tile-staging + io.repaint Staging Repository + file:///tmp/maven-tiles/staging/ + + + repaint-tile-snapshots + io.repaint Snapshot Repository + file:///tmp/maven-tiles/snapshot/ + + + + \ No newline at end of file diff --git a/src/it/distributionManagemetTile/verify.bsh b/src/it/distributionManagemetTile/verify.bsh new file mode 100644 index 0000000..1da0e27 --- /dev/null +++ b/src/it/distributionManagemetTile/verify.bsh @@ -0,0 +1,15 @@ +import java.io.*; +import java.util.*; + +File file = new File(basedir, "build.log" ); +if ( !file.isFile() ) { + throw new FileNotFoundException( "Could not find build log: " + file ); +} + +String content = new Scanner(file).useDelimiter("\\Z").next(); + +// tileX should win +if (!content.contains("repaint-tile-staging")) + throw new Exception("repaint-tile-staging expected to be in effective pom"); +if (!content.contains("io.repaint Staging Repository")) + throw new Exception("io.repaint Staging Repository expected to be in effective pom"); diff --git a/src/main/groovy/io/repaint/maven/tiles/TilesMavenLifecycleParticipant.groovy b/src/main/groovy/io/repaint/maven/tiles/TilesMavenLifecycleParticipant.groovy index 678564c..4ac6354 100644 --- a/src/main/groovy/io/repaint/maven/tiles/TilesMavenLifecycleParticipant.groovy +++ b/src/main/groovy/io/repaint/maven/tiles/TilesMavenLifecycleParticipant.groovy @@ -25,7 +25,6 @@ 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.ArtifactRepository import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy import org.apache.maven.artifact.repository.MavenArtifactRepository import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout @@ -309,7 +308,7 @@ class TilesMavenLifecycleParticipant extends AbstractMavenLifecycleParticipant { // disabled explicit lookup as these seem to be injected just fine. Are these required for eclipse m2e> //repositoryFactory = mavenSession.container.lookup(ArtifactRepositoryFactory) - //repositoryLayouts = mavenSession.lookupMap(ArtifactRepositoryLayout.class.getName()) as Map + repositoryLayouts = mavenSession.lookupMap(ArtifactRepositoryLayout.class.getName()) as Map List allProjects = mavenSession.getProjects() if (allProjects != null) { @@ -349,7 +348,6 @@ class TilesMavenLifecycleParticipant extends AbstractMavenLifecycleParticipant { } else { return new ArtifactRepositoryPolicy(true, UPDATE_POLICY_ALWAYS, CHECKSUM_POLICY_WARN) } - } /** @@ -364,10 +362,11 @@ class TilesMavenLifecycleParticipant extends AbstractMavenLifecycleParticipant { if (distributionManagement) { if (distributionManagement.repository) { - ArtifactRepository repo = new MavenArtifactRepository( + ArtifactRepositoryLayout layout = repositoryLayouts.get(distributionManagement.repository.layout); + MavenArtifactRepository repo = new MavenArtifactRepository( distributionManagement.repository.id, getReleaseDistributionManagementRepositoryUrl(project), - repositoryFactory.layout, + layout, getArtifactRepositoryPolicy(distributionManagement.repository.snapshots), getArtifactRepositoryPolicy(distributionManagement.repository.releases)) project.setReleaseArtifactRepository(repo) @@ -375,13 +374,14 @@ class TilesMavenLifecycleParticipant extends AbstractMavenLifecycleParticipant { } if (distributionManagement.snapshotRepository) { - ArtifactRepository repo = new MavenArtifactRepository( + ArtifactRepositoryLayout layout = repositoryLayouts.get(distributionManagement.snapshotRepository.layout); + MavenArtifactRepository repo = new MavenArtifactRepository( distributionManagement.snapshotRepository.id, getSnapshotDistributionManagementRepositoryUrl(project), - repositoryFactory.layout, + layout, getArtifactRepositoryPolicy(distributionManagement.snapshotRepository.snapshots), getArtifactRepositoryPolicy(distributionManagement.snapshotRepository.releases)) - project.setReleaseArtifactRepository(repo) + project.setSnapshotArtifactRepository(repo) } } @@ -503,8 +503,6 @@ class TilesMavenLifecycleParticipant extends AbstractMavenLifecycleParticipant { Model read(InputStream input, Map options) throws IOException, ModelParseException { Model model = modelProcessor.read(input, options) - - use(GavUtil) { // when we reference a submodule of a CI Friendly module in a pom (i.e. a workspace pom in Eclipse)