Hello I am new to gradle and it is a little bit confusing for me. How should I add a dependency in my gradle configuration to have access to B1.java in projectA1? Project B is gradle project and project A is just a folder with another gradle projects.
Here is my structure:
I tried to read gradle documentation, but it is not clear for me. Any help appreciated. Thanks!
To assign dependencies to projectsOn the Project menu, choose Project Dependencies. The Project Dependencies dialog box opens. On the Dependencies tab, select a project from the Project drop-down menu. In the Depends on field, select the check box of any other project that must build before this project does.
You should have a structure like this:
ProjectA
|--projectA1
|----build.gradle
|--projectA2
|----build.gradle
|--settings.gradle
|--build.gradle
ProjectB
|--projectB1
|----build.gradle
|--projectB2
|----build.gradle
|--settings.gradle
|--build.gradle
You can link an external module in your project.
1) In your project projectA/settings.gradle
include ':projectA1',':projectA2',':projectB1'
project(':projectB1').projectDir = new File("/workspace/projectB/projectB1")
2) Add dependency in build.gradle
of projectA1
module
dependencies {
compile project(':projectB1')
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With