Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You mention that some of the components depend on each other, so I am also wondering why you would not want to implement this as a multi-project build. For now, let's assume all of your components are independent Gradle projects. Given that they produce a JAR file, it seems to be a given that they are Java projects. I'd create a <code>build.gradle</code> file for each project.</p> <pre><code>. └── your-project └── component1 │ ├── build.gradle │ └── src └── component2 ├── build.gradle └── src </code></pre> <p>For each of these projects, we will apply the Java plugin. The only difference to the standard conventions introduced by this plugin is that your source files sit in the directory <code>src</code> instead of <code>src/main/java</code>. To configure this, all you need to put into your <code>build.gradle</code> files is the following content:</p> <pre><code>apply plugin: 'java' sourceSets { main { java { srcDirs = ['src'] } } } </code></pre> <p>If you execute <code>gradle build</code> for any of your projects, Gradle will compile your production and test source code, run your unit tests and assemble the JAR file under the directory <code>build/libs</code>.</p> <p><strong>EDIT:</strong></p> <p>You can either implement this the way Matt explains in his comment or go for a multi-project build approach. I put together the following code examples to give you the idea. Create two files on the root level of your project: <code>build.gradle</code> and <code>settings.gradle</code>.</p> <pre><code>. └── your-project ├── build.gradle ├── settings.gradle ├── component1 │ └── src └── component2 └── src </code></pre> <p>In the <code>settings.gradle</code> file include the project that are part of your build like this:</p> <pre><code>include 'component1', 'component2' </code></pre> <p>Then in your <code>build.gradle</code> file you only need to define your project definition once by putting it into a <code>subprojects</code> configuration block. This means it applies to all subprojects of your build. With this approach you can define common behavior without having to repeat the code.</p> <pre><code>subprojects { apply plugin: 'java' sourceSets { main { java { srcDirs = ['src'] } } } } </code></pre>
 

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