com.github.segator:jbinary-maven-plugin

This plugin allow you to generate a executable file with your application + jre embeded, you can deliver your application as a single file without need to install java

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

com.github.segator
ArtifactId

ArtifactId

jbinary-maven-plugin
Last Version

Last Version

1.0.10
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

com.github.segator:jbinary-maven-plugin
This plugin allow you to generate a executable file with your application + jre embeded, you can deliver your application as a single file without need to install java
Project URL

Project URL

https://github.com/segator/jbinary-maven-plugin
Source Code Management

Source Code Management

http://github.com/segator/jbinary-maven-plugin/tree/master

Download jbinary-maven-plugin

How to add to project

<plugin>
    <groupId>com.github.segator</groupId>
    <artifactId>jbinary-maven-plugin</artifactId>
    <version>1.0.10</version>
</plugin>

Dependencies

compile (6)

Group / Artifact Type Version
org.apache.maven : maven-plugin-api jar 3.0
org.apache.maven : maven-core jar 3.0
org.apache.maven : maven-archiver jar 2.5
org.apache.commons : commons-lang3 jar 3.4
org.apache.commons : commons-exec jar 1.3
commons-io : commons-io jar 2.5

provided (1)

Group / Artifact Type Version
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.4

Project Modules

There are no modules declared in this project.

jbinary-maven-plugin

JBinary Maven plugin, do you want to generate a binary with non dependencies of any java application using maven? this is your tool

Maven Central CircleCI branch

<plugin>
    <groupId>com.github.segator</groupId>
    <artifactId>jbinary-maven-plugin</artifactId>
    <version>1.0.8</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>jbinary</goal>
            </goals>
            <configuration>
                <jreVersion>1.8.0_131</jreVersion> <!-- Jre version to compile in the executable embeded file-->
                <jBinaryJavaDownload>http://mycustomrepository.com/{javaType}/{javaVersion}/{javaType}-{javaVersion}-{platform}{architecture}.tgz</jBinaryJavaDownload>
                <!--If you have your own jre, you can set the url, (the tar.gz file must jave a folder /java inside and jre content inside -->
                <useMavenRepositoryJavaDownload>true</useMavenRepositoryJavaDownload>
                <!-- if you have your own repository, expected groupid com.oracle.java, artifact jre|jdk by default is downloaded from here https://artifacts.alfresco.com/nexus
                This param is skiped if you use jBinaryJavaDownload -->
                <jBinaryURLWindows>https://github.com/segator/jbinary/releases/download/%s/windows_amd64_jbinary_%s.exe</jBinaryURLWindows>
                <jBinaryURLLinux>https://github.com/segator/jbinary/releases/download/%s/linux_amd64_jbinary_%s</jBinaryURLLinux> 
                <!--Custom JBinary Download URL, %s is replaced by the Jbinary Version -->
                <jreVersion>1.8.0_131</jreVersion> <!-- Java version will be embeded to generated executable -->
                <mavenInstallArtifact>true</mavenInstallArtifact> <!-- If true, generated artifacts will be installed to maven local repository and 
                selectable for other maven plugins, like maven-release-plugin -->
                <compressBinary>true</compressBinary> <!-- Compress = less binary size, uncompress faster boot-->
                <jvmArguments>-Xms512M;-Xmx1024M</jvmArguments> <!-- Static JVM Arguments you want to be used by generated binary -->
                <appArguments>--verbose</appArguments> <!-- Static Applicaiton arguments you want to be used by generated binary -->
                <!-- Next arguments only apply on windows builds, it defines executable metadata -->
                <winCompany>My Company<winCompany>
                <winCopyright> Copyright 2018</winCopyright>
                <winDescription>Application Description</winDescription>
                <!-- Default behaviour to run app, in gui mode no console is shown but you can't execute by console or capture stdout, (console|gui) default(console) -->
                <winExecutionBehaviour>console</winExecutionBehaviour>
                <!-- Arguments that will force console mode in case of default behaviour gui, default (-console;-terminal) -->
                <winExecutionEnableConsoleBehaviourArgs>-console</winExecutionEnableConsoleBehaviourArgs>
                <!-- Relative path to application icon -->
                <winIconPath>myapplication.ico</winIconPath>
                <!--Windows Invoker type  asInvoker|requireAdministrator default(asInvoker) -->
                <winInvoker>requireAdministrator</winInvoker>                
                <winProductName>My Product Name</winProductName>
            </configuration>
        </execution>
    </executions>
</plugin>

Prerequisites

You must have installed golang 1.10.x or supperior set in the system vars $GOPATH $GOSRC $GOBIN and add in your $PATH the $GOBIN path

Create tiny binary files

You could try the new cool system of java modules in java9 to create a very tiny jre To create a tiny java9 module you can use jlink(installed by default on a JDK installation)

jlink --module-path $JAVA_HOME/jmods --verbose --compress 2 --no-man-pages --no-header-files --output  "$HOME/myjre/java" --add-modules java.base,java.rmi,java.xml,java.desktop,java.sql
tar -czvf my-custom-tiny-jre.tar.gz "$HOME/myjre/java"

After create the tar.gz upload to a web server or mvn repository and use in your mvn pom jBinaryJavaDownload in case of web server or useMavenRepositoryJavaDownload in case of mvn repository

Application slow to boot

Play disabling compression, could help or think about use java9 modules

Versions

Version
1.0.10
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
1.0.0-RC1
0.0.1