GithubHelp home page GithubHelp logo

cbm64chris / client-maven-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gluonhq/gluonfx-maven-plugin

0.0 0.0 0.0 280 KB

Plugin that simplifies using Gluon Client for Java/JavaFX maven projects

License: BSD 3-Clause "New" or "Revised" License

Java 94.07% Shell 5.93%

client-maven-plugin's Introduction

Gluon Client plugin for Maven

The Gluon Client plugin for maven projects leverages GraalVM, OpenJDK and JavaFX 11+, by compiling into native code the Java Client application and all its required dependencies, so it can directly be executed as a native application on the target platform.

Maven Central Travis CI BSD-3 license

Requirements

Mac OS X and iOS

  • Download the latest development version of GraalVM: https://github.com/graalvm/graalvm-ce-dev-builds/releases by choosing graalvm-ce-java11-darwin-amd64-20.2.0-dev.tar.gz from the list of assets and unpack it to a preferred location on your system (e.g. in /opt)

  • Configure the runtime environment. Set GRAALVM_HOME environment variable to the GraalVM installation directory.

    For example:

    export GRAALVM_HOME=/opt/graalvm-ce-java11-20.2.0-dev
    
  • Set JAVA_HOME to point to the GraalVM installation directory:

    export JAVA_HOME=$GRAALVM_HOME
    

Additional requirements

  • iOS can be built only on Mac OS X

  • Install Homebrew, if you haven't already. Please refer to https://brew.sh/ for more information.

  • Install libusbmuxd

    Using brew:

    brew install --HEAD libusbmuxd
    
  • Install libimobiledevice

    Using brew:

    brew install --HEAD libimobiledevice
    

Linux and Android

  • Download the latest development version of GraalVM: https://github.com/graalvm/graalvm-ce-dev-builds/releases by choosing graalvm-ce-java11-linux-amd64-20.2.0-dev.tar.gz from the list of assets and unpack it to a preferred location on your system (e.g. in /opt)

  • Configure the runtime environment. Set GRAALVM_HOME environment variable to the GraalVM installation directory.

    For example:

    export GRAALVM_HOME=/opt/graalvm-ce-java11-20.2.0-dev
    
  • Set JAVA_HOME to point to the GraalVM installation directory:

    export JAVA_HOME=$GRAALVM_HOME
    

Additional requirements

  • Android can be built only on Linux OS

The client plugin will download the Android SDK and install the required packages.

Alternatively, you can define a custom location to the Android SDK by setting the ANDROID_SDK environment variable, making sure that you have installed all the packages from the following list:

  • platforms;android-28
  • platform-tools
  • build-tools;29.0.2
  • extras;android;m2repository
  • extras;google;m2repository
  • ndk-bundle (in case you opt to skip this bundle and download Android NDK package separately, set the ANDROID_NDK environment variable to its location)

Windows

  • Download the latest development version of GraalVM: https://github.com/graalvm/graalvm-ce-dev-builds/releases by choosing graalvm-ce-java11-windows-amd64-20.2.0-dev.zip from the list of assets and unzip it to a preferred location on your system.

  • Make sure you have installed Visual Studio 2019 with the following components:

    • Choose the English Language Pack
    • C++/CLI support for v142 build tools (14.25 or later)
    • MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.25 or later)
    • Windows Universal CRT SDK
    • Windows 10 SDK (10.0.19041.0 or later)
  • Run the maven commands mentioned below in a x64 Native Tools Command Prompt for VS 2019. This command prompt can be accessed from the start menu.

  • Configure the runtime environment. Set GRAALVM_HOME environment variable to the GraalVM installation directory.

    For example:

    set GRAALVM_HOME=C:\tools\graalvm-ce-java11-20.2.0-dev
    

    Install native-image by running:

    %GRAALVM_HOME%\bin\gu install native-image
    
  • Set JAVA_HOME to point to the GraalVM installation directory:

    set JAVA_HOME=%GRAALVM_HOME%
    

Getting started

To use the plugin, apply the following steps:

1. Apply the plugin

Edit your pom file and add the plugin:

<plugin>
    <groupId>com.gluonhq</groupId>
    <artifactId>client-maven-plugin</artifactId>
    <version>0.1.26</version>
    <configuration>
        <mainClass>your.mainClass</mainClass>
    </configuration>
</plugin>

The plugin allows some options that can be set in configuration, to modify the default settings, and several goals, to build and run the native application.

2. Goals

Desktop

The following goals apply to Linux, Mac OS X and Windows.

To build the native image:

mvn clean client:build

To run the native image:

mvn client:run

or simply run the native executable found in target/client.

iOS

Set the target to ios (for iOS devices) in the pom.xml:

<artifactId>client-maven-plugin</artifactId>
<configuration>
    <target>ios</target>
    <mainClass>${mainClassName}</mainClass>
</configuration>

Build the native image:

mvn clean client:build

Note: Since all java bytecode is translated to native code, the compilation step can take a long time, and it requires a fair amount of memory.

Run the app on the connected iOS device:

mvn client:run

Or package and create an IPA file to submit to TestFlight or to the App Store:

mvn client:package

Note: In order to deploy apps to an iOS device, you need a valid iOS provisioning profile, as explained in the documentation.

Android

Set the target to android (for android devices) in pom.xml:

<artifactId>client-maven-plugin</artifactId>
<configuration>
    <target>android</target>
    <mainClass>${mainClassName}</mainClass>
</configuration>

Build the native image:

mvn clean client:build

Note: Since all java bytecode is translated to native code, the compilation step can take a long time, and it requires a fair amount of memory.

Package and create an APK file:

mvn client:package

Install the APK file on a connected Android device:

mvn client:install

Run the installed app on the connected Android device:

mvn client:run

Documentation and samples

Check the documentation for more details about the plugin and running the maven samples.

Issues and Contributions

Issues can be reported to the Issue tracker

Contributions can be submitted via Pull requests, providing you have signed the Gluon Individual Contributor License Agreement (CLA) (See What is a CLA and why do I care in case of doubt).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.