Resolve issues with missing snapshot repositorie.

- Looks like we were still referring to repository instead of
  snapshotRepository when setting the snapshot repo.
- Updated distributionManagement IT test to call `deploy` which triggers
  the error.
- Updated IT repository to point to file:///tmp... so we can "deploy"
- Added deploy skipping to top level reactor build
- Added <distributionManagement> to the 'release tile's pom.xml so it
  can deploy.
- Updated IT test verification to check for both repository ID and URL

Fixes #144

Change-Id: I4e9b9d561d81dd814080ecabfe3d39e0a43abb76
This commit is contained in:
Mark Derricutt
2023-11-09 15:35:06 +13:00
parent 8e82176a01
commit 0a85881fc1
6 changed files with 43 additions and 13 deletions

View File

@@ -1 +1 @@
invoker.goals = clean dependency:go-offline help:effective-pom
invoker.goals = clean dependency:go-offline help:effective-pom deploy

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.repaint.maven</groupId>
@@ -7,10 +8,24 @@
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Maven Tiles Order Test</name>
<name>Maven Tiles Distribution Management Test</name>
<modules>
<module>tileA</module>
<module>projectA</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -9,6 +9,19 @@
<name>Maven Tiles Distribution Management Test - TileA</name>
<distributionManagement>
<repository>
<id>repaint-staging</id>
<name>io.repaint Staging Repository</name>
<url>file:///tmp/maven-tiles/staging/</url>
</repository>
<snapshotRepository>
<id>repaint-snapshots</id>
<name>io.repaint Snapshot Repository</name>
<url>file:///tmp/maven-tiles/snapshot/</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>

View File

@@ -4,14 +4,14 @@
<distributionManagement>
<repository>
<id>sonatype-staging</id>
<name>oss.sonatype.org Staging Repository</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<id>repaint-tile-staging</id>
<name>io.repaint Staging Repository</name>
<url>file:///tmp/maven-tiles/staging/</url>
</repository>
<snapshotRepository>
<id>sonatype-snapshots</id>
<name>oss.sonatype.org Snapshot Repository</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<id>repaint-tile-snapshots</id>
<name>io.repaint Snapshot Repository</name>
<url>file:///tmp/maven-tiles/snapshot/</url>
</snapshotRepository>
</distributionManagement>

View File

@@ -9,5 +9,7 @@ if ( !file.isFile() ) {
String content = new Scanner(file).useDelimiter("\\Z").next();
// tileX should win
if (!content.contains("oss.sonatype.org Staging Repository"))
throw new Exception("oss.sonatype.org Staging Repository expected to be in effective pom");
if (!content.contains("<id>repaint-tile-staging</id>"))
throw new Exception("<id>repaint-tile-staging</id> 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");

View File

@@ -374,14 +374,14 @@ class TilesMavenLifecycleParticipant extends AbstractMavenLifecycleParticipant {
}
if (distributionManagement.snapshotRepository) {
ArtifactRepositoryLayout layout = repositoryLayouts.get(distributionManagement.repository.layout);
ArtifactRepositoryLayout layout = repositoryLayouts.get(distributionManagement.snapshotRepository.layout);
MavenArtifactRepository repo = new MavenArtifactRepository(
distributionManagement.snapshotRepository.id,
getSnapshotDistributionManagementRepositoryUrl(project),
layout,
getArtifactRepositoryPolicy(distributionManagement.snapshotRepository.snapshots),
getArtifactRepositoryPolicy(distributionManagement.snapshotRepository.releases))
project.setReleaseArtifactRepository(repo)
project.setSnapshotArtifactRepository(repo)
}
}