Skip to content

Commit c38efa5

Browse files
chore: use maven 3.x-compatible resolver api (#2077)
1 parent b4d9a70 commit c38efa5

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

maven/pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@
4242
<distributionManagement>
4343
<snapshotRepository>
4444
<id>ossrh</id>
45-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
45+
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
4646
</snapshotRepository>
4747
<repository>
4848
<id>ossrh</id>
49-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
49+
<url>https://repo1.maven.org/maven2/</url>
5050
</repository>
5151
</distributionManagement>
5252
<prerequisites>
@@ -77,7 +77,6 @@
7777
<artifactId>test-interface</artifactId>
7878
<version>1.0</version>
7979
</dependency>
80-
<!-- Used by MavenMojoLogger for color detection (was previously transitive via maven-invoker) -->
8180
<dependency>
8281
<groupId>org.apache.maven.shared</groupId>
8382
<artifactId>maven-shared-utils</artifactId>
@@ -153,8 +152,8 @@
153152
<artifactId>maven-plugin-plugin</artifactId>
154153
<version>3.15.2</version>
155154
</plugin>
156-
<!-- Add Implementation-Version to the manifest so the plugin can resolve its own stryker4s version
157-
at runtime (used to fetch the matching stryker4s-testrunner artifact) -->
155+
<!-- Add Implementation-Version to the manifest so the plugin can resolve its own
156+
stryker4s version at runtime (used to fetch the matching stryker4s-testrunner artifact) -->
158157
<plugin>
159158
<groupId>org.apache.maven.plugins</groupId>
160159
<artifactId>maven-jar-plugin</artifactId>
@@ -240,7 +239,7 @@
240239
</plugins>
241240
</build>
242241
<profiles>
243-
242+
244243
<profile>
245244
<id>release</id>
246245
<build>
@@ -306,6 +305,7 @@
306305
</configuration>
307306
</plugin>
308307
<plugin>
308+
<groupId>org.apache.maven.plugins</groupId>
309309
<artifactId>maven-deploy-plugin</artifactId>
310310
<version>3.1.4</version>
311311
<configuration>

maven/src/main/scala/stryker4s/maven/runner/ArtifactResolver.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import org.eclipse.aether.util.artifact.JavaScopes
1313
import org.eclipse.aether.util.filter.DependencyFilterUtils
1414
import stryker4s.log.Logger
1515

16+
import scala.annotation.nowarn
1617
import scala.jdk.CollectionConverters.*
1718

1819
/** Resolves Maven artifacts (and their transitive runtime dependencies) at plugin runtime via Aether, against the
@@ -28,14 +29,16 @@ class ArtifactResolver(project: MavenProject, session: MavenSession, repoSystem:
2829
* @param coordinates
2930
* `groupId:artifactId[:extension[:classifier]]:version`
3031
*/
32+
@nowarn()
3133
def resolveArtifact(coordinates: String): IO[Path] = {
3234
log.debug(s"Resolving artifact $coordinates")
3335
val request = new ArtifactRequest(new DefaultArtifact(coordinates), repositories, null)
3436
IO.blocking:
35-
Path.fromNioPath(repoSystem.resolveArtifact(repoSession, request).getArtifact().getPath())
37+
Path.fromNioPath(repoSystem.resolveArtifact(repoSession, request).getArtifact().getFile().toPath())
3638
}
3739

3840
/** Resolve an artifact together with all of its transitive runtime dependencies. */
41+
@nowarn
3942
def resolveTransitively(coordinates: String): IO[Seq[Path]] = {
4043
log.debug(s"Resolving $coordinates with transitive dependencies")
4144
val root = new Dependency(new DefaultArtifact(coordinates), JavaScopes.RUNTIME)
@@ -49,6 +52,6 @@ class ArtifactResolver(project: MavenProject, session: MavenSession, repoSystem:
4952
.getArtifactResults()
5053
.asScala
5154
.toSeq
52-
.map(a => Path.fromNioPath(a.getArtifact().getPath()))
55+
.map(a => Path.fromNioPath(a.getArtifact().getFile().toPath()))
5356
}
5457
}

0 commit comments

Comments
 (0)