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

Conflicting versions of transitive dependencies on the application classpath #13

Closed
balbusm opened this issue Mar 1, 2016 · 14 comments
Closed
Assignees
Labels

Comments

@balbusm
Copy link

balbusm commented Mar 1, 2016

Capsule-maven puts all transitive dependencies on the classpath even they are same but with different version. On the other hand maven selects only latest one. This leads to the runtime errors (Eg NoSuchMethodError etc).
Please select latest version among the transitive dependencies.

@circlespainter
Copy link
Member

@gzsombor
Copy link

gzsombor commented Mar 6, 2016

Or at least provide a way to pick one version.

@circlespainter circlespainter self-assigned this Mar 9, 2016
@circlespainter
Copy link
Member

Capsule relies entirely on Aether for dependencies resolution and it already specifies Maven's nearest-wins conflict resolution strategy so theoretically the latest version should be selected already.

Can you share a debug session that shows otherwise and/or (even better) a test case for this behavior?

@balbusm
Copy link
Author

balbusm commented Mar 9, 2016

See https://github.com/puniverse/capsule-maven/blob/master/src/main/java/MavenCapsule.java#L171
You have manifest:
Dependencies: DepA, DepB
It resolves DepA from manifest with all transitive conflicts then resolves DepB from manifest with all transitive conflicts. It doesn't resolve conflicts between list of transitive dependencies from DepA and list of transitive dependencies from DepB, it just combines those two lists.

@circlespainter
Copy link
Member

The resolution mechanism performs lookups and then resolves. lookup ends up calling lookup0 in the Maven caplet which just stores the dependency as unresolved. resolve will end up calling resolve0 in the Maven caplet and the first invocation about an unresolved dependency will call the dependency manager passing all the unresolved dependencies. This means that resolution should theoretically factor versions correctly according to a nearest-wins strategy even across distinct Dependencies entries.

If you can share an example reproducing the issue this will make it easier to identify it and fix it if needed (of course a PR with a fix proposal would be even better).

Thanks!

@circlespainter
Copy link
Member

Setup https://github.com/circlespainter/capsule-maven-13 that should correctly track down this behavior to Aether and got in touch on the mailing list.

@circlespainter
Copy link
Member

Not getting feedback, reported as a bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=490962

@circlespainter
Copy link
Member

The same happens when upgrading Aether to 1.1.0, both test project and issue report updated to reflect that.

@circlespainter
Copy link
Member

Considering https://projects.eclipse.org/projects/technology.aether/reviews/termination-review, also written to the Maven mailing list about it.

@circlespainter
Copy link
Member

@balbusm @gzsombor Could you try capsule-maven 1.0.3-SNAPSHOT that should be available from SonaType snapshots? (it still depends on capsule 1.0.2)

@gzsombor
Copy link

How can I do it? I'm using the com.github.chrischristo:capsule-maven-plugin but I can't specify the version of the capsule-maven

@circlespainter
Copy link
Member

I've just asked about chrisdchristo/capsule-maven-plugin#49 for the future but in the meanwhile I've just published a Capsule 1.0.3-SNAPSHOT (identical to 1.0.2 for now) and a capsule-maven 1.0.3-SNAPSHOT depending on the same Capsule version, so you should be able to use the Maven plugin by specifying capsule.version as 1.0.3-SNAPSHOT.

@chrisdchristo
Copy link

Hi @gzsombor, @circlespainter you can already set the capsule maven version in the plugin.

The plugin looks for two variables defined in the pom.xml:

<capsule.version>1.0.2</capsule.version>
<capsule.maven.version>1.0.3-SNAPSHOT</capsule.maven.version>

This was done in a recent release, so please check you're using the latest version of the plugin.

@circlespainter
Copy link
Member

circlespainter commented Apr 22, 2016

@chrischristo Great, thanks!

@circlespainter circlespainter changed the title Incorrect versions on the classpath Conflicting versions of dependencies on the application classpath May 2, 2016
@circlespainter circlespainter changed the title Conflicting versions of dependencies on the application classpath Conflicting versions of transitive dependencies on the application classpath May 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants