I have a multi-module setup for a Java project with following structure.
mainApp
|--> core-module
| |--> src
| |--> build.gradle
| |--> gradle.properties
|
|--> lib-module
| |--> src
| |--> build.gradle
| |--> gradle.properties
|--> settings.gradle
|--> build.gradle
Content of mainApp/settings.gradle
rootProject.name = 'mainApp'
include 'core-module', 'lib-module'
Intention is to generate core-module.jar
and lib-module.jar
; however, the core-module
should contain the all the classes from lib-module
. Basically copy the classes from lib-module
subproject in the jar
task of core-module
. I tried following (in the build.gradle
) of core-module
, but it didn’t work
jar {
manifest {
attributes 'Manifest-Version': '0.1',
'Implementation-Title': 'Core Module',
}
from project(path: ':lib-module') {
include 'com/demo/lib/**'
}
}
I got following exception
* What went wrong:
Cannot convert the provided notation to a File or URI: project ':lib-module'.
The following types/formats are supported:
- A String or CharSequence path, for example 'src/main/java' or '/usr/include'.
- A String or CharSequence URI, for example 'file:/usr/include'.
- A File instance.
- A Path instance.
- A Directory instance.
- A RegularFile instance.
- A URI or URL instance.
Can someone help what’s the best way to achieve this?