gradle-dependency-lock-plugin icon indicating copy to clipboard operation
gradle-dependency-lock-plugin copied to clipboard

"Gradlew -PdependencyLock.useGeneratedGlobalLock=true build" fails with exception

Open mkornipati opened this issue 9 years ago • 2 comments

I am looking for available options for dependency locking and came across this today and looks interesting. I am playing around with this and got into below issue. We got many multiprojects and I applied this plugin to one of my projects on root level and then just tried below steps.

1. gradlew generateGlobalLock

Can see it generated "build\global.lock" with all dependencies I got with locked version.

2. gradlew -PdependencyLock.useGeneratedGlobalLock=true build

failing with below error

Caused by: java.lang.NullPointerException: Cannot get property 'path' on null object
        at nebula.plugin.dependencylock.DependencyLockPlugin.apply(DependencyLockPlugin.groovy:83)
        at nebula.plugin.dependencylock.DependencyLockPlugin.apply(DependencyLockPlugin.groovy)
        at org.gradle.api.internal.plugins.ImperativeOnlyPluginApplicator.applyImperative(ImperativeOnlyPluginApplicator.java:35)
        at org.gradle.api.internal.plugins.RuleBasedPluginApplicator.applyImperative(RuleBasedPluginApplicator.java:43)
        at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:144)
        ... 61 more

I also tried the same command after "saveGlobalLock" and still the same issue. I am going through the code to understand this better and came across this area of code which seems to be causing it.

if I understand this better, we are creating the "generateGlobalLock" task and then trying to get "getDependenciesLock().path". not sure, if this path will be available. As it looks like this is going to be null?

Please let me know if I am missing anything here.

mkornipati avatar Jan 08 '16 22:01 mkornipati

if you save the lock you don't need to -PdependencyLock.useGeneratedGlobalLock=true by default we look in the project directory, the useGenerated flags tell us to look in the build directory

rspieldenner avatar Aug 31 '16 17:08 rspieldenner

The fix is provided in this PR: https://github.com/nebula-plugins/gradle-dependency-lock-plugin/pull/113

jotel avatar Jan 24 '17 22:01 jotel