Adding parent project to artifact name

(Stewart Bryson) #1

I used to have the following Gradle project directory structure:

|— parent
| |— sub1
| |— sub2

The JAR names I produced are:


Too do this, I would have to customize the artifactId, which was fine. It all worked with no issues.

With the introduction of composite builds… the --include-build command line would not equate these library dependencies. So I had to change to the following (without customizing artifactId) to get composite builds to work:

|— parent
| |— parent-sub1
| |— parent-sub2

Removing all customizations, using default artifact naming standards, the composite build works now.

Am I missing a more granular feature somewhere for embedding the parent project name into the artifact, without having to actually manually adjust artifactId. Perhaps this is the point of archivesBaseName… but composite builds wouldn’t work with that either, according to the user guide.

Composite builds are a great feature, and changing the directory structure wasn’t a huge deal. Perhaps, as an incubating feature, it will address issues like archivesBaseName, etc.

I really just wanted to make sure I wasn’t missing something here.


(Chris Doré) #2

Instead of changing the project name in the sub project’s build.gradle, did you try changing it in settings.gradle? Something like (untested):

include 'sub1', 'sub2'
rootProject.children.each { subproj -> = "${}-${}"

(Stewart Bryson) #3

I hadn’t considered that Chris. Thanks. I’ll give it a try. Seems like a reasonable approach.