nebula-plugins / gradle-dependency-lock-plugin

A plugin to allow people using dynamic dependency versions to lock them to specific versions.
Apache License 2.0
292 stars 42 forks source link

generateGlobalLock fails with nested projects #109

Closed bheisler closed 5 years ago

bheisler commented 8 years ago

I tried to upload a .zip file with an example project but GitHub doesn't like it so I'll have to describe it instead.

Suppose we have a project like so:

test
  -build.gradle
  -settings.gradle
  app
    -build.gradle
    app1
      -build.gradle
    app2
      -build.gradle

With contents:

test/build.gradle:

plugins {
    id "nebula.dependency-lock" version "4.3.0"
}

test/settings.gradle

include "app:app1"
include "app:app2"

test/app/build.gradle

subprojects {
    repositories {
        mavenCentral()
    }
}

test/app/app1/build.gradle & test/app/app2/build.gradle:

apply plugin: 'java'
dependencies {
    compile 'com.google.guava:guava:19.0'
}

Running generateGlobalLock in test/ produces the following error:

gradle generateGlobalLock
:generateGlobalLock FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':generateGlobalLock'.
> Could not resolve all dependencies for configuration 'detachedConfiguration1'.
   > Configuration with name 'default' not found.

This doesn't happen if I remove the "app:" bits in test/settings.gradle and set the projectDirs appropriately, but then the build script at test/app/build.gradle won't be run. In my actual build, I have code in the intermediate build.gradle file that can't be skipped.

I've tested this on Gradle 2.14 and 3.1 with no difference in observed behavior.

rspieldenner commented 7 years ago

Our plugin does not currently handle that project structure. The 2 structures we handle are:

1) singleproject, build.gradle, settings.gradle, src folder at root level of git repository 2) 1 level multiproject, top level has build.gradle, settings.gradle to setup 1..n subprojects myroot |_build.gradle |_settings.gradle |_common | |_src | _build.gradle _app |_src _build.gradle

We accept pull requests if you wish to handle a more complicated project structure.

On Tue, Oct 11, 2016 at 1:43 PM Redattack34 notifications@github.com wrote:

I tried to upload a .zip file with an example project but GitHub doesn't like it so I'll have to describe it instead.

Suppose we have a project like so:

test -build.gradle -settings.gradle app -build.gradle app1 -build.gradle app2 -build.gradle

With contents:

test/build.gradle:

plugins { id "nebula.dependency-lock" version "4.3.0" }

test/settings.gradle

include "app:app1" include "app:app2"

test/app/build.gradle

subprojects { repositories { mavenCentral() } }

test/app/app1/build.gradle & test/app/app2/build.gradle:

apply plugin: 'java' dependencies { compile 'com.google.guava:guava:19.0' }

Running generateGlobalLock in test/ produces the following error:

gradle generateGlobalLock :generateGlobalLock FAILED FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':generateGlobalLock'.

    Could not resolve all dependencies for configuration 'detachedConfiguration1'. Configuration with name 'default' not found.

This doesn't happen if I remove the "app:" bits in test/settings.gradle and set the projectDirs appropriately, but then the build script at test/app/build.gradle won't be run. In my actual build, I have code in the intermediate build.gradle file that can't be skipped.

I've tested this on Gradle 2.14 and 3.1 with no difference in observed behavior.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nebula-plugins/gradle-dependency-lock-plugin/issues/109, or mute the thread https://github.com/notifications/unsubscribe-auth/AAvvFuk_pqUbGDu6jDVq9xI6Qq4eSfSEks5qy_UIgaJpZM4KUFWd .

rpalcolea commented 5 years ago

Closing this as lack of activity and also with the fact that don't recommend global locks