Skip to content

Commit 2780ab0

Browse files
committed
Enforcer should work
1 parent 127ed82 commit 2780ab0

File tree

3 files changed

+32
-11
lines changed

3 files changed

+32
-11
lines changed

.github/workflows/publish-v2-snapshot.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@ jobs:
2020
distribution: 'corretto'
2121
java-version: 11
2222
server-id: ossrh
23-
server-username: MAVEN_USERNAME
24-
server-password: MAVEN_PASSWORD
2523
# TODO: use environments https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
2624
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }} # Value of the GPG private key to import
2725
gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase
2826
- name: Publish package
29-
run: mvn -Prelease clean deploy -DskipTests
27+
run: mvn -Prelease clean validate deploy -DskipTests # We use validate here to run maven enforcer, to make sure we are only publishing SNAPSHOT builds
3028
env:
3129
MAVEN_USERNAME: ${{ secrets.OSSRH_JIRA_USERNAME }}
3230
MAVEN_PASSWORD: fail_because_this_is_wrong

pom.xml

+30-8
Original file line numberDiff line numberDiff line change
@@ -466,23 +466,45 @@
466466
<plugins>
467467
<plugin>
468468
<groupId>org.apache.maven.plugins</groupId>
469-
<artifactId>maven-gpg-plugin</artifactId>
469+
<artifactId>maven-enforcer-plugin</artifactId>
470+
<version>3.5.0</version>
470471
<executions>
471472
<execution>
472-
<id>sign-artifacts</id>
473-
<phase>verify</phase>
473+
<id>enforce-snapshot-versions</id>
474+
<phase>validate</phase>
474475
<goals>
475-
<goal>sign</goal>
476+
<goal>enforce</goal>
476477
</goals>
477478
<configuration>
478-
<gpgArguments>
479-
<arg>--pinentry-mode</arg>
480-
<arg>loopback</arg>
481-
</gpgArguments>
479+
<rules>
480+
<requireSnapshotVersion>
481+
<message>Release build should not have snapshot dependencies!</message>
482+
</requireSnapshotVersion>
483+
</rules>
484+
<fail>true</fail>
482485
</configuration>
483486
</execution>
484487
</executions>
485488
</plugin>
489+
<!-- <plugin>-->
490+
<!-- <groupId>org.apache.maven.plugins</groupId>-->
491+
<!-- <artifactId>maven-gpg-plugin</artifactId>-->
492+
<!-- <executions>-->
493+
<!-- <execution>-->
494+
<!-- <id>sign-artifacts</id>-->
495+
<!-- <phase>verify</phase>-->
496+
<!-- <goals>-->
497+
<!-- <goal>sign</goal>-->
498+
<!-- </goals>-->
499+
<!-- <configuration>-->
500+
<!-- <gpgArguments>-->
501+
<!-- <arg>&#45;&#45;pinentry-mode</arg>-->
502+
<!-- <arg>loopback</arg>-->
503+
<!-- </gpgArguments>-->
504+
<!-- </configuration>-->
505+
<!-- </execution>-->
506+
<!-- </executions>-->
507+
<!-- </plugin>-->
486508
<plugin>
487509
<groupId>org.apache.maven.plugins</groupId>
488510
<artifactId>maven-source-plugin</artifactId>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"installationId":"e43b8515-8484-485c-8315-bead4568972b","telemetryEnabled":"true"}

0 commit comments

Comments
 (0)