Skip to content

Plugin for producing Capsule jar out of details gathered from Gradle build script

License

Notifications You must be signed in to change notification settings

jonas-l/gradle-capsule-plugin

Repository files navigation

Capsule plugin for Gradle

Produces a Capsule jar matching java project's configuration.

A capsule is a single executable JAR that contains everything your application needs to run either in the form of embedded files or as declarative metadata.

Getting started

First, you have to declare the plugin at the top of your build script:

plugins {
  id 'com.jonaslasauskas.capsule'
}

It requires a repository to download Capsule base artifact. Declare mavenCentral(), jcenter(), or any other repository which contains co.paralleluniverse:capsule:*. For now let's use jcenter():

repositories {
  jcenter()
}

This plugin implicitly applies Java plugin and introduces a capsule task which will be executed on assemble.

capsule task will try to resolve any necessary properties, but in case they are not available you should declare them manually:

capsule {
  capsuleManifest {
    applicationId = 'your.application.id'
    applicationClass = 'your.package.MainApplicationClass'
  }
}

Here

applicationId: a unique name which usually follows Java's package naming convention (for more information see The Capsule ID section).

applicationClass: fully qualified name of the main class.

Furthermore, capsule extends from jar task which means it supports all jar properties and methods.

You are now ready to put your project into capsule:

$ ./gradlew assemble

If everything went well you will find a Capsule jar located in build/libs/. The new jar has capsule classifier. So if your project is named test, you will find build/libs/test-capsule.jar file which is an executable Capsule:

$ java -jar build/libs/test-capsule.jar

Contributing

Gradle Capsule Plugin is hosted on GitLab but there's a mirrored project repository on GitHub where contributions can be submitted as well.

Furthermore, there are a few guidelines which can be found in contributing guide.

About

Plugin for producing Capsule jar out of details gathered from Gradle build script

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages