Skip to content

aochoae/java-multi-project

Repository files navigation

Multi-project Builds with Gradle

Requirements

  • Java 8
  • Gradle

Documentation

Project

Viewing the structure of a multi-project build

./gradlew -q projects

...

Root project 'java-multi-project'
+--- Project ':application'
\--- Project ':library'

Executing the main application

./gradlew application:run

...

> Task :application:run
The sum of first 5 natural numbers is 15.
The sum of first 5 even natural numbers is 30.

Building and Testing

Build a simple jar file

A simple jar file doesn't include the dependencies.

./gradlew application:build

The library-1.0.0.jar file should be in the same directory.

java -jar application-1.0.0.jar

Build a uber jar file

A uber jar includes the dependencies.

./gradlew application:uberJar

You just need to run the next command

java -jar application-1.0.0-uber.jar

The output for both jar files should be

The sum of first 5 natural numbers is 15.
The sum of first 5 even natural numbers is 30.

About

Multi-Project Builds with Gradle

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages