-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Strange behavior of BOM handling #4765
Comments
@gradle/dependency-management can anyone take a look at this? |
The difference is that he second BOM has |
Thanks for reporting this. TL/DR: we're going to ignore the scope of dependency management blocks when using BOMs. So here is what happens. When a library author uses:
It's actually not specified in Maven what this means. However, when you see a
then it's added with scope Under the hood, this is a modeling problem: at the same coordinates, live 2 different components. One is the library, for which, when it's built, the scope matters (but only when it is itself built), and the platform, for which the scope doesn't have any meaning, because all we want is suggestions. So by ignoring the scope when importing BOMs, we will effectively make it work the way you expect it to. |
Thank you for good news. I'm actually seeing some strange behavior on other places in the BOM handling, which are more complicated (I guess). It might be fixed by this change, so I'm awaiting a nightly build that contains this change, to test it on our project to see if everything is fixed. |
I've tried current master with the test project, and the behavior is the same - jpamodelgen dependency is not resolved: |
The scope of each dependency management entry is cached.
My bad. This is a caching issue I missed: the scope of the dependency management entries is cached. We need to invalidate the metadata in the dependencies cache. Thank you very much for testing @sebek64. The fix is on master. Feel free to try again. |
Yes, now it's working fine. Thank you very much for quick resolution of this issue. |
This version is now used as this entry in the log4j BOM considered: <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>${logbackVersion}</version> <scope>test</scope> </dependency> 'scope=test' is ignored since this is a BOM gradle/gradle#4765
I'm seeing a strange behavior of the new BOM feature, where the dependency version is not resolved, but provided by the BOM.
Expected Behavior
Both configurations should work.
Current Behavior
The first configuration works, the second doesn't.
Context
I'm trying to upgrade BOM to newer version.
Steps to Reproduce (for bugs)
Create an empty project with enableFeaturePreview('IMPROVED_POM_SUPPORT'). Create a build script:
gradle dependencies shows all dependencies to be resolved. Then, replace the first dependency with
Now, hibernate-jpamodelgen is not resolved. Both pom.xmls are very similar:
http://central.maven.org/maven2/org/wildfly/bom/wildfly-javaee7/10.1.0.Final/wildfly-javaee7-10.1.0.Final.pom
http://central.maven.org/maven2/org/wildfly/bom/wildfly/12.0.0.Final/wildfly-12.0.0.Final.pom
Your Environment
Gradle 4.6 (wrapper), openjdk 8, linux.
https://gradle.com/s/45n47rrniq4k2
https://gradle.com/s/43sarrjttitze
The text was updated successfully, but these errors were encountered: