Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the version in the POM file before building the package #194

Merged
merged 1 commit into from
Sep 15, 2023
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ java:
mv java_bin/java java_bin/daff/src/main
cp packaging/java/pom.xml java_bin/daff
cp scripts/Example.java java_bin
cd java_bin/daff; mvn -Drevision=$(version) clean package
cd java_bin/daff; mvn build-helper:parse-version versions:set -DnewVersion=$(version) versions:commit; mvn clean package
cd java_bin; javac -cp daff/target/daff-$(version).jar Example.java
@echo 'Output in java_bin/daff/target, run "java -jar java_bin/daff/target/daff-$(version).jar" for help'
@echo 'Run example with "java -cp java_bin/daff/target/daff-$(version).jar:java_bin Example"'
Expand Down
28 changes: 10 additions & 18 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
In order to publish `daff` to Maven Central, the file `~/.jreleaser/config.properties` with the following contents is required:

```bash
JRELEASER_NEXUS2_USERNAME="<your-sonatype-account-username>"
JRELEASER_NEXUS2_PASSWORD="<your-sonatype-account-password>"
JRELEASER_GPG_PASSPHRASE="<your-pgp-passphrase>"
JRELEASER_GPG_PUBLIC_KEY="/path/to/public.gpg"
JRELEASER_GPG_SECRET_KEY="/path/to/private.gpg"
JRELEASER_GITHUB_TOKEN="<your-github-token>"
JRELEASER_NEXUS2_USERNAME=<your-sonatype-account-username>
JRELEASER_NEXUS2_PASSWORD=<your-sonatype-account-password>
JRELEASER_GPG_PASSPHRASE=<your-pgp-passphrase>
JRELEASER_GPG_PUBLIC_KEY=/path/to/public.gpg
JRELEASER_GPG_SECRET_KEY=/path/to/private.gpg
JRELEASER_GITHUB_TOKEN=<your-github-token>
```

In order to get a Sonatype account, follow [the steps in this guide](https://maciejwalkowiak.com/blog/guide-java-publish-to-maven-central/).
Expand All @@ -28,30 +28,22 @@ gpg --output private.gpg --armor --export-secret-key username@email-host

The GitHub token can be generated in GitHub/User Profile/Settings/Developer settings.

Once all configuration is in place, execute the following commands.

In the repository root:

```bash
export version=$(grep "\"version\"" package.json | grep -E -o "[.0-9]+")
```

In the directory `java_bin/daff` (from JReleaser's [docs](https://jreleaser.org/guide/latest/examples/maven/maven-central.html)):
Once all configuration is in place, execute the following commands from the directory `java_bin/daff` (from JReleaser's [docs](https://jreleaser.org/guide/latest/examples/maven/maven-central.html)):

1) Verify release & deploy configuration

```bash
mvn -Drevision=$version jreleaser:config
mvn jreleaser:config
```

2) Stage all artifacts to a local directory

```bash
mvn -Drevision=$version -Ppublication
mvn -Ppublication
```

3) Deploy and release

```bash
mvn -Drevision=$version jreleaser:full-release
mvn jreleaser:full-release
```
7 changes: 6 additions & 1 deletion packaging/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.paulfitz</groupId>
<artifactId>daff</artifactId>
<version>${revision}</version>
<version>0.0.0</version>
<packaging>jar</packaging>

<name>daff</name>
Expand Down Expand Up @@ -42,6 +42,11 @@
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.4.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
Expand Down