Skip to content

Commit e52d1db

Browse files
committed
change name of jar and add test workflows
1 parent a9ad075 commit e52d1db

File tree

3 files changed

+60
-60
lines changed

3 files changed

+60
-60
lines changed

.github/workflows/maven-publish_to_central_singlerepo.yml

-60
This file was deleted.

.github/workflows/maven-test.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
2+
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
3+
4+
name: Maven Test
5+
6+
on:
7+
# release:
8+
# types: [created]
9+
# # this will trigger everytime for every push for every branch
10+
push:
11+
branches:
12+
- '*'
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Set up JDK 21
24+
uses: actions/setup-java@v4 #https://github.com/actions/setup-java
25+
with:
26+
java-version: '21'
27+
distribution: 'temurin'
28+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml # ID of the distributionManagement repository in the pom.xml file. Default is github.
29+
# server-username: GITHUB_ACTOR # Environment variable name for the username for authentication to the Apache Maven repository. Default is GITHUB_ACTOR.
30+
# server-password: GITHUB_TOKEN # Environment variable name for password or token for authentication to the Apache Maven repository. Default is GITHUB_TOKEN.
31+
#settings-path: ${{ github.workspace }} # location for the settings.xml file # Maven related setting to point to the directory where the settings.xml file will be written. Default is ~/.m2.
32+
33+
- name: Show file content v3
34+
run: cat ~/.m2/settings.xml
35+
continue-on-error: true
36+
37+
- name: Build with Maven
38+
run: mvn -B package --file pom.xml
39+
40+
- name: Show file content v3
41+
run: cat ~/.m2/settings.xml
42+
continue-on-error: true
43+
44+
- name: Maven test
45+
#run: mvn test -s $GITHUB_WORKSPACE/settings.xml
46+
run: ./mvnw clean test
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.DEPLOY_GITHUB_TOKEN }}
49+
GITHUB_ACTOR: ${{ secrets.DEPLOY_GITHUB_USERNAME }}

pom.xml

+11
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<maven.compiler.source>${java.version}</maven.compiler.source>
3232
<maven.compiler.target>${java.version}</maven.compiler.target>
3333
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
34+
<maven-jar-use-timestamp-insteadof-snapshot-as-prefixforjar>false</maven-jar-use-timestamp-insteadof-snapshot-as-prefixforjar>
3435

3536
</properties>
3637

@@ -83,6 +84,16 @@
8384
<groupId>org.apache.maven.plugins</groupId>
8485
<artifactId>maven-jar-plugin</artifactId>
8586
<version>${maven-jar-plugin.version}</version>
87+
<configuration>
88+
<archive>
89+
<manifest>
90+
<!-- this will change the unique timestamp in the name to -SNAPSHOT.jar -->
91+
<!-- false => domain-1.0-SNAPSHOT.jar -->
92+
<!-- true => domain-1.0-20240404.184611-1.jar -->
93+
<useUniqueVersions>${maven-jar-use-timestamp-insteadof-snapshot-as-prefixforjar}</useUniqueVersions>
94+
</manifest>
95+
</archive>
96+
</configuration>
8697
</plugin>
8798
</plugins>
8899
</build>

0 commit comments

Comments
 (0)