Skip to content

Instantly share code, notes, and snippets.

@ygrenzinger
Created February 29, 2020 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ygrenzinger/1b430802b684719b342cdbd17bec7a9a to your computer and use it in GitHub Desktop.
Save ygrenzinger/1b430802b684719b342cdbd17bec7a9a to your computer and use it in GitHub Desktop.
A way to reproduce the conflict between REMOTE/Git and convert/generateTests goals
How to reproduce :
clone this repo https://github.com/magelle/devoxx2020-contract-testing
in inventory project run Spring Cloud Contract plugin : No problem
You can then create a git repository. A local one is good enough, like explained [there](https://github.com/magelle/devoxx2020-contract-testing/blob/master/README.md#part-2)
You can add the following configuration :
<contractsMode>REMOTE</contractsMode>
<contractsRepositoryUrl>git://file:///Users/ygrenzinger/git/test.git</contractsRepositoryUrl>
You can now run pushStubsToScm goal of the plugin and the contract will appear in the master branch of the repo as expected (after a git pull).
But now as soon you try to run the convert or generateTests goals. The following errors appear:
[INFO] --- spring-cloud-contract-maven-plugin:2.2.1.RELEASE:generateTests (default-cli) @ inventory ---
[INFO] Generating server tests source code for Spring Cloud Contract Verifier contract verification
[INFO] Download dependency is provided - will retrieve contracts from a remote location
[INFO] Cloning repo from [file:///Users/ygrenzinger/git/test.git] to [/var/folders/hh/gzd7qn614hsc_2clp3m4gvhr0000gn/T/git-contracts-1582982730854-0]
[INFO] Cloned repo to [/var/folders/hh/gzd7qn614hsc_2clp3m4gvhr0000gn/T/git-contracts-1582982730854-0]
[INFO] Won't check out the same branch. Skipping
[WARNING] No matching contracts were found in the repo for []
[WARNING] Stub Downloader [org.springframework.cloud.contract.stubrunner.GitStubDownloader] failed to find an entry for []. Will proceed to the next one
[INFO] Will download stubs and contracts via Aether
[INFO] Desired version is [+] - will try to resolve the latest version
[WARNING] Exception occurred while trying to fetch the stubs
java.lang.IllegalArgumentException: For groupId [null] artifactId [null] and classifier [null] the version was not resolved! The following exceptions took place [org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata /maven-metadata.xml in local (/var/folders/hh/gzd7qn614hsc_2clp3m4gvhr0000gn/T/aether-local5052920130704982108), org.eclipse.aether.transfer.MetadataTransferException: Could not transfer metadata /maven-metadata.xml from/to remote0 (git://file:///Users/ygrenzinger/git/test.git): Cannot access git://file:///Users/ygrenzinger/git/test.git with type default using the available connector factories: BasicRepositoryConnectorFactory]
at org.springframework.cloud.contract.stubrunner.AetherStubDownloader.resolveHighestArtifactVersion (AetherStubDownloader.java:266)
at org.springframework.cloud.contract.stubrunner.AetherStubDownloader.getVersion (AetherStubDownloader.java:212)
at org.springframework.cloud.contract.stubrunner.AetherStubDownloader.downloadAndUnpackStubJar (AetherStubDownloader.java:223)
at org.springframework.cloud.contract.stubrunner.CompositeStubDownloader.entry (CompositeStubDownloaderBuilder.java:95)
at org.springframework.cloud.contract.stubrunner.CompositeStubDownloader.downloadAndUnpackStubJar (CompositeStubDownloaderBuilder.java:70)
at org.springframework.cloud.contract.stubrunner.ContractDownloader.unpackAndDownloadContracts (ContractDownloader.java:104)
at org.springframework.cloud.contract.maven.verifier.MavenContractsDownloader.downloadAndUnpackContractsIfRequired (MavenContractsDownloader.java:121)
at org.springframework.cloud.contract.maven.verifier.GenerateTestsMojo.execute (GenerateTestsMojo.java:279)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
[WARNING] Stub Downloader [org.springframework.cloud.contract.stubrunner.AetherStubDownloader] failed to find an entry for []. Will proceed to the next one
[WARNING] No matching stubs or contracts were found
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.286 s
[INFO] Finished at: 2020-02-29T14:25:32+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.cloud:spring-cloud-contract-maven-plugin:2.2.1.RELEASE:generateTests (default-cli) on project inventory: Execution default-cli of goal org.springframework.cloud:spring-cloud-contract-maven-plugin:2.2.1.RELEASE:generateTests failed: No stubs or contracts were found for [] and the switch to fail on no stubs was set. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment