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
Unable to properly resolve dynamic dependencies from mavenLocal() repo #11321
Comments
Thanks for reporting @lkoe. Looks like Gradle never looked for
|
Hi @jjohannes , I wanted to mention, this behavior appears only if you use dynamic versioning. |
Good point @Yg0R2. If only the |
So doing a bit of research on this topic. First of all, the presence of a
Given all of that, my take is we should ignore the metadata sources configuration for Maven local version listing and always do file listing. |
We can also restore the "old" behavior for Maven local. I.e have it default to
It's probably less "special case", easier to implement, and with that less risky, as we will restore the 5.x behavior. So something like adding this
here: Lines 143 to 147 in 1f259cf
|
OR, the 3rd way. Currently "listing" and "metadata sources" have been bound together, but we could decide to have a different kind of lister for Maven local, which doesn't care about the presence of |
That's the current idea I am looking at, have a specialized Effectively changing the configuration is a simpler change, but it also makes it harder to explain the difference. And finally, the current |
There is no way to rely on a `maven-metadata.xml` for Maven local version listing. Since Gradle 6.0 removed the default `artifact()` metadata source, this causes all dynamic version resolution to fail with Maven local. This commit changes the way Maven local is handled to _always_ do version listing through directory listing. Fixes #11321
@lkoe we have fixed the issue for a |
Thanks @jjohannes, unfortunately due to a business trip I can only manage to test next wednesday. Hope that's still inside the 6.0.1 timeframe... |
There was a copy/paste mistake in the nightly version. Please use We hope to have 6.0.1 out before next wednesday, but no worry if you cannot validate before then. We will have to trust our own testing 😉 |
Confirmed, works for me with 6.0.1. Thx! |
This comment has been minimized.
This comment has been minimized.
Sorry just found out, "dynamic plugin versions are not supported". Thanks anyways! |
We're using a dynamic version as well for our inhouse plugins. This worked fine in the past and - with this issue fixed - also with 6.0.1 |
Hey @lkoe, interesting! Can you tell me how you did it? Maybe just to clarify, I was speaking about referencing the plugin versions dynamically like:
Not referencing libraries used by the plugin dynamically using a dependency block. |
We're defining our plugin as dependency in the buildscript block in ´init.gradle´
In the projects we then just apply our plugins without version. |
Thanks so much @lkoe and sorry for spamming this issue with a "help request". I didn't came to the idea of using the legacy buildscript block, but it worked flawelessly! By adding the buildscript block to the settings.gradle, we not even had to use the allprojects closure block! Thanks again Lars! |
`
.. how I can resolve it? |
If that does not work, can you share:
|
@ljacomet thanks for your response. Originally SNAPSHOTs were installed by Apache Solr ant script. Turns out, after I manually invoked $mvn install-file for all snapshot artefacts gradle successfully find local dependencies. I also noticed that |
Good to know the issue is solved. |
Ithink I'm still affected by this issue. Let me know if you prefer that I create a separate issue.
This is when using custom configurations: allprojects {
repositories {
mavenLocal()
}
}
configurations {
create("sqplugins") { isTransitive = false }
}
dependencies {
"sqplugins"("org.sonarsource.dotnet:sonar-csharp-plugin:8.23-SNAPSHOT@jar")
}
tasks.prepareSandbox {
doLast {
copy {
from(project.configurations.get("sqplugins"))
into(file("$destinationDir/$pluginName/plugins"))
}
}
} Running the build fails to find the dependency:
but the SNAPSHOT is there:
The workaround worked: mavenLocal() {
metadataSources {
mavenPom()
artifact()
}
} I can't understand why the log says that the pom (file:/home/julien/.m2/repository/org/sonarsource/dotnet/sonar-csharp-plugin/8.23-SNAPSHOT/sonar-csharp-plugin-8.23-SNAPSHOT.pom) is not there, while it obviously is. |
I'm in the same boat as @henryju. My gradle info:
Workaround also works for me. |
@henryju If you can craft a reproducer, please file an issue. |
I created a reproducer here: https://github.com/henryju/repro_gradle_11321
and then try to build the Gradle project:
I don't have file
File The issue seems to come from the Maven packaging type that is |
Gradle 6.0 fails to resolve artifacts from the mavenLocal() repository.
The artifact was published using the maven-publish plugin.
In the local maven repository metadata was published as
maven-metadata-local.xml
(as before).However Gradle 6.0 seems to be exclusively looking for a file named
maven-metadata.xml
- which isn't there.If the
maven-metadata-local.xml
files are renamed tomaven-metadata.xml
, resolution works.Expected Behavior
The dependency should be properly resolved like with Gradle 5 and before.
Current Behavior
The dependency was not resolved from the local Maven repository.
Context
For inhouse gradle plugin development I publish the plugin locally first in order to test it with other projects.
Publishing to our artifactory repo would not be feasible as faulty plugin versions might get picked up by others.
Steps to Reproduce
Your Environment
Gradle 6.0
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
Windows 10
Build scan URL:
The text was updated successfully, but these errors were encountered: