Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Adapt CI jobs to new Maven Central Portal
Adapted the SNAPSHOT and release jobs to use the new Maven Central
Portal.
  • Loading branch information
sophokles73 committed Aug 12, 2025
commit b85c40a2d63831db9e06947255693dd02bc8c3d6
12 changes: 6 additions & 6 deletions .github/workflows/build_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ jobs:
with: # configure settings.xml
distribution: 'temurin'
java-version: '17'
server-id: ossrh
server-username: OSSRH_USER
server-password: OSSRH_PASSWORD
server-id: central
server-username: MAVEN_CENTRAL_USER
server-password: MAVEN_CENTRAL_PASSWORD

- name: Build and Publish to OSSRH snapshot repo
- name: Build and Publish to Maven Central snapshot repository
run: mvn clean deploy
env:
OSSRH_USER: ${{ secrets.ORG_OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }}
MAVEN_CENTRAL_USER: ${{ secrets.CENTRAL_SONATYPE_TOKEN_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.CENTRAL_SONATYPE_TOKEN_PASSWORD }}
40 changes: 21 additions & 19 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,40 +24,42 @@ jobs:
runs-on: ubuntu-latest

steps:
- run: |
git config --global user.name 'eclipse-uprotocol-bot'
git config --global user.email 'uprotocol-bot@eclipse.org'

- name: Checkout code
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
submodules: 'recursive'

- name: Set up Apache Maven Central
- name: Install xmllint
run: sudo apt-get update && sudo apt-get install -y libxml2-utils

- name: Set up Java with Maven
uses: actions/setup-java@v4
with: # configure settings.xml
distribution: 'temurin'
java-version: '17'
server-id: ossrh
server-username: OSSRH_USER
server-password: OSSRH_PASSWORD
gpg-private-key: ${{ secrets.ORG_GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE


- name: Run tests with coverage
run: |
mvn clean test jacoco:report

mvn clean verify -Djacoco.skip=false

- name: Extract JaCoCo report
- name: Extract overall coverage from JaCoCo report
run: |
echo "Extracting coverage percentage from JaCoCo report"
INDEX_PATH="target/site/jacoco/index.html"
export COVERAGE_PERCENTAGE=$(grep -oP '(?<=<td class="ctr2">).*?(?=%</td>)' $INDEX_PATH | sed 's/ //g')
export COVERAGE_PERCENTAGE=$(printf "%.2f" "$COVERAGE_PERCENTAGE")
echo "COVERAGE_PERCENTAGE=$COVERAGE_PERCENTAGE" >> $GITHUB_ENV
echo "COVERAGE_PERCENTAGE: $COVERAGE_PERCENTAGE"
jacoco_report="target/site/jacoco/jacoco.xml"
missed=$(xmllint --xpath "string(//report/counter[@type='INSTRUCTION']/@missed)" "$jacoco_report")
covered=$(xmllint --xpath "string(//report/counter[@type='INSTRUCTION']/@covered)" "$jacoco_report")
if [ -n "$covered" ] && [ -n "$missed" ]; then
total=$((covered + missed))
if [ $total -gt 0 ]; then
percentage=$(echo "scale=2; $covered * 100 / $total" | bc -l)
else
percentage="0"
fi
else
percentage="N/A"
fi
echo "COVERAGE_PERCENTAGE=$percentage" >> $GITHUB_ENV
echo "COVERAGE_PERCENTAGE: $percentage"


- name: Upload JaCoCo Coverage report
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ jobs:
with: # configure settings.xml
distribution: 'temurin'
java-version: '17'
server-id: ossrh
server-username: OSSRH_USER
server-password: OSSRH_PASSWORD
server-id: central
server-username: MAVEN_CENTRAL_USER
server-password: MAVEN_CENTRAL_PASSWORD
gpg-private-key: ${{ secrets.ORG_GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE

- name: Stage to Nexus and Release to Maven central
run: |
mvn -B release:clean release:prepare -P release release:perform
mvn -B release:clean release:prepare release:perform
env:
OSSRH_USER: ${{ secrets.ORG_OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }}
MAVEN_CENTRAL_USER: ${{ secrets.CENTRAL_SONATYPE_TOKEN_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.CENTRAL_SONATYPE_TOKEN_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.ORG_GPG_PASSPHRASE }}
GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
Expand Down
109 changes: 52 additions & 57 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@
<packaging>jar</packaging>
<url>https://github.com/eclipse-uprotocol/up-java/</url>

<properties>
<java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<protobuf.version>3.25.8</protobuf.version>
</properties>

<licenses>
<license>
<name>The Apache License, Version 2.0</name>
Expand All @@ -53,24 +46,27 @@
<url>https://github.com/eclipse-uprotocol/up-java</url>
</scm>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<pluginRepositories>
<pluginRepository>
<id>dash-licenses</id>
<url>https://repo.eclipse.org/content/repositories/dash-licenses-releases/</url>
</pluginRepository>
</pluginRepositories>


<properties>
<java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<protobuf.version>3.25.8</protobuf.version>
<mockito.version>5.18.0</mockito.version>
<!-- allow dynamic loading of the Mockito Mock agent -->
<!-- see https://www.jacoco.org/jacoco/trunk/doc/prepare-agent-mojo.html -->
<argLine>-XX:+EnableDynamicAgentLoading</argLine>
<!-- do not determine code coverage by default -->
<!-- run mvn with -Djacoco.skip=false to enable -->
<jacoco.skip>true</jacoco.skip>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
Expand Down Expand Up @@ -141,14 +137,14 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.18.0</version>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>5.18.0</version>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -176,6 +172,13 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.11.2</version>
<configuration>
<doclint>all,-missing,-reference</doclint>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.dash</groupId>
<artifactId>license-tool-plugin</artifactId>
Expand Down Expand Up @@ -269,8 +272,6 @@
<configuration>
<!-- allow to use unnamed modules -->
<useModulePath>false</useModulePath>
<!-- allow dynamic loading of the Mockito Mock agent -->
<argLine>-XX:+EnableDynamicAgentLoading ${argLine}</argLine>
</configuration>
</plugin>
<plugin>
Expand All @@ -285,6 +286,21 @@
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.9.0</version>
</plugin>
<!--
keep javadoc generation in the default build in order to
quickly detect issues with JavaDoc comments
-->
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
Expand All @@ -295,15 +311,13 @@
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<!-- Exclude specific packages or classes -->
<configuration>
<!-- Exclude classes generated from proto3 files -->
<excludes>
<exclude>org/eclipse/uprotocol/core/**</exclude>
<exclude>org/eclipse/uprotocol/v1/**</exclude>
Expand All @@ -313,57 +327,35 @@
</executions>
<configuration>
<includes>
<include>**/client/**</include>
<include>**/cloudevent/**</include>
<include>**/communication/**</include>
<include>**/transport/**</include>
<include>**/uri/**</include>
<include>**/uuid/**</include>
<include>**/validation/**</include>
<include>**/client/**</include>
</includes>
</configuration>
</plugin>

<plugin>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.11.2</version>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.8.0</version>
<extensions>true</extensions>
<configuration>
<doclint>all,-missing,-reference</doclint>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<stagingProgressTimeoutMinutes>10</stagingProgressTimeoutMinutes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>3.0.1</version>
<version>3.1.1</version>
<configuration>
<useReleaseProfile>false</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<goals>deploy</goals>
</configuration>
</plugin>

</plugins>
</build>

Expand All @@ -372,10 +364,13 @@
<id>release</id>
<build>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<version>3.2.8</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand Down