-
Notifications
You must be signed in to change notification settings - Fork 4
Gradle, Build, Run
RunWAR is build and packaged using Gradle.
This section is created to clarify a bit on how runwar is build using the ./gradlew script on Unix or gradle.bat on Microsoft Windows from the CLI.
The execution of building tasks is automatic.
Gradle is an open source automatization system, that allows to build incrementally, performing tasks using a building tree. Gradle replaces the use of XML based build script(used in Maven), and it uses an internal DSL (Domain-specific language) that is based on Groovy,
One of the basic of gradle are tasks, there are some things to be done in order to build the project.
On RunWAR we have a few of them on the following files:
build.gradle
dependencies.gradle
config.gradle
proguard.gradle
version.gradle
Before we start, we need to get some the dependencies, so, the tasks from dependencies.gradle
are called, this step install the next dependecies:
task dorkboxUberJar(type: ShadowJar)
this task install the dependency dorkbox
, which is used to control the system tray, and create the server menu when runwar launch the application server.
task jbossJspJar(type: ShadowJar)
this task install the dependency jboss-jsp-api
, which add support for jsp and servlet
If you are trying to build (using the build
task) there probably will be an error.
RunWAR has a secondary to perform a digital signature when the JAR is builded, and if your environment is not configure with a valid GPG Key,
you will see the following message:
* What went wrong:
Execution failed for task ':signArchives'.
> Unable to read secret key from file: YOUR_PATH (it may not be a PGP secret key ring)
or
* What went wrong:
Execution failed for task ':signArchives'.
> path may not be null or empty string. path=''
you need to provide a valid key in order to sign the JAR,
If you are building RunWAR on a linux/unix environment, and your system do not have Java previously configured, you need to be sure, you are using the JDK 1.8 or higher, otherwise
the build process will call a script called grade/jvm-setup.sh
, that will automatically download a proper java virtual machine.
Make sure you have set the $JAVA_HOME
environment variable, also you can define a custom $JVM_JAVA_HOME
.
If $JVM_JAVA_HOME
is specified it will override $JAVA_HOME
and Java will not automatically be installed.
After successfully build RunWAR, by executing ./gradle
or gradle.bat
you have a JAR file on dist/libs/runwar-${version}.jar
Usage:
RunWAR can be executed from the command line like so. This will give you all the available options:
$> java -jar runwar-${version}.jar -war "path/to/war"
To start a quick server, it would look like this:
$> java -jar runwar.jar -war "path/to/war" --background false
or
$> java -jar runwar.jar -war "path/to/war" --port 8787 --dirs "virtualdir=/path/to/dir,virtualdir2=/path/to/dir2" --background false