All Downloads are FREE. Search and download functionalities are using the official Maven repository.

archetype-resources.README.md Maven / Gradle / Ivy

Go to download

A minimum REFCODES.ORG enabled C2 (Command + Control) RESTful server teaming up with itself as client application. Get inspired by "https://bitbucket.org/funcodez".

The newest version!
# README #

Welcome to your [`REFCODES.ORG`](http://www.refcodes.org/refcodes) `archetype` based ` artifact`. This archetype has been generated by invoking the following command:

```
mvn archetype:generate \-DarchetypeGroupId=org.refcodes \
  -DarchetypeArtifactId=refcodes-archetype-alt-c2 \
  -DarchetypeVersion=${projectVersion} \
  -DgroupId=${groupId} \
  -DartifactId=${artifactId} \
  -Dversion=${version}
```

> Feel free to replace this `REDAME.md` file with some file of your own after having considered the below paragraphs.

#[[###]]# Getting started #[[###]]#

To get up and running, you use this archetype together with [`Maven`](https://maven.apache.org). Just change into the newly created folder and invoke `mvn` to build your new application:

```
cd ${artifactId}
mvn clean install
```

This will package your application into a [`fatjar`](https://stackoverflow.com/questions/19150811/what-is-a-fat-jar) which can be executed:

```
java -jar ./target/${artifactId}-${version}.jar --help
```

When running a shell such as [`bash`](https://en.wikipedia.org/wiki/Bash_(Unix_shell)) then first (and once only) make sure the shell scripts are executable by changing the according file attributes and then invoke the `build.sh` script, so finally you can launch your application from inside the `target` folder:

```
chmod ug+x *.sh
```

Using the `build.sh` script will create a self-contained executable shell script by automatically invoking the `scriptify.sh` script after a successful build (see further down below for more information on the `scriptify.sh` script).
In addition the `build.sh` script also will create self-contained binary executables by automatically invoking the `jexefy.sh` script, also after a successful build (see further down below for more information on the `jexefy.sh` script). 

> The `build.sh` script will finish off by printing out the actual paths and the names of the created executables.

```
./build.sh
./target/${artifactId}-launcher.sh --help
./target/${artifactId}-launcher-x86_64-x.y.z.exe --help
./target/${artifactId}-launcher-x86_64-x.y.z.elf --help
```

> In case your Artifact-ID `${artifactId}` contains a slash ("-"), then just the portion after the slash is used for your executable binary shell script's name.

#[[###]]# Self contained executables #[[###]]#

To build self-contained single binary applications for Linux and Windows, go as follows:

```
./bundle.sh
./target/${artifactId}-bundle-x.y.z.elf --help
```

> In case your Artifact-ID `${artifactId}` contains a slash ("-"), then just the portion after the slash is used for your executable binary's name.

On Windows, execute the file `${artifactId}-bundle-x.y.z.exe` located in the `target` folder accordingly!

> The self-contained single binary applications (bundles) are generated by using [`Warp`](https://github.com/dgiagio/warp)!

#[[###]]# Windows installer #[[###]]#

To build a Windows `${artifactId}-installer-x86_64-x.y.z.msi` installer, go as follows:

```
./installer.sh
```

Then launch the `${artifactId}-installer-x86_64-x.y.z.msi` installer located in the `target` folder to install your application alongside the bundled `JRE`.

> In case your Artifact-ID `${artifactId}` contains a slash ("-"), then just the portion after the slash is used for your installer's name.

#[[###]]# Jexefy JAR #[[###]]#

To create a self-contained binary executable `${artifactId}-launcher-x86_64-x.y.z.elf` for Linux as well as `${artifactId}-launcher-x86_64-x.y.z.exe` for Windows, consisting of a bootstrap binary executable portion and the actual Fat-JAR file, go as follows (automatically invoked when calling `build.sh`):

```
./jexefy.sh
./target/${artifactId}-launcher-x86_64-x.y.z.exe --help
```

> On Linux, just invoke `${artifactId}-launcher-x86_64-x.y.z.elf` instead of the `${artifactId}-launcher-x86_64-x.y.z.exe` Windows variant. 

To run this self-contained binary executable, an installed `JRE` or `JDK` is required!

> In case your Artifact-ID `${artifactId}` contains a slash ("-"), then just the portion after the slash is used for your executable binary shell script's name.

#[[###]]# Scriptify JAR #[[###]]#

To create a self-contained executable `bash` script `${artifactId}.sh` consisting of a bootstrap (`bash` script) portion and the actual Fat-JAR file, go as follows (automatically invoked when calling `build.sh`):

```
./scriptify.sh
./target/${artifactId}-launcher-x.y.z.sh --help
```

To run this self-contained shell script, an installed `JRE` or `JDK` is required!

> In case your Artifact-ID `${artifactId}` contains a slash ("-"), then just the portion after the slash is used for your executable binary shell script's name.

#[[###]]# Native image (GraalVM) #[[###]]#

You may also create a native image using the GraalVM, feel free to skip steps 1) and 2) in case the provided sample files below `src/main/resources/META-INF/${groupId}/${artifactId}` work for you! Assuming you are in the root folder of your project:

1) Dry-run your `JAR` to get the according native-image JSON configurations:

```
java -agentlib:native-image-agent=config-output-dir=target -jar target/${artifactId}-${version}.jar
```

2) Copy the generated files and tweak (sample files have already been provided):

```
cp target/jni-config.json src/main/resources/META-INF/${groupId}/${artifactId}/jni-config.json
cp target/proxy-config.json src/main/resources/META-INF/${groupId}/${artifactId}/proxy-config.json
cp target/reflect-config.json src/main/resources/META-INF/${groupId}/${artifactId}/reflect-config.json
cp target/resource-config.json src/main/resources/META-INF/${groupId}/${artifactId}/resource-config.json
cp target/serialization-config.json src/main/resources/META-INF/${groupId}/${artifactId}/serialization-config.json
```

3) Install GraalVM e.g. using [`SDKMAN!`](https://sdkman.io/) or install the [GraalVM](https://github.com/graalvm/graalvm-ce-builds/releases) manually

4) In case you installed the GraalVM manually, point the `GRAALVM_HOME` environment variable to your GraalVM base folder 

5) Then install the `native-image` tool for GraalVM

```
gu install native-image
```

6) On Debian install `build-essential`, `libz-dev` and `libfreetype6-dev` (in case of an "cannot find "-lfreetype" collect2: error"), on other distros do accordingly:

```
sudo apt install build-essential
sudo apt install libz-dev
sudo apt libfreetype6-dev'
```
   
7) Build with `Maven` using the `native` profile:

```
mvn clean install -P native-image
```

#[[####]]# Additions for Windows #[[####]]#

1) Install [Visual Studio Community](https://visualstudio.microsoft.com/de/downloads), choose (check) all `C/C++` modules

2) Install the [GraalVM](https://github.com/graalvm/graalvm-ce-builds/releases)

3) Point the `GRAALVM_HOME` environment variable to your GraalVM base folder

4) Then install the `native-image` tool for GraalVM

```
gu install native-image
```

5) If not already on your `%PATH%`, copy the `native-image.exe` file accordingly to a location on your `%PATH%` for the `native-image-maven-plugin` for find this tool:

```
copy %GRAALVM_HOME%\lib\svm\bin\native-image.exe %GRAALVM_HOME%\bin
```

6) Build in the `x64 Native Tools Command Prompt` (as of step 1) for `Maven` to see the `C/C++` Tools using the `native` profile:

```
mvn clean install -P native-image
```

#[[###]]# Resources #[[###]]#

* *[refcodes-cli: Parse your args[]](http://www.refcodes.org/refcodes/refcodes-cli)*
* *[org.refcodes:refcodes-cli@Bitbucket](https://bitbucket.org/refcodes/refcodes-cli)*
* *[Bare-Metal REST with just a few lines of codes](http://www.refcodes.org/blog/bare_metal_rest_with_just_a_view_lines_of_code)*
* *[refcodes-rest: RESTful services using lambdas](http://www.refcodes.org/refcodes/refcodes-rest)*
* *[org.refcodes:refcodes-rest@Bitbucket](https://bitbucket.org/refcodes/refcodes-rest)*

#[[###]]# Terms and conditions #[[###]]#

This code is written and provided by Siegfried Steiner, Munich, Germany. Feel free to use it as skeleton for your own applications. Make sure you have considered the license conditions of the included artifacts (see the provided `pom.xml` file).

The [`REFCODES.ORG`](http://www.refcodes.org/refcodes) artifacts used by this template are copyright (c) by Siegfried Steiner, Munich, Germany and licensed under some open source licenses; covered by the  [`refcodes-licensing`](https://bitbucket.org/refcodes/refcodes-licensing) ([`org.refcodes`](https://bitbucket.org/refcodes) group) artifact - evident in each artifact in question as of the `pom.xml` dependency included in such artifact.




© 2015 - 2024 Weber Informatics LLC | Privacy Policy