Skip to content

Commit fb7da26

Browse files
Publishing packages to Maven Central Repository (#140)
1 parent d2df59c commit fb7da26

10 files changed

Lines changed: 227 additions & 58 deletions

File tree

.github/workflows/build.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
name: Building and testing
22

3-
on: [push, pull_request]
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- 'master'
8+
tags:
9+
- 'v*'
10+
pull_request:
11+
branches:
12+
- 'master'
413

514
jobs:
615
build:
@@ -24,4 +33,4 @@ jobs:
2433
restore-keys: ${{ runner.os }}-m2
2534

2635
- name: Build with Maven
27-
run: mvn --batch-mode --update-snapshots package
36+
run: mvn -Pci --batch-mode --update-snapshots package

.github/workflows/release.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
name: Release distribution
1+
name: Release
22

33
on:
44
push:
5-
branches:
6-
- master
7-
release:
8-
types:
9-
- created
5+
tags:
6+
- 'v*.*.*'
107

118
jobs:
129
release:
@@ -25,6 +22,8 @@ jobs:
2522
with:
2623
java-version: '17'
2724
distribution: 'temurin'
25+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
26+
gpg-passphrase: GPG_PASSPHRASE
2827

2928
- name: Cache Maven packages
3029
uses: actions/cache@v4.1.1
@@ -34,6 +33,8 @@ jobs:
3433
restore-keys: ${{ runner.os }}-m2
3534

3635
- name: Publish package
37-
run: mvn --batch-mode deploy
36+
run: mvn -Prelease --settings settings-github.xml --batch-mode deploy
3837
env:
39-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
39+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
40+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Changed
1111

12+
- Automatic publishing to Maven Central for releases
1213
- Adding missing "applicationLanguage" to XML and XSD
1314
- Add "DEV" as a constant version
1415

README.md

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,49 +17,39 @@
1717

1818
The REXS API library contains core utility classes for the REXS interface.
1919

20-
ATTENTION: The current status of the REXS API is not yet fully covered by Javadoc and unit tests. For this reason we cannot publish a first version yet. Before using this stand productively, you should therefore test sufficiently.
20+
ATTENTION: The current status of the REXS API is not yet fully covered by Javadoc and unit tests. For this reason we cannot publish a first major version yet. Before using this stand productively, you should therefore test sufficiently.
2121

2222

2323
## Requirements
2424

2525
* Java 17
26-
* Maven 3.8.5 ([http://maven.apache.org](http://maven.apache.org))
27-
* (Optional) Lombok ([https://projectlombok.org/](https://projectlombok.org/)) (only if you use an IDE like Eclipse)
2826

2927

30-
## IDE Support
28+
## Installation
3129

32-
To use these projects in an IDE you will need the [project Lombok](https://projectlombok.org/) agent. Full instructions can be found on the Lombok website. The sign that you need to do this is a lot of compiler errors to do with missing methods and fields.
30+
Add the dependency to your project:
3331

32+
### Using Maven
3433

35-
## Build the package
34+
```xml
35+
<dependency>
36+
<groupId>io.github.fva-net</groupId>
37+
<artifactId>rexs-api-java</artifactId>
38+
<version>0.9.0</version>
39+
</dependency>
40+
```
3641

37-
1. Install Java and create a `JAVA_HOME` environment variable that points to the location of your JDK
3842

39-
`set PATH=C:\develop\lib\jdk-17.0.2\bin;%PATH%`
43+
## Contributing
4044

41-
`set JAVA_HOME=C:\develop\lib\jdk-17.0.2`
45+
Any pull request or bug report are welcome!
46+
If you have any suggestion about new features, you can **open an issue**.
4247

43-
2. Install Maven and create Maven environment variables
4448

45-
`set PATH=C:\develop\lib\apache-maven-3.8.5\bin;%PATH%`
49+
## Developer documentation
4650

47-
`set M2_HOME=C:\develop\lib\apache-maven-3.8.5`
48-
49-
`set M2=%M2_HOME%\bin`
50-
51-
3. Run `mvn clean package` in the root directory of the application
52-
53-
4. Navigate to `api/target` where you find the `rexs-api-1.0.0.jar`
54-
55-
56-
## Run the Command Line Interface
57-
58-
1. Build the package
59-
60-
2. Navigate to `cli/target` where you find the `rexs-api-cli-1.0.0.jar`
61-
62-
3. Run `java -jar rexs-api-cli-1.0.0.jar --help`
51+
[How-to build on your local pc?](documentation/development/how-to_build_on_local_pc.md)
52+
[How-to release a new version?](documentation/development/how-to_release_a_new_version.md)
6353

6454

6555
## Next steps

api/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
<modelVersion>4.0.0</modelVersion>
2222

2323
<parent>
24-
<groupId>de.fva-service.rexs</groupId>
25-
<artifactId>rexs-api-project</artifactId>
24+
<groupId>io.github.fva-net</groupId>
25+
<artifactId>rexs-api-java-project</artifactId>
2626
<version>0.9.0-SNAPSHOT</version>
2727
<relativePath>../pom.xml</relativePath>
2828
</parent>
2929

30-
<artifactId>rexs-api</artifactId>
30+
<artifactId>rexs-api-java</artifactId>
3131

32-
<name>REXS-API</name>
32+
<name>REXS-API-Java :: API</name>
3333

3434
<dependencies>
3535

cli/pom.xml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
<modelVersion>4.0.0</modelVersion>
2222

2323
<parent>
24-
<groupId>de.fva-service.rexs</groupId>
25-
<artifactId>rexs-api-project</artifactId>
24+
<groupId>io.github.fva-net</groupId>
25+
<artifactId>rexs-api-java-project</artifactId>
2626
<version>0.9.0-SNAPSHOT</version>
2727
<relativePath>../pom.xml</relativePath>
2828
</parent>
2929

30-
<artifactId>rexs-api-cli</artifactId>
30+
<artifactId>rexs-api-java-cli</artifactId>
3131

32-
<name>REXS-API :: Command Line Interface</name>
32+
<name>REXS-API-Java :: Command Line Interface</name>
3333
<description>Command line interface for REXS-API functions.</description>
3434

3535
<dependencies>
@@ -62,7 +62,7 @@
6262
<!-- The REXS-API -->
6363
<dependency>
6464
<groupId>${project.groupId}</groupId>
65-
<artifactId>rexs-api</artifactId>
65+
<artifactId>rexs-api-java</artifactId>
6666
</dependency>
6767

6868
</dependencies>
@@ -89,6 +89,32 @@
8989

9090
<plugins>
9191

92+
<plugin>
93+
<groupId>org.apache.maven.plugins</groupId>
94+
<artifactId>maven-source-plugin</artifactId>
95+
<executions>
96+
<execution>
97+
<id>attach-sources</id>
98+
<goals>
99+
<goal>jar-no-fork</goal>
100+
</goals>
101+
</execution>
102+
</executions>
103+
</plugin>
104+
105+
<plugin>
106+
<groupId>org.apache.maven.plugins</groupId>
107+
<artifactId>maven-javadoc-plugin</artifactId>
108+
<executions>
109+
<execution>
110+
<id>attach-javadocs</id>
111+
<goals>
112+
<goal>jar</goal>
113+
</goals>
114+
</execution>
115+
</executions>
116+
</plugin>
117+
92118
<plugin>
93119
<groupId>org.springframework.boot</groupId>
94120
<artifactId>spring-boot-maven-plugin</artifactId>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# How-to build on your local pc?
2+
3+
## Requirements
4+
5+
* Java 17
6+
* Maven 3.8.5 ([http://maven.apache.org](http://maven.apache.org))
7+
* (Optional) Lombok ([https://projectlombok.org/](https://projectlombok.org/)) (only if you use an IDE like Eclipse)
8+
9+
10+
## IDE Support
11+
12+
To use these projects in an IDE you will need the [project Lombok](https://projectlombok.org/) agent. Full instructions can be found on the Lombok website. The sign that you need to do this is a lot of compiler errors to do with missing methods and fields.
13+
14+
15+
## Build the package
16+
17+
1. Install Java and create a `JAVA_HOME` environment variable that points to the location of your JDK
18+
19+
`set PATH=C:\develop\lib\jdk-17.0.2\bin;%PATH%`
20+
21+
`set JAVA_HOME=C:\develop\lib\jdk-17.0.2`
22+
23+
2. Install Maven and create Maven environment variables
24+
25+
`set PATH=C:\develop\lib\apache-maven-3.8.5\bin;%PATH%`
26+
27+
`set M2_HOME=C:\develop\lib\apache-maven-3.8.5`
28+
29+
`set M2=%M2_HOME%\bin`
30+
31+
3. Run `mvn clean package` in the root directory of the application
32+
33+
4. Navigate to `api/target` where you find the `rexs-api-java-0.9.0.jar`
34+
35+
36+
## Run the Command Line Interface
37+
38+
1. Build the package
39+
40+
2. Navigate to `cli/target` where you find the `rexs-api-java-cli-0.9.0.jar`
41+
42+
3. Run `java -jar rexs-api-java-cli-0.9.0.jar --help`
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# How-to release a new version?
2+
3+
* Find the new version number
4+
* The version number of the REXS API is based on Semantic Versioning (see https://semver.org/)
5+
* To test the release process, a suffix like `-alpha`, `-beta`, `-rc` (also possible with numbering, e.g.: `-rc1`) can be used
6+
* Example: `0.9.0` or `0.9.0-rc1` for a test run
7+
8+
* Set version number in POMs and commit
9+
10+
```
11+
$ mvn versions:set -DnewVersion=0.9.0 -DgenerateBackupPoms=false
12+
$ git add pom.xml
13+
$ git commit -m '[release] prepare release rexs-api-java-0.9.0'
14+
```
15+
16+
* Set a tag
17+
18+
```
19+
$ git tag -a v0.9.0 -m 'release 0.9.0'
20+
$ git push origin v0.9.0
21+
```
22+
23+
* The tag automatically creates a release using GitHub actions and publishes it in Maven Central
24+
25+
* Set and commit version number for further development
26+
27+
```
28+
$ mvn versions:set -DnewVersion=0.10.0-SNAPSHOT -DgenerateBackupPoms=false
29+
$ git add pom.xml
30+
$ git commit -m '[release] prepare for next development iteration'
31+
$ git push origin master
32+
```
33+
34+
* Delete test versions from Maven Central
35+
* Test versions do not need to remain in Maven Central unnecessarily and should be deleted

0 commit comments

Comments
 (0)