Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven plugin is not using maven repositories #2118

Open
jakub-bochenski opened this issue Jun 21, 2024 · 2 comments
Open

Maven plugin is not using maven repositories #2118

jakub-bochenski opened this issue Jun 21, 2024 · 2 comments

Comments

@jakub-bochenski
Copy link
Contributor

Describe the bug

contractsRepositoryUrl: URL to a repository with the artifacts that have contracts. If it is not provided, use the current Maven ones.

I've tried adding repositories to the maven project and to settings but none of those work.

Instead I see

[DEBUG] Using the following remote repos [remote0 (jar:file:/home/jakub/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.15.4/jackson-databind-2.15.4.jar!/META-INF/versions/9/, default, releases+snapshots)]

which makes no sense.

The downloading stubs fails with:

[DEBUG] Could not obtain transporter factory for remote0 (jar:file:/home/jakub/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.15.4/jackson-databind-2.15.4.jar!/META-INF/versions/9/, default, releases+snapshots)
org.eclipse.aether.transfer.NoTransporterException: Unsupported transport protocol jar

It works if I set the contractsRepositoryUrl (and credentials) manually in the plugin.

But I'd rather not repeat the repository configuration there and use the built in maven mechanism for resolving dependencies.

It's all rather confusing. I'm building with Maven, why do I have to setup this artifact resolution manually?

@jakub-bochenski
Copy link
Contributor Author

jakub-bochenski commented Nov 27, 2024

I'm now using contractMode=LOCAL and just add the contracts jar to module dependencies.

Pros:

  • don't have to duplicate the credentials setup
    Cons:
  • the support for + version is broken, I have to specify the version explicitly in contractDependency

@jakub-bochenski
Copy link
Contributor Author

Even better I add the contracts jar to plugin dependencies.

It's not polluting the project dependencies, and it makes sense - it's the plugin that uses the artifact.

Interestingly you could use LOCAL or CLASSPATH mode with this approach to the same effect.

Using + still fails though

java.lang.IllegalArgumentException: For groupId [com.example.contracts] artifactId [example] and classifier [stubs] the version was not resolved! The following exceptions took place [org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata com.example.contracts:example/maven-metadata.xml in local (/home/jakub/.m2/repository), org.eclipse.aether.transfer.MetadataNotFoundException: Cannot access remote0 (jar:file:/home/jakub/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.15.4/jackson-databind-2.15.4.jar!/META-INF/versions/9/) in offline mode and the metadata com.example.contracts:example/maven-metadata.xml has not been downloaded from it before]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants