Comments (19)
yep. same here. very frustrating
as "workaround" you can temporarily comment these local dependencies, then run plugin, then uncomment them back.
from gradle-versions-plugin.
same here, it seems to be with any local dependencies. As dsvoronin said, workaround of commenting them works though.
from gradle-versions-plugin.
same here, commenting them
from gradle-versions-plugin.
I have tried to write a test case for this but I can't get it to work. I have no experience with flat directory repositories. Can anyone provide some test code?
from gradle-versions-plugin.
The following works as a quick fix (for me at least). It looked like 'version' was coming out as an empty string rather than null so that's why the currentVersions[key] == version
doesn't work. It's probably better to make both of them null or empty strings.
Some more debugging info for @jochenberger if it helps, unfortunately I don't have a test case I can share with you as I'm using a flatDir repo that's provided by someone else and haven't tried to create my own.
Resolved latest dependencies: [:flatDirRepo:;default, ...
Dependency DefaultExternalModuleDependency{group='null', name='flatDirRepo', version='null', configuration='default'} does not use a dynamic version
Comparing current with latest dependencies. current: [null:flatDirRepo:null, ...
latest: [:flatDirRepo:, ...
Checking dependency :flatDirRepo null
diff --git a/src/main/groovy/com/github/benmanes/gradle/versions/updates/DependencyUpdates.groovy b/src/main/groovy/com/github/benmanes/gradle/versions/updates/DependencyUpdates.groovy
index 700c139..7b5b695 100644
--- a/src/main/groovy/com/github/benmanes/gradle/versions/updates/DependencyUpdates.groovy
+++ b/src/main/groovy/com/github/benmanes/gradle/versions/updates/DependencyUpdates.groovy
@@ -170,7 +170,7 @@ class DependencyUpdates {
Map<Integer, Map<Map<String, String>, String>> versionInfo = latestVersions.groupBy {
Map<String, String> key, version ->
project.logger.info('Checking dependency {}:{}', key.group, key.name)
- if (currentVersions[key] == version) {
+ if (currentVersions[key] == version || currentVersions[key] == null) {
0
} else {
(Math.signum(comparator.compare(version, currentVersions[key]))) as int
from gradle-versions-plugin.
I'd be grateful if someone could provide a test case that leads to the NPE.
from gradle-versions-plugin.
Here's a pretty simplified test case extracted from an app I'm working on. There are two sections in the build.gradle
file. The first one, using version 0.5-beta-1 doesn't throw the exception. The second one, using version 0.7 does.
https://www.dropbox.com/s/vr8xrzr739ng3ab/npe_example.tar.gz?dl=0
from gradle-versions-plugin.
Right, somehow the dependency ends up with different keys in the map with the current versions that in the map with latest versions:
$ ANDROID_HOME=/tmp gradle -i dU --stacktrace
...
Comparing current with latest dependencies. current: [null:viewpagerindicator-2.4.1:null, com.android.tools.build:gradle:1.0.1], latest: [:viewpagerindicator-2.4.1:, com.android.tools.build:gradle:1.0.1]
Checking dependency :viewpagerindicator-2.4.1
Then, the lookup fails. I guess the fix is easy, I'd still prefer a real test case though, as in Spock test case.
from gradle-versions-plugin.
I can think of multiple way to fix this. Either ignore file-based repositories altogether, report modules with null
versions unresolved or as up-to-date. @ben-manes, any thoughts?
from gradle-versions-plugin.
The problem with the Map lookup is that http://gradle.org/docs/current/javadoc/org/gradle/api/artifacts/ModuleVersionIdentifier.html#getGroup%28%29 seems to work differently as https://gradle.org/docs/current/javadoc/org/gradle/api/artifacts/Dependency.html#getGroup%28%29.
from gradle-versions-plugin.
I prefer listing it as unresolved rather than up-to-date. It highlights that we can't intelligently evaluate that dependency, as flatDir
may contain jars that really are out of date compared to Maven Central.
I think if we ignored file-based repositories that would cause the dependency to be unresolved in the report. Whether to explicit check or be indirect comes down to a personal preference of what appears cleaner and more obvious in the code. I like the assertion that we need a Spock test case no matter what happens.
from gradle-versions-plugin.
Any news? I have also this problem.
from gradle-versions-plugin.
Can you put together a sample project demonstrating this bug?
from gradle-versions-plugin.
@ben-manes Here's a link to the example again: https://www.dropbox.com/s/vr8xrzr739ng3ab/npe_example.tar.gz?dl=0
from gradle-versions-plugin.
Thanks, I'll take a look at this next week.
from gradle-versions-plugin.
The flatDir
repositories are now being ignored since they don't contain metadata. A partial declaration (like in the sample) is listed as unresolved and a full declaration may find updates on a remote repository.
This was the least invasive way to fix this. I'm not familiar with the code since the rewrites to add type safety and json/xml reporters, so this seemed like the best approach.
from gradle-versions-plugin.
any eta for an release of this fix?
from gradle-versions-plugin.
I'll take a look at integrating #59 tonight, which may be a better fix than mine. I'll also try to add a unit test to see if I can validate that.
@jochenberger has been handling the releases from his Bintray account, so we'll see if he has some time this week to kick one off.
from gradle-versions-plugin.
Thank you for your feedback! :)
from gradle-versions-plugin.
Related Issues (20)
- Different result for CI/CD pipeline and local HOT 9
- Versions past 0.44.0 generate useless output in some repos HOT 21
- Dependency formatting output, new lines included? HOT 12
- Latest version of org.jetbrains.kotlin dependencies are not being found HOT 2
- Support for ignoring deliberately lagging dependencies HOT 5
- Sign plugin artifacts HOT 1
- Question: Display max minor and max overall versions? HOT 7
- Failed to determine the latest version for the following dependencies with Kotlin 2.0.0 HOT 3
- Report has differences when nothing changes HOT 6
- unable to discover latest version of google guava HOT 1
- outputFormatter setting has no effect - json, xml & txt report always generated HOT 2
- Plugin is downgrading versions HOT 1
- Legacy configurations should be skipped HOT 3
- Add Kotlin-DSL initscript example HOT 1
- Change JDK 8-provider HOT 1
- Considerations for gradle/community hub HOT 3
- Not working anymore, deprecated? HOT 1
- Deprecation warnings for some classpaths HOT 1
- Can't check updates on gradle 8.4+ because of unchecked SAXNotRecognizedException HOT 2
- Exception in IntelliJ 2024.1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gradle-versions-plugin.