Giter Site home page Giter Site logo

Comments (19)

dsvoronin avatar dsvoronin commented on May 20, 2024

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.

olliefreeman avatar olliefreeman commented on May 20, 2024

same here, it seems to be with any local dependencies. As dsvoronin said, workaround of commenting them works though.

from gradle-versions-plugin.

meoyawn avatar meoyawn commented on May 20, 2024

same here, commenting them

from gradle-versions-plugin.

jochenberger avatar jochenberger commented on May 20, 2024

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.

 avatar commented on May 20, 2024

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.

jochenberger avatar jochenberger commented on May 20, 2024

I'd be grateful if someone could provide a test case that leads to the NPE.

from gradle-versions-plugin.

scompt avatar scompt commented on May 20, 2024

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.

jochenberger avatar jochenberger commented on May 20, 2024

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.

jochenberger avatar jochenberger commented on May 20, 2024

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.

jochenberger avatar jochenberger commented on May 20, 2024

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.

ben-manes avatar ben-manes commented on May 20, 2024

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.

Rainer-Lang avatar Rainer-Lang commented on May 20, 2024

Any news? I have also this problem.

from gradle-versions-plugin.

ben-manes avatar ben-manes commented on May 20, 2024

Can you put together a sample project demonstrating this bug?

from gradle-versions-plugin.

scompt avatar scompt commented on May 20, 2024

@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.

ben-manes avatar ben-manes commented on May 20, 2024

Thanks, I'll take a look at this next week.

from gradle-versions-plugin.

ben-manes avatar ben-manes commented on May 20, 2024

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.

dodgex avatar dodgex commented on May 20, 2024

any eta for an release of this fix?

from gradle-versions-plugin.

ben-manes avatar ben-manes commented on May 20, 2024

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.

dodgex avatar dodgex commented on May 20, 2024

Thank you for your feedback! :)

from gradle-versions-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.