|
1 | | -# GitHub Action for the Maven CLI with JDK 11 |
| 1 | +# GitHub Action for the Maven CLI |
2 | 2 |
|
3 | | -The GitHub Action for [Maven](https://maven.apache.org/) wraps the Maven CLI with JDK 11 to enable Maven commands to be run. This can be used to run every Maven Command. |
| 3 | +The [origin project](https://github.com/LucaFeger/action-maven-cli) creates a Maven action with only JDK 8. But I'm writing java with JDK 11 and in the short future I'll keep using JDK 11. So I have forked the origin repository and add support for JDK 11. |
| 4 | + |
| 5 | +The GitHub Action for [Maven](https://maven.apache.org/) wraps the Maven CLI to enable Maven commands to be run. This can be used to run every Maven Command. |
4 | 6 |
|
5 | 7 | ## Usage |
6 | 8 |
|
7 | | -The normalised usage or this GitHub Action is the following code: |
| 9 | +```yml |
| 10 | +# This is a basic workflow to help you get started with Actions |
| 11 | + |
| 12 | +name: CI |
| 13 | + |
| 14 | +# Controls when the action will run. Triggers the workflow on push or pull request |
| 15 | +# events but only for the master branch |
| 16 | +on: |
| 17 | + push: |
| 18 | + branches: [ master ] |
| 19 | + pull_request: |
| 20 | + branches: [ master ] |
| 21 | + |
| 22 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 23 | +jobs: |
| 24 | + # This workflow contains a single job called "build" |
| 25 | + build: |
| 26 | + # The type of runner that the job will run on |
| 27 | + runs-on: ubuntu-latest |
| 28 | + |
| 29 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 30 | + steps: |
| 31 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 32 | + - uses: actions/checkout@v2 |
8 | 33 |
|
| 34 | + # Runs a single command using the runners shell |
| 35 | + - name: Run a one-line script |
| 36 | + run: echo Hello, world! |
| 37 | + |
| 38 | + # Runs a set of commands using the runners shell |
| 39 | + - name: Run maven script |
| 40 | + uses: xlui/action-maven-cli/jdk11@master |
| 41 | + id: test |
| 42 | + with: |
| 43 | + lifecycle: 'clean package test' |
9 | 44 | ``` |
10 | | -action "package" { |
11 | | - uses = "xlui/action-maven-cli/jdk11@master" |
12 | | - args = "clean package" |
13 | | -} |
| 45 | +
|
| 46 | +Under the last `jobs.build.steps.name` you can set the value of `uses` to this action. |
| 47 | + |
| 48 | +```yml |
| 49 | +uses: xlui/action-maven-cli/jdk11@master |
14 | 50 | ``` |
15 | 51 |
|
16 | | -But in order to keep forward-compatibility, you can also use this GitHub Action in the following way: |
| 52 | +or |
17 | 53 |
|
| 54 | +```yml |
| 55 | +uses: xlui/action-maven-cli/jdk8@master |
18 | 56 | ``` |
19 | | -action "package" { |
20 | | - uses = "xlui/action-maven-cli@master" |
21 | | - args = "clean package" |
22 | | -} |
| 57 | + |
| 58 | +As JDK 11 is the latest LTS JDK, there is a convenient way to use it: |
| 59 | + |
| 60 | +```yml |
| 61 | +uses: xlui/action-maven-cli@master |
23 | 62 | ``` |
24 | 63 |
|
25 | 64 | ## License |
|
0 commit comments