-
Notifications
You must be signed in to change notification settings - Fork 161
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
Dependencies are not resolved when pom used as compile dependency commonly done by gradle published pom.xml #1065
Comments
yeah something weird is going on - ill need to debug it. i can just say i can confirm the issue - best guess is that somehow mavencentral doesn't get properly registered ...but just a hunch. |
|
let me rephrase - somehow "org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-depchain:jar:3.1.4" shows up as dependenncy which actually does not exist - "org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-depchain:pom:3.1.4" does though. |
so I created a minimal pom.xml:
and when I do:
so jbang is technically reporting correctly here - some metadata in the chain of deps is wrong/bad. Now I need to figure out why this is not triggered in gradle ...nor when doing mvn compile. |
The issue is this line: https://github.com/Minestom/DependencyGetter/blob/066247f91b7c90db846134b192fdcf1507855a27/build.gradle.kts#L20 i'm 99% sure that is not valid so when pom.xml data generated it becomes invalid.
but in general what is happening is a gradle idiom leaking into maven world which is not valid afaics. |
so yeah, DependencyGetter generates this pom in https://jitpack.io/com/github/Minestom/DependencyGetter/1.0.1/DependencyGetter-1.0.1.pom
that dependency does NOT exist. This does:
but that would also be wrong as you would have a pom file on classpath.
which you get if you use the bom as an actual bom - see https://docs.gradle.org/current/userguide/platforms.html#sub:bom_import |
PR opened on minestorm that seem to fix it Minestom/DependencyGetter#4 |
How about following style, bom as real Bill of Material and pom for dependencies import?
ShrinkWrap supports to resolve pom as dependencies: final ConfigurableMavenResolverSystem resolver = Maven.configureResolver();
File[] files = resolver.resolve("org.codehaus.groovy:groovy-all:pom:3.0.9").withTransitivity().asFile();
for (File file : files) {
System.out.println(file.getAbsolutePath());
} |
It only support one bom. Not multiple which is what needs fixing. But that doesn't solve this problem as the issue here is in the metadata - the pom.xml published by gradle are wrong/incorrect. |
oh i missed your bom / pom differences - interesting idea but separate from this issue which is about pom.xml metadata published on maven central being wrong. you can open that idea as separate but it can't use the qualifier of the maven artifact reference to make the difference as no artifact has @bom artifact type. |
For example: yes, Maven.resolver().resolve("io.quarkus:quarkus-bom:pom:2.6.1.Final").withoutTransitivity().asFile();
File repositoryHome = new File(System.getProperty("user.home"), ".m2/repository");
File bomFile = new File(repositoryHome, "io/quarkus/quarkus-bom/2.6.1.Final/quarkus-bom-2.6.1.Final.pom");
PomEquippedResolveStage bomResolveStage = Maven.resolver().loadPomFromFile(bomFile).importCompileAndRuntimeDependencies();
MavenResolvedArtifact artifact = bomResolveStage.resolve("com.google.guava:guava").withoutTransitivity().asSingle(MavenResolvedArtifact.class);
assertThat(artifact.getCoordinate().getVersion()).isEqualTo("30.1.1-jre"); |
Please open other issue for this. We are not going to be able change the semantics for how pom.xml works. Your idea about allowing jbang users to express in jbang file to fetch dependencies inside a pom we can look at but this issue here is about what to do with the invalid pom.xml files published by gradle. Different issue. |
I have the following script
but for some reason jbang doesn't resolve the dependencies:
but
org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-depchain:jar:3.1.4
is definitely in maven central. To be sure I create a quick gradle project with similar dependencies:and that works just fine...
The text was updated successfully, but these errors were encountered: