Note that there are some explanatory texts on larger screens.

plurals
  1. POGradle Multi-Module Project Setup
    text
    copied!<p>I've recently started using Gradle and replacing my existing Maven-based projects. I have had many issues in the past with handling multi-module builds with Maven. Gradle has been a breath of fresh air when handling multi-module buils, but it's not perfect yet.</p> <p>I have the following folder layout for my projects:</p> <pre><code>-- Projects ---- EnterpriseApp1 ------ EarProject -------- build.gradle ------ EjbProject -------- build.gradle ------ WarProject -------- build.gradle ------ properties.gradle ------ build.gradle ---- CommonLib ------ build.gradle ---- ClientApplication ------ build.gradle </code></pre> <p>The problem I am having is that the "EnterpriseApp1" and "ClientApplication" both depend on the CommonLib project. I don't know how to configure my "EnterpriseApp1" build file to use the CommonLib project as dependency for the "EjbProject". I have come very close to getting this to work, but not quite working yet. I have had success by copying the CommonLib folder inside "EnterpriseApp1", but that's not a long term solution.</p> <p>Here's my current properties.gradle file in "EnterpriseApp1":</p> <pre><code>include "EarProject", "EjbProject", "WarProject" includeFlat "CommonLib" </code></pre> <p>According to the Gradle documentation the "includeFlat" command in the "settings.gradle" file will include projects in the same lever as the folder where the "settings.gradle" file is (desired behavior). </p> <p>EnterpriseApp1/build.gradle file:</p> <pre><code>subprojects { apply plugin: 'java' sourceCompatibility = 1.6 group = 'org.example' version = '1.0-SNAPSHOT' repositories { mavenCentral() ... } dependencies { } } </code></pre> <p>EnterpriseApp1/EjbProject/build.gradle:</p> <pre><code>apply plugin: 'java' sourceCompatibility = 1.6 repositories { mavenCentral() ... } dependencies { compile project(':CommonLib') compile group: 'org.restlet.jee', name: 'org.restlet', version: '2.0.11' compile group: 'ma.glasnost.orika', name: 'orika-core', version: '1.0' ... compile group: 'javax.jmdns', name: 'jmdns', version: '3.4.1' } </code></pre> <p>When I execute "gradle clean build" from the EnterpriseApp1 folder all the dependencies are downloaded as expected and the projects begin to compile (including the CommonLib project), but the EjbProject project fails during the build due to the fact it's missing the CommonLib jar reference. Gradle is not smart enough (or I'm completely clueless ;)) to configure my EjbProject to use the Jar generated from the CommonLib project build stage.</p> <p>I apologize for the long and complicated setup. I have been working on trying to figure this out for some time now, but have nearly ran out of ideas. I would really appreciate any help for the community.</p> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload