Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 23 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,29 @@
<target>7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>make-a-jar</id>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>
cli.App
</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
10 changes: 10 additions & 0 deletions src/main/java/cli/App.java
Original file line number Diff line number Diff line change
@@ -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"));
}
}