diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
new file mode 100644
index 0000000..7b4a413
--- /dev/null
+++ b/.github/workflows/build.yaml
@@ -0,0 +1,34 @@
+# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
+# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
+
+name: Maven Package
+
+on:
+ release:
+ types: [created]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ packages: write
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Set up JDK 11
+ uses: actions/setup-java@v2
+ with:
+ java-version: '11'
+ distribution: 'adopt'
+ server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
+ settings-path: ${{ github.workspace }} # location for the settings.xml file
+
+ - name: Build with Maven
+ run: mvn -B package --file pom.xml
+
+ - name: Publish to GitHub Packages Apache Maven
+ run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
diff --git a/README.md b/README.md
index 6816696..8de48b6 100644
--- a/README.md
+++ b/README.md
@@ -10,3 +10,14 @@ According to different use cases, we provide several Jenkinsfile for you:
|[Jenkinsfile.jmeter.groovy](Jenkinsfile.jmeter.groovy)|A kubernetes environment|Running a JMeter test in Jenkins|
|[Jenkinsfile-milestone.groovy](Jenkinsfile-milestone.groovy)|None|Abort running build if new one is started|
See also https://jenkins-zh.cn/about/course/#1
+
+# Jar
+
+You can run it via the following:
+
+```
+mvn package
+java -jar target/demo-junit-1.0.1-20170422.jar
+```
+
+# War
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 9f1706f..6a95b06 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,6 +25,29 @@
7
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+ make-a-jar
+ compile
+
+ jar
+
+
+
+
+
+
+ true
+
+ cli.App
+
+
+
+
+
diff --git a/src/main/java/cli/App.java b/src/main/java/cli/App.java
new file mode 100644
index 0000000..19c0404
--- /dev/null
+++ b/src/main/java/cli/App.java
@@ -0,0 +1,10 @@
+package cli;
+
+/**
+ * This is a demo for Java executable jar
+ */
+public class App {
+ public static void main(String[] args) {
+ System.out.println("Env: NAME=" + System.getenv("NAME"));
+ }
+}