Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8180827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:19:19+00:00 2026-06-07T00:19:19+00:00

When applying a multi-project Gradle structure to our project, my settings.gradle looks like this:

  • 0

When applying a multi-project Gradle structure to our project, my settings.gradle looks like this:

include "source:compA:api"
include "source:compA:core"
include "source:compB"

gradle projects give me

Root project 'tmp'
\--- Project ':source'
     +--- Project ':source:compA'
     |    +--- Project ':source:compA:api'
     |    \--- Project ':source:compA:core'
     \--- Project ':source:compB'

This is exactly the directory structure!
In my root directory I have a build.gradle which applies the java plugin to all subprojects:

subprojects {
    apply plugin: 'java'
}

When building I end up having artifacts for :source:compA which are empty because this is actually not a project just the subdirectories api and core are proper Java projects.

What’s the best way to avoid having an empty artifact?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:19:21+00:00Added an answer on June 7, 2026 at 12:19 am

    You can try using the trick they use in Gradle’s own settings.gradle file. Note how each of the sub projects are located in the 'subprojects/${projectName}' folder, but the subprojects folder itself is not a project.

    So in your case you’d do something like:

    include "source:compA-api"
    include "source:compA-core"
    include "source:compB"
    
    project(':source:compA-api').projectDir = new File(settingsDir, 'source/compA/api')
    project(':source:compA-core').projectDir = new File(settingsDir, 'source/compA/core')
    

    I have intentionally omitted the colon between compA and api to make sure source:compA does not get evaluated as a project container.

    Alternatively, you can try excluding the source:compA project from having the java plugin applied to it, by doing something like:

    def javaProjects() { 
      return subprojects.findAll { it.name != 'compA' }
    } 
    
    configure(javaProjects()) { 
      apply plugin: 'java' 
    } 
    

    Edit:
    Alternatively you can try something like this (adjust to your liking):

    def javaProjects() { 
      return subprojects.findAll { new File(it.projectDir, "src").exists() }
    } 
    
    configure(javaProjects()) { 
      apply plugin: 'java' 
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am interested in applying dependency injection to my current project, which makes use
I am applying Animation Drawable with some smoke like animation. It works properly everywhere
I'm applying a blur effect to an image in WPF like so: <Image ClipToBounds=True>
I'm having trouble applying a patch to my source tree, and it's not the
I'm applying this css class: .turn90{ -moz-transform: rotate(90deg); /* FF3.5+ */ -o-transform: rotate(90deg); /*
When applying this pattern Delegation Event Model, is it correct to put ALL the
I thought of applying Dependency Injection and use Unity in the Project I am
When applying multi-file diff from CC, Eclipse recognizes only the first file from the
I'm applying the Factory design pattern in my C++ project, and below you can
I've been applying has and belongs to many style associations to a project I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.