Skip to content

Commit

Permalink
maven-plugin: added configuration for publishing the plugin (#23)
Browse files Browse the repository at this point in the history
Note: Publishing the library itself is incomplete and requires adding
signing of the package for it to work.
Signing needs to be done manually at the moment and does not work on
github actions without additional changes
  • Loading branch information
dorav authored Dec 11, 2023
1 parent 3fe2abd commit 921b1de
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 39 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
with:
distribution: temurin
java-version: 11
gpg-private-key: ${{ secrets.gpg_key }}
gpg-passphrase: ${{ secrets.gpg_passphrase }}

- name: Setup Gradle
uses: gradle/[email protected]
Expand Down Expand Up @@ -46,7 +48,7 @@ jobs:
- name: Build Maven Plugin
run: |
cd maven-plugin
mvn clean install --batch-mode
mvn clean install -Dgpg.passphrase='${{ secrets.gpg_passphrase }}' --batch-mode
- name: Integration tests with maven plugin
run: |
Expand Down
30 changes: 0 additions & 30 deletions examples/maven_project_example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,42 +48,12 @@
</dependencies>

<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>

<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>1.9.20</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

<pluginManagement>
<plugins>
<plugin>
<groupId>io.atlasgo</groupId>
<artifactId>hibernate-provider-maven-plugin</artifactId>
<version>0.1</version>
<executions>
<execution>
<id>schema-using-postgresq-properties</id>
<phase>compile</phase>
<goals>
<goal>schema</goal>
</goals>
<configuration>
<properties>postgresql.properties</properties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
Expand Down
21 changes: 14 additions & 7 deletions hibernate-provider/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ tasks.jar {
archiveBaseName.set(rootProject.name)
}


publishing {
publications {
create<MavenPublication>("hibernate-provider") {
Expand All @@ -59,13 +60,13 @@ publishing {
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
// developers {
// developer {
// id = "johnd"
// name = "John Doe"
// email = "[email protected]"
// }
// }
developers {
developer {
id = "Ariga"
name = "Ariga"
email = "[email protected]"
}
}
scm {
connection = "scm:git:git://github.com/ariga/atlas-provider-hibernate.git"
developerConnection = "scm:git:ssh://github.com/ariga/atlas-provider-hibernate.git"
Expand All @@ -74,7 +75,13 @@ publishing {
}
}
}

repositories {
maven {
name = "ossrh"
credentials(PasswordCredentials::class)
url = uri("https://s01.oss.sonatype.org/content/groups/staging/")
}
maven {
name = "localPluginRepository"
url = uri("../.local-plugin-repository")
Expand Down
95 changes: 94 additions & 1 deletion maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<groupId>io.atlasgo</groupId>
<artifactId>hibernate-provider-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>0.1</version>
<version>0.2-SNAPSHOT</version>
<description>Atlas Hibernate schema provider</description>

<name>hibernate-provider-maven-plugin Maven Mojo</name>
<url>https://github.com/ariga/atlas-provider-hibernate</url>
Expand All @@ -16,6 +17,28 @@
<maven.compiler.source>11</maven.compiler.source>
</properties>

<licenses>
<license>
<name>The Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

<developers>
<developer>
<name>Ariga</name>
<email>[email protected]</email>
<organization>Ariga</organization>
<organizationUrl>https://atlasgo.cloud/</organizationUrl>
</developer>
</developers>

<scm>
<connection>scm:git:git://github.com/ariga/atlas-provider-hibernate.git</connection>
<developerConnection>scm:git:ssh://github.com:ariga/atlas-provider-hibernate.git</developerConnection>
<url>http://github.com/ariga/atlas-provider-hibernate/tree/master</url>
</scm>

<dependencies>
<dependency>
<groupId>org.hibernate.orm</groupId>
Expand Down Expand Up @@ -54,6 +77,17 @@
</dependency>
</dependencies>

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

<build>
<plugins>
<plugin>
Expand All @@ -75,6 +109,65 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</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>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<keyname>${gpg.keyname}</keyname>
<passphraseServerId>${gpg.keyname}</passphraseServerId>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</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://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
Expand Down

0 comments on commit 921b1de

Please sign in to comment.