[GRADLE-2308] gradle install and multi-module projects Created: 16/May/12  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-rc-3
Fix Version/s: None

Type: Bug
Reporter: Roger Kapsi Assignee: Unassigned
Resolution: Won't Fix Votes: 0


 Description   

I have a simple multi-module Java project with two modules. Let them be A and B and B depends on A.

// Parent gradle.build
allprojects {
  apply plugin: 'maven'
  
  sourceCompatibility = 1.6

  group = 'com.project'
  version = '0.1-SNAPSHOT'
}

dependencies {
  compile project(":module-a")
  compile project(":module-b")
}

// Module A's gradle.build
dependencies {
}

// Module B's gradle.build
dependencies {
  compile project(":module-a")
}

There are two different problems I'm seeing.

1) gradle install doesn't honor the dependency hierarchy and tries to build the B-Module first which fails because A doesn't exist yet.

2) gradle install doesn't know how to resolve the compile project(":module-a") dependency correctly. I've to declare the dependency with an explicit group name and version number like compile project("${group}:module-a:${version}") to make it work.

Could not resolve all dependencies for configuration ':module-b:compile'.
> Could not find group:, module:module-a, version:.
  Required by:
      com.project:module-b:0.1-SNAPSHOT


 Comments   
Comment by Szczepan Faber [ 18/May/12 ]

Are you sure the code snippets are complete? I don't see java plugin applied.

Comment by Roger Kapsi [ 18/May/12 ]

It is, here is the complete build.gradle

allprojects {
  apply plugin: 'java'
  apply plugin: 'maven'
  apply plugin: 'eclipse-wtp'
  apply plugin: 'eclipse'
  apply plugin: 'idea'

  sourceCompatibility = 1.6

  group = 'com.project'
  version = '0.1'

  repositories {
    mavenCentral()
    mavenLocal()
    
    maven {
      url "http://morphia.googlecode.com/svn/mavenrepo"
    }
  }

  configurations { 
    all*.exclude group: 'commons-logging', module: 'commons-logging'
  }
  
  project.ext {
    slf4j = "1.6.4"
    commonsio = "2.3"
    commonscodec = "1.6"
    commonslang = "2.6"
    junit = "4.10"
  }
}

dependencies {
  compile project(":module-a")
  compile project(":module-b")
}
Comment by Roger Kapsi [ 20/May/12 ]

The actual project can be found at https://github.com/rkapsi/gibson

Running gradle install at the root of the project will fail with:


gibson[master]/$ gradle install
:gibson-appender:compileJava

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not resolve all dependencies for configuration ':gibson-appender:compile'.
    > Could not find group:org.ardverk.gibson, module:gibson-core, version:0.1.
    Required by:
    org.ardverk.gibson:gibson-appender:0.1
  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 8.851 secs
gibson[master]/${noformat}

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 12:18:25 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.