This sample demonstrates a multi-project build with Eclipse support. It includes multiple layers of modules that depend on each other and a simple Swing UI for a thick client application.
common– basic utilities shared across the repolibrary– library logic depending oncommondata– data access usingcommons-ioandcommons-lang3service– service layer combiningdataandlibraryui– Swing user interface depending onserviceapp– runnable entry point assembling everything
gradle build eclipseImport the project into Eclipse via Buildship after running the eclipse task.
If you prefer to use the Gradle wrapper, first run gradle wrapper to
generate the wrapper JAR files.
A simple Dockerfile is provided to run the app in a container:
docker build -t cookbook-app .
docker run --rm cookbook-appScripts under scripts/ illustrate how you might package the application
with install4j for Windows. Example:
./scripts/package-install4j.sh- Run
./gradlew eclipseand import the project via File ▸ Import ▸ Existing Gradle Project. - In Preferences ▸ Gradle ▸ Synchronization enable Synchronize automatically after builds.
- Launch the
apprun configuration from the Gradle Tasks view. While it runs under the debugger, editing a method signature inlibraryand saving will trigger HotswapAgent to reload the class. - For instant recompiles run
./gradlew -t classesin the background so Eclipse picks up new class files immediately.
The book/ directory contains the structure for the Gradle Cookbook. Each chapter includes an outline and a Jupyter notebook so you can experiment with the code.