Deprecating skipSnapshotCheck and providing fake m2 for Aether
without this change Aether, when having both local and remote JARs, always picks the local one, even though we don't want it to. There seems to be no way to change it via an API. We had a check in Spring Cloud Contract to throw an exception when we wanted a remote JAR but the local one was fetched. You could have changed it by providing a system property or a plugin property called `skipSnapshotCheck` or `contractsSkipSnapshotCheck` with this change we're deprecating that flag since we're moving this logic to the internals of how we integrate with Aether. If the problem was that there was both the local and the remote JAR, what we could do is get rid of the local JAR. Obviously we don't want to remove it so what we're doing is when someone provides the REMOTE stub mode, we're creating a temporary directory and we're temporarily pointing Aether to that directory as our local m2. Since it's empty, Aether will not assume that we have any stubs stored locally. Thus, we will never have conflicts of remote vs local jars. fixes gh-643 additional links: - http://maven.40175.n5.nabble.com/Resolving-an-Artifact-from-Remote-Repository-instead-of-Local-td5875134.html - https://stackoverflow.com/questions/9123004/maven-is-it-possible-to-override-location-of-local-repository-via-the-use-of-co
This commit is contained in:
@@ -261,8 +261,6 @@ closure to set it up.
|
||||
separated. Otherwise, it scans contracts under the provided directory.
|
||||
* *contractsMode*: Specifies the mode of downloading contracts (whether the
|
||||
JAR is available offline, remotely etc.)
|
||||
* *contractsSnapshotCheckSkip*: If set to `true` will not assert whether the
|
||||
downloaded stubs / contract JAR was downloaded from a remote location or a local one(only applicable to Maven repos, not Git or Pact).
|
||||
* *deleteStubsAfterTest*: If set to `false` will not remove any downloaded
|
||||
contracts from temporary directories
|
||||
|
||||
@@ -610,8 +608,6 @@ the following options:
|
||||
* *contractsPath*: The path to the concrete contracts in the JAR with packaged contracts.
|
||||
Defaults to `groupid/artifactid` where `gropuid` is slash separated.
|
||||
* *contractsMode*: Picks the mode in which stubs will be found and registered
|
||||
* *contractsSnapshotCheckSkip*: If `true` then will not assert whether a stub / contract
|
||||
JAR was downloaded from local or remote location
|
||||
* *deleteStubsAfterTest*: If set to `false` will not remove any downloaded
|
||||
contracts from temporary directories
|
||||
* *contractsRepositoryUrl*: URL to a repo with the artifacts that have contracts. If it is not provided,
|
||||
@@ -945,27 +941,6 @@ For example, you might decide to have no dependencies at all.
|
||||
As a consumer, if you add the stub dependency to your classpath, you can explicitly
|
||||
exclude the unwanted dependencies.
|
||||
|
||||
=== CI Server setup
|
||||
|
||||
When fetching stubs / contracts in a CI, shared environment, what might happen is that
|
||||
both the producer and the consumer reuse the same local Maven repository. Due to this,
|
||||
the framework, responsible for downloading a stub JAR from remote location,
|
||||
can't decide which JAR should be picked, local or remote one. That caused
|
||||
the `"The artifact was found in the local repository but you have explicitly
|
||||
stated that it should be downloaded from a remote one"` exception
|
||||
and failed the build.
|
||||
|
||||
For such cases we're introducing the property and plugin setup mechanism:
|
||||
|
||||
- via `stubrunner.snapshot-check-skip` system property
|
||||
- via `STUBRUNNER_SNAPSHOT_CHECK_SKIP` environment variable
|
||||
|
||||
if either of these values is set to `true`, then the stub downloader will not
|
||||
verify the origin of the downloaded JAR.
|
||||
|
||||
For the plugins you need to set the `contractsSnapshotCheckSkip` property
|
||||
to `true`.
|
||||
|
||||
=== Scenarios
|
||||
|
||||
You can handle scenarios with Spring Cloud Contract Verifier. All you need to do is to
|
||||
|
||||
Reference in New Issue
Block a user