Skip to content

Commit

Permalink
Merge pull request #3 from dennisvang/issue1-maven-central
Browse files Browse the repository at this point in the history
Publish to Maven Central repository
  • Loading branch information
luizbonino authored Nov 4, 2024
2 parents 4e076dc + 63f5aa2 commit f47ed22
Show file tree
Hide file tree
Showing 16 changed files with 179 additions and 170 deletions.
64 changes: 0 additions & 64 deletions .github/workflows/main.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/maven-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-java-with-maven

name: Maven CI

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
# temurin LTS versions
version: [17, 21]

steps:
- uses: actions/checkout@v4

# setup
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.version }}
distribution: 'temurin'
cache: maven

# verify
# https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
- name: Run maven verify (skip GPG signing)
run: mvn --batch-mode --update-snapshots --fail-fast -Dgpg.skip verify
38 changes: 38 additions & 0 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path

name: Maven publish

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
# https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-java-with-maven
# https://github.com/actions/setup-java
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
# using java 17 for now, to match original
# todo: migrate to java 21 (LTS)
java-version: 17
distribution: 'temurin'
cache: maven
# https://central.sonatype.org/publish/generate-portal-token/
server-id: central
server-username: MAVEN_CENTRAL_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Publish to Maven Central Portal
# if autoPublish is false (see pom.xml), we need to publish manually via https://central.sonatype.com/publishing/deployments
run: mvn --batch-mode deploy
env:
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
2 changes: 0 additions & 2 deletions .mvn/maven.config

This file was deleted.

38 changes: 0 additions & 38 deletions .nexus.settings.xml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You have to adjust your MongoDB configuration to include entities and repositori

```java
@Configuration
@EnableMongoRepositories(basePackages = {"com.example", "nl.dtls.rdf.migration"})
@EnableMongoRepositories(basePackages = {"com.example", "org.fairdatateam.rdf.migration"})
public class MongoConfig {
}
```
Expand Down
123 changes: 84 additions & 39 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<!-- https://docs.spring.io/spring-boot/maven-plugin/using.html -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<!-- TODO: upgrade spring boot (support for 2.2.x ended in 2020) -->
<!-- https://spring.io/projects/spring-boot#support -->
<version>2.2.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>nl.dtls</groupId>

<groupId>org.fairdatateam.rdf</groupId>
<artifactId>spring-rdf-migration</artifactId>
<version>${revision}${changelist}</version>
<version>2.0.0</version>
<packaging>jar</packaging>

<name>Spring RDF Migration</name>
Expand All @@ -27,9 +31,26 @@
</licenses>

<scm>
<connection>scm:git:https://github.com/FAIRDataTeam/spring-rdf-migration.git</connection>
<developerConnection>scm:git:ssh://github.com/FAIRDataTeam/spring-rdf-migration.git</developerConnection>
<url>https://github.com/FAIRDataTeam/spring-rdf-migration</url>
</scm>

<developers>
<developer>
<name>dennisvang</name>
<url>https://github.com/dennisvang</url>
</developer>
<developer>
<name>Marek Suchánek</name>
<url>https://github.com/MarekSuchanek</url>
</developer>
<developer>
<name>Vojtech Knaisl</name>
<url>https://github.com/vknaisl</url>
</developer>
</developers>

<properties>
<!-- Project -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -39,20 +60,16 @@
<maven.compiler.target>17</maven.compiler.target>

<!-- Core -->
<lombok.version>1.18.22</lombok.version>
<lombok.version>1.18.34</lombok.version>

<!-- Plugins -->
<plugin.mavenlic.version>3.0</plugin.mavenlic.version>
<plugin.javadoc.version>3.1.1</plugin.javadoc.version>
<plugin.mavenlic.version>4.6</plugin.mavenlic.version>
<plugin.javadoc.version>3.10.1</plugin.javadoc.version>
<plugin.source.version>3.3.1</plugin.source.version>
<plugin.publishing.version>0.6.0</plugin.publishing.version>
<plugin.gpg.version>3.2.7</plugin.gpg.version>
</properties>

<distributionManagement>
<repository>
<id>nexus-releases</id>
<url>https://nexus.internal.fairdatapoint.org/repository/maven-releases/</url>
</repository>
</distributionManagement>

<dependencies>
<!-- ////////////////// -->
<!-- Spring -->
Expand All @@ -73,22 +90,6 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${plugin.javadoc.version}</version>
<configuration>
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
Expand All @@ -112,24 +113,68 @@
</execution>
</executions>
</plugin>
<!-- the following plugins are required for publishing to maven central -->
<!-- https://central.sonatype.org/publish/publish-portal-maven/ -->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.5.1</version>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>${plugin.publishing.version}</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<!-- visit https://central.sonatype.com/publishing/deployments to publish manually -->
<!-- also visit that site to debug validation issues -->
<autoPublish>false</autoPublish>
</configuration>
</plugin>
<!-- https://central.sonatype.org/publish/publish-maven/#gpg-signed-components -->
<!-- https://maven.apache.org/plugins/maven-gpg-plugin/usage.html -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${plugin.gpg.version}</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>deploy</goal>
<goal>sign</goal>
</goals>
<configuration>
<bestPractices>true</bestPractices>
<!-- set gpg.keyname via command line if necessary (default: first found) -->
</configuration>
</execution>
</executions>
</plugin>
<!-- https://central.sonatype.org/publish/publish-maven/#javadoc-and-sources-attachments -->
<!-- https://maven.apache.org/plugins/maven-source-plugin/ -->
<!-- https://maven.apache.org/plugins/maven-javadoc-plugin/ -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${plugin.source.version}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${plugin.javadoc.version}</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<serverId>nexus</serverId>
<nexusUrl>https://nexus.internal.fairdatapoint.org</nexusUrl>
<skipStaging>true</skipStaging>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* The MIT License
* Copyright © 2019 DTL
*
Expand All @@ -20,9 +20,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package nl.dtls.rdf.migration.database;
package org.fairdatateam.rdf.migration.database;

import nl.dtls.rdf.migration.entity.RdfMigration;
import org.fairdatateam.rdf.migration.entity.RdfMigration;
import org.springframework.data.mongodb.repository.MongoRepository;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* The MIT License
* Copyright © 2019 DTL
*
Expand All @@ -23,4 +23,4 @@
/**
* A package contains classes needed to store meta-information about the migrations into a MongoDB database
*/
package nl.dtls.rdf.migration.database;
package org.fairdatateam.rdf.migration.database;
Loading

0 comments on commit f47ed22

Please sign in to comment.