Skip to content

Commit 31d427e

Browse files
authored
#1297: update maven SNAPSHOT handling (#1421)
1 parent 0e3f4b4 commit 31d427e

File tree

8 files changed

+38
-83
lines changed

8 files changed

+38
-83
lines changed

CHANGELOG.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Release with new features and bugfixes:
99
* https://github.com/devonfw/IDEasy/issues/1401[#1401]: Privacy option not working properly
1010
* https://github.com/devonfw/IDEasy/issues/1400[#1400]: ide --offline status does not replicate ide status behavior when offline
1111
* https://github.com/devonfw/IDEasy/issues/742[#742]: Produce constructive warning if git repo url is not sane
12+
* https://github.com/devonfw/IDEasy/issues/1297[#1297]: Migration from OSSRH to new Maven Central service
1213

1314
The full list of changes for this release can be found in https://github.com/devonfw/IDEasy/milestone/30?closed=1[milestone 2025.07.001].
1415

cli/src/main/java/com/devonfw/tools/ide/tool/IdeasyCommandlet.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public VersionIdentifier getConfiguredVersion() {
8484

8585
UpgradeMode upgradeMode = this.mode;
8686
if (upgradeMode == null) {
87-
if (IdeVersion.getVersionString().contains("SNAPSHOT")) {
87+
if (IdeVersion.isSnapshot()) {
8888
upgradeMode = UpgradeMode.SNAPSHOT;
8989
} else {
9090
if (IdeVersion.getVersionIdentifier().getDevelopmentPhase().isStable()) {
@@ -108,7 +108,7 @@ public boolean install(boolean silent) {
108108

109109
this.context.requireOnline("upgrade of IDEasy", true);
110110

111-
if (IdeVersion.isUndefined()) {
111+
if (IdeVersion.isUndefined() && !this.context.isForceMode()) {
112112
this.context.warning("You are using IDEasy version {} which indicates local development - skipping upgrade.", IdeVersion.getVersionString());
113113
return false;
114114
}
@@ -135,14 +135,17 @@ public VersionIdentifier getLatestVersion() {
135135
*/
136136
public boolean checkIfUpdateIsAvailable() {
137137
VersionIdentifier installedVersion = getInstalledVersion();
138+
this.context.success("Your version of IDEasy is {}.", installedVersion);
139+
if (IdeVersion.isSnapshot()) {
140+
this.context.warning("You are using a SNAPSHOT version of IDEasy. For stability consider switching to a stable release via 'ide upgrade --mode=stable'");
141+
}
138142
if (this.context.isOffline()) {
139-
this.context.success("Your version of IDEasy is {}.", installedVersion);
140143
this.context.warning("Skipping check for newer version of IDEasy because you are offline.");
141144
return false;
142145
}
143146
VersionIdentifier latestVersion = getLatestVersion();
144147
if (installedVersion.equals(latestVersion)) {
145-
this.context.success("Your version of IDEasy is {} which is the latest released version.", installedVersion);
148+
this.context.success("Your are using the latest version of IDEasy and no update is available.");
146149
return false;
147150
} else {
148151
this.context.interaction("Your version of IDEasy is {} but version {} is available. Please run the following command to upgrade to the latest version:\n"

cli/src/main/java/com/devonfw/tools/ide/tool/repository/MavenRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public final class MavenRepository extends AbstractToolRepository {
4747
public static final String MAVEN_CENTRAL = "https://repo1.maven.org/maven2";
4848

4949
/** Base URL for Maven Snapshots repository */
50-
public static final String MAVEN_SNAPSHOTS = "https://s01.oss.sonatype.org/content/repositories/snapshots";
50+
public static final String MAVEN_SNAPSHOTS = "https://central.sonatype.com/repository/maven-snapshots";
5151

5252
/** The {@link #getId() repository ID}. */
5353
public static final String ID = "maven";

cli/src/main/java/com/devonfw/tools/ide/version/IdeVersion.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,11 @@ public static boolean isUndefined() {
6161
return VERSION_UNDEFINED.equals(INSTANCE.version);
6262
}
6363

64+
/**
65+
* @return {@code true} if the {@link #getVersionString() current version} is a {@code SNAPSHOT} version, {@code false} otherwise.
66+
*/
67+
public static boolean isSnapshot() {
68+
return getVersionString().contains("SNAPSHOT");
69+
}
70+
6471
}

cli/src/test/java/com/devonfw/tools/ide/tool/mvn/MvnArtifactTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void testIdeasyCliSnapshot() {
5959
"com/devonfw/tools/IDEasy/ide-cli/2025.01.003-beta-SNAPSHOT/ide-cli-2025.01.003-beta-20250130.023001-3-windows-x64.tar.gz");
6060
assertThat(artifact).hasToString("com.devonfw.tools.IDEasy:ide-cli:2025.01.003-beta-20250130.023001-3:tar.gz:windows-x64");
6161
assertThat(artifact.getDownloadUrl()).isEqualTo(
62-
"https://s01.oss.sonatype.org/content/repositories/snapshots/com/devonfw/tools/IDEasy/ide-cli/2025.01.003-beta-SNAPSHOT/ide-cli-2025.01.003-beta-20250130.023001-3-windows-x64.tar.gz");
62+
"https://central.sonatype.com/repository/maven-snapshots/com/devonfw/tools/IDEasy/ide-cli/2025.01.003-beta-SNAPSHOT/ide-cli-2025.01.003-beta-20250130.023001-3-windows-x64.tar.gz");
6363
assertThat(artifact.getKey()).isEqualTo(artifact.toString());
6464
assertThat(artifact).isEqualTo(equal);
6565
assertThat(artifact.hashCode()).isEqualTo(equal.hashCode());
@@ -118,7 +118,7 @@ public void testMetadataWithSnapshot() {
118118
assertThat(artifact).hasToString("org.apache.maven.plugins:maven-clean-plugin:*-SNAPSHOT:xml");
119119
assertThat(artifact.getKey()).isEqualTo(artifact.toString());
120120
assertThat(artifact.getDownloadUrl()).isEqualTo(
121-
"https://s01.oss.sonatype.org/content/repositories/snapshots/org/apache/maven/plugins/maven-clean-plugin/maven-metadata.xml");
121+
"https://central.sonatype.com/repository/maven-snapshots/org/apache/maven/plugins/maven-clean-plugin/maven-metadata.xml");
122122
assertThat(artifact).isEqualTo(equal);
123123
assertThat(artifact.hashCode()).isEqualTo(equal.hashCode());
124124
}

cli/src/test/java/com/devonfw/tools/ide/tool/repository/MavenRepositoryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ void testGetMetadataWithSnapshot() {
193193

194194
// assert
195195
assertThat(metadata.getUrls()).containsExactly(
196-
"https://s01.oss.sonatype.org/content/repositories/snapshots/com/devonfw/tools/IDEasy/ide-cli/2025.01.001-beta-SNAPSHOT/ide-cli-2025.01.001-beta-20250121.023134-9-"
196+
"https://central.sonatype.com/repository/maven-snapshots/com/devonfw/tools/IDEasy/ide-cli/2025.01.001-beta-SNAPSHOT/ide-cli-2025.01.001-beta-20250121.023134-9-"
197197
+ os + "-" + arch + ".tar.gz");
198198
assertThat(metadata.getTool()).isEqualTo(tool);
199199
assertThat(metadata.getEdition()).isEqualTo(edition);

cli/src/test/resources/ide-projects/upgrade-settings/project/settings/devon/conf/.m2/settings.xml

Lines changed: 8 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4,84 +4,23 @@
44
To change it edit conf/ide.properties -->
55
<localRepository>${env.M2_REPO}</localRepository>
66

7-
<!--
8-
ATTENTION:
9-
Never ever hardcode passwords as plain text!!!
10-
Instead simply use variables in angled brackets prefixed with dollar sign.
11-
Then devonfw-ide will automatically promt for these variables, encrypt their value and fill it into the placeholder.
12-
In case you want to do it manually follow this guide:
13-
https://maven.apache.org/guides/mini/guide-encryption.html
14-
devonfw-ide already generates settings-security.xml for you
15-
so all you need to do is call:
16-
mvn -ep
17-
hit return and then type your password (do not supply as argument as otherwise it will be saved to the history of your shell)
18-
Then copy the encrypted password as according password to this settings.xml
19-
-->
20-
<servers>
21-
<server>
22-
<id>repository</id>
23-
<username>${env.USERNAME}</username>
24-
<password>$[mavenRepoPassword]</password>
25-
</server>
26-
</servers>
27-
28-
<!--
29-
<mirrors>
30-
<mirror>
31-
<id>nexus.central</id>
32-
<mirrorOf>central</mirrorOf>
33-
<name>central-mirror</name>
34-
<url>https://my-production-line.s2-eu.capgemini.com/nexus3/repository/public</url>
35-
</mirror>
36-
</mirrors>
37-
-->
7+
<servers>
8+
<server>
9+
<id>repository</id>
10+
<username>${env.USERNAME}</username>
11+
<password>$[mavenRepoPassword]</password>
12+
</server>
13+
</servers>
3814

3915
<profiles>
4016
<profile>
4117
<id>devonfw-ide</id>
4218
<activation>
43-
<activeByDefault>true</activeByDefault>
19+
<activeByDefault>true</activeByDefault>
4420
</activation>
4521
<properties>
46-
<!--
4722
<sonar.host.url>http://localhost:9000/</sonar.host.url>
48-
<sonar.login>${USER}</sonar.login>
49-
<sonar.password>TODO</sonar.password>
50-
<jarsigner.storepass>TODO</jarsigner.storepass>
51-
<jarsigner.keystore>/projects/myproject/workspaces/main/keystore.p12</jarsigner.keystore>
52-
<gpg.keyname>your.email@address.com</gpg.keyname>
53-
-->
5423
</properties>
5524
</profile>
56-
<profile>
57-
<!-- https://github.com/devonfw/devon4j/blob/master/documentation/guide-testing-snapshots.asciidoc -->
58-
<id>devonfw-snapshots</id>
59-
<activation>
60-
<!--<activeByDefault>true</activeByDefault>-->
61-
<activeByDefault>false</activeByDefault>
62-
</activation>
63-
<repositories>
64-
<repository>
65-
<id>devonfw-snapshots</id>
66-
<name>devonfw SNAPSHOT releases</name>
67-
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
68-
<releases>
69-
<enabled>false</enabled>
70-
<updatePolicy>never</updatePolicy>
71-
<checksumPolicy>fail</checksumPolicy>
72-
</releases>
73-
<snapshots>
74-
<enabled>true</enabled>
75-
<updatePolicy>never</updatePolicy>
76-
<checksumPolicy>fail</checksumPolicy>
77-
</snapshots>
78-
</repository>
79-
</repositories>
80-
</profile>
8125
</profiles>
82-
<activeProfiles>
83-
<!--
84-
<activeProfile>my-profile</activeProfile>
85-
-->
86-
</activeProfiles>
8726
</settings>

documentation/setup.adoc

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,18 @@ You have to delete this folder manually as we do not want to be responsible for
6868

6969
== Testing SNAPSHOT releases
7070

71-
You can find the latest IDEasy SNAPSHOT releases https://s01.oss.sonatype.org/content/repositories/snapshots/com/devonfw/tools/IDEasy/ide-cli/[here].
71+
Whenever a story in `IDEasy` is completed by merging a https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests[PR], our https://github.com/features/actions[github actions] will build a new SNAPSHOT release and on success deploy it to maven central portal.
72+
In order to install and test the latest SNAPSHOT version use the following command:
7273

73-
Whenever a story in `IDEasy` is completed by merging a https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests[PR], our https://github.com/features/actions[github actions] will build a new SNAPSHOT release and on success deploy it to nexus on OSSRH.
74-
Simply choose the latest SNAPSHOT version folder and then inside that version folder the `*.tar.gz` file for the latest version and your target platform.
75-
Please open the download link in a new tab to make the download start properly.
76-
77-
Once downloaded, you can proceed as with official releases (see xref:install[install]).
74+
```
75+
ide upgrade --mode=snapshot
76+
```
7877

7978
If you test the latest SNAPSHOT please also give feedback to bug or feature tickets to let us know if things are working or not.
8079
Thanks for your testing, support and help to make IDEasy better!
80+
81+
NOTE: After you completed your test or the next official release has been shipped please do not forget to switch back to the stable release channel.
82+
83+
```
84+
ide upgrade --mode=stable
85+
```

0 commit comments

Comments
 (0)