Fixed missing offline mode for aether
This commit is contained in:
@@ -56,7 +56,7 @@ Some of the properties that are repetitive can be set using system properties or
|
||||
| Property name | Default value | Description
|
||||
|stubrunner.port.range.min|10000| Minimal value of a port for a started WireMock with stubs
|
||||
|stubrunner.port.range.max|15000| Minimal value of a port for a started WireMock with stubs
|
||||
|stubrunner.stubs.repository.root|| Maven repo url. If blank then will call the local maven repo
|
||||
|stubrunner.stubs.repository.root|| Comma separated list of Maven repo urls. If blank then will call the local maven repo
|
||||
|stubrunner.stubs.classifier|stubs| Default classifier for the stub artifacts
|
||||
|stubrunner.work-offline|false| If true then will not contact any remote repositories to download stubs
|
||||
|stubrunner.stubs.ids|| Comma separated list of Ivy notation of stubs to download
|
||||
|
||||
@@ -54,7 +54,12 @@ class AetherStubDownloader implements StubDownloader {
|
||||
}
|
||||
|
||||
private List<RemoteRepository> remoteRepositories(StubRunnerOptions stubRunnerOptions) {
|
||||
return [new RemoteRepository.Builder("remote", "default", stubRunnerOptions.stubRepositoryRoot).build()]
|
||||
if (stubRunnerOptions.workOffline || !stubRunnerOptions.stubRepositoryRoot) {
|
||||
return []
|
||||
}
|
||||
return stubRunnerOptions.stubRepositoryRoot.split(',').collect { String repo ->
|
||||
new RemoteRepository.Builder("remote", "default", repo).build()
|
||||
}
|
||||
}
|
||||
|
||||
private RepositorySystem newRepositorySystem() {
|
||||
@@ -82,7 +87,7 @@ class AetherStubDownloader implements StubDownloader {
|
||||
}
|
||||
Artifact artifact = new DefaultArtifact(stubsGroup, stubsModule, classifier, ARTIFACT_EXTENSION, highestVersion.toString())
|
||||
ArtifactRequest request = new ArtifactRequest(artifact: artifact, repositories: remoteRepos)
|
||||
log.info("Resolving artifact $artifact from $remoteRepos")
|
||||
log.info("Resolving artifact $artifact from ${remoteRepos?:'local maven repo'}")
|
||||
ArtifactResult result = repositorySystem.resolveArtifact(session, request)
|
||||
log.info("Resolved artifact $artifact to ${result.artifact.file} from ${result.repository}")
|
||||
return unpackStubJarToATemporaryFolder(result.artifact.file.toURI())
|
||||
|
||||
Reference in New Issue
Block a user