Skip to content

Commit 0d9c6aa

Browse files
#654: Enable automatic Maven Central deployment (#655)
Co-authored-by: Pieterjan Spoelders <[email protected]>
1 parent 01a7edc commit 0d9c6aa

File tree

16 files changed

+94
-12
lines changed

16 files changed

+94
-12
lines changed

.github/workflows/ci-build.yml

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/changes/changelog.md

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/changes/changes_5.2.1.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Project Keeper 5.2.1, released 2025-06-06
2+
3+
Code name: Auto-publish to Maven Central
4+
5+
## Summary
6+
7+
This release fixes an issue with the `release.yml` workflow that required manually publishing of Maven Central deployments. Maven Central Deployments no are done automatically during the release build without manual steps.
8+
9+
## Bugfixes
10+
11+
* #654: Fixed automatic Maven Central deployment
12+
13+
## Dependency Updates
14+
15+
### Project Keeper Core
16+
17+
#### Compile Dependency Updates
18+
19+
* Updated `com.exasol:project-keeper-shared-model-classes:5.2.0` to `5.2.1`
20+
21+
#### Runtime Dependency Updates
22+
23+
* Updated `com.exasol:project-keeper-java-project-crawler:5.2.0` to `5.2.1`
24+
25+
#### Test Dependency Updates
26+
27+
* Updated `com.exasol:project-keeper-shared-test-setup:5.2.0` to `5.2.1`
28+
29+
### Project Keeper Command Line Interface
30+
31+
#### Compile Dependency Updates
32+
33+
* Updated `com.exasol:project-keeper-core:5.2.0` to `5.2.1`
34+
35+
#### Test Dependency Updates
36+
37+
* Updated `com.exasol:project-keeper-shared-test-setup:5.2.0` to `5.2.1`
38+
39+
### Project Keeper Maven Plugin
40+
41+
#### Compile Dependency Updates
42+
43+
* Updated `com.exasol:project-keeper-core:5.2.0` to `5.2.1`
44+
45+
### Project Keeper Java Project Crawler
46+
47+
#### Compile Dependency Updates
48+
49+
* Updated `com.exasol:project-keeper-shared-model-classes:5.2.0` to `5.2.1`
50+
51+
#### Test Dependency Updates
52+
53+
* Updated `com.exasol:project-keeper-shared-test-setup:5.2.0` to `5.2.1`
54+
55+
### Project Keeper Shared Test Setup
56+
57+
#### Compile Dependency Updates
58+
59+
* Updated `com.exasol:project-keeper-shared-model-classes:5.2.0` to `5.2.1`

doc/developer_guide/developer_guide.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ Maven plugin `central-publishing-maven-plugin` creates a bundle and uploads it t
125125
```sh
126126
mvn clean deploy -Dgpg.skip=false -DskipTests \
127127
-Dcentral-publishing.deploymentName="Testing Deployment" \
128-
-Dcentral-publishing.autoPublish=false \
129128
-Dcentral-publishing.skipPublishing=true
130129
```
131130

@@ -172,11 +171,10 @@ Then run the following command:
172171

173172
```sh
174173
mvn clean deploy -Dgpg.skip=false -DskipTests \
175-
-Dcentral-publishing.deploymentName="Testing Deployment" \
176-
-Dcentral-publishing.autoPublish=false
174+
-Dcentral-publishing.deploymentName="Testing Deployment"
177175
```
178176

179-
**Important:** Make sure to specify argument `-Dcentral-publishing.autoPublish=false`. Without this option, the bundle will be published automatically.
177+
**Important:** Do not specify property `central-publishing.autoPublish` to use the default value `false`. This ensures that the bundle will **not** be published automatically.
180178

181179
Then login to Maven Central Portal and go to the [deployments page](https://central.sonatype.com/publishing/deployments). Verify that your component was deployed successfully and has the expected content.
182180

maven-project-crawler/pk_generated_parent.pom

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parent-pom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</license>
1919
</licenses>
2020
<properties>
21-
<revision>5.2.0</revision>
21+
<revision>5.2.1</revision>
2222
<!-- Integration test ProjectKeeperMojoIT starts a Maven build which requires Java 17. -->
2323
<java.version>17</java.version>
2424
<maven.version>3.9.10</maven.version>

project-keeper-cli/pk_generated_parent.pom

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

project-keeper-maven-plugin/pk_generated_parent.pom

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

project-keeper/pk_generated_parent.pom

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

project-keeper/src/main/java/com/exasol/projectkeeper/validators/pom/PomFileGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ private ElementBuilder properties(final Collection<ProjectKeeperModule> enabledM
212212
if (enabledModules.contains(MAVEN_CENTRAL)) {
213213
properties
214214
.child(element("gpg.skip").text("true"))
215-
.child(element("central-publishing.autoPublish").text("true"))
215+
.child(element("central-publishing.autoPublish").text("false"))
216216
.child(element("central-publishing.skipPublishing").text("false"))
217217
// Other options for waitUntil: published, uploaded
218218
.child(element("central-publishing.waitUntil").text("validated"))

project-keeper/src/main/resources/templates/.github/workflows/ci-build-db-version-matrix.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,4 @@ jobs:
222222
uses: ./.github/workflows/release.yml
223223
with:
224224
started-from-ci: true
225+
maven-central-auto-publish: true

project-keeper/src/main/resources/templates/.github/workflows/ci-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,3 +213,4 @@ jobs:
213213
uses: ./.github/workflows/release.yml
214214
with:
215215
started-from-ci: true
216+
maven-central-auto-publish: true

project-keeper/src/main/resources/templates/.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
type: boolean
99
required: true
1010
default: false
11+
maven-central-auto-publish:
12+
description: "Automatically publish to Maven Central. Deactivate to manually publish at https://central.sonatype.com/publishing/deployments"
13+
required: true
14+
type: boolean
15+
default: true
1116
workflow_dispatch:
1217
inputs:
1318
skip-maven-central:

project-keeper/src/test/java/com/exasol/projectkeeper/validators/pom/PomFileGeneratorTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,16 @@ void testOmitTestExcludeTagsPropertyForNonRootPom() {
126126
assertThat(pom.getProperties().get("test.excludeTags"), nullValue());
127127
}
128128

129+
@Test
130+
void testAddPropertiesForMavenCentralDeployment() {
131+
final Model pom = runGeneration(List.of(ProjectKeeperModule.MAVEN_CENTRAL), null);
132+
assertAll(() -> assertThat(pom.getProperties().get("central-publishing.autoPublish"), equalTo("false")),
133+
() -> assertThat(pom.getProperties().get("central-publishing.skipPublishing"), equalTo("false")),
134+
() -> assertThat(pom.getProperties().get("central-publishing.waitUntil"), equalTo("validated")),
135+
() -> assertThat(pom.getProperties().get("central-publishing.deploymentName"),
136+
equalTo("Manual deployment of repo my-repo")));
137+
}
138+
129139
private Model runGeneration(final List<ProjectKeeperModule> modules, final ParentPomRef parentPomRef) {
130140
final String result = new PomFileGenerator().generatePomContent(modules, "com.example", "my-parent-pom",
131141
"1.0.0", parentPomRef, new RepoInfo(TEST_REPO_NAME, TEST_REPO_LICENSE));

shared-model-classes/pk_generated_parent.pom

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)