Skip to content

Commit bdaa473

Browse files
committed
Fixed snapshot version error
1 parent a347bea commit bdaa473

11 files changed

Lines changed: 48 additions & 66 deletions

File tree

.github/workflows/publish-maven-central.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,19 @@ jobs:
2525
steps:
2626
- uses: actions/checkout@v4
2727

28+
- name: Resolve project version
29+
id: project_version
30+
run: |
31+
VERSION="$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)"
32+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
33+
if [[ "$VERSION" == *-SNAPSHOT ]]; then
34+
echo "publish=false" >> "$GITHUB_OUTPUT"
35+
else
36+
echo "publish=true" >> "$GITHUB_OUTPUT"
37+
fi
38+
2839
- name: Materialize GPG private key
40+
if: steps.project_version.outputs.publish == 'true'
2941
run: |
3042
rm -f /tmp/maven-signing-key.asc
3143
printf '%s' "$MAVEN_GPG_PRIVATE_KEY" > /tmp/maven-signing-key.raw
@@ -51,29 +63,28 @@ jobs:
5163
MAVEN_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
5264

5365
- name: Set up Java 11 and Maven server credentials
66+
if: steps.project_version.outputs.publish == 'true'
5467
uses: actions/setup-java@v4
5568
with:
5669
distribution: temurin
5770
java-version: '11'
5871
cache: maven
59-
server-id: nexus-staging
72+
server-id: central
6073
server-username: MAVEN_USERNAME
6174
server-password: MAVEN_PASSWORD
6275

6376
- name: Setup Codename One Build Client
77+
if: steps.project_version.outputs.publish == 'true'
6478
run: |
6579
mkdir -p "$HOME/.codenameone"
6680
curl -fsSL "https://github.com/codenameone/CodenameOne/raw/refs/heads/master/maven/CodeNameOneBuildClient.jar" \
6781
-o "$HOME/.codenameone/CodeNameOneBuildClient.jar"
6882
69-
- name: Verify version is a release version
83+
- name: Skip snapshot publish
84+
if: steps.project_version.outputs.publish != 'true'
7085
run: |
71-
VERSION="$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)"
72-
echo "Project version: $VERSION"
73-
if [[ "$VERSION" == *-SNAPSHOT ]]; then
74-
echo "Publishing to Maven Central requires a non-SNAPSHOT version."
75-
exit 1
76-
fi
86+
echo "Project version ${{ steps.project_version.outputs.version }} is a snapshot. Skipping Maven Central publish."
7787
7888
- name: Deploy to Sonatype / Maven Central
89+
if: steps.project_version.outputs.publish == 'true'
7990
run: mvn -B -Psign-artifacts -Dgpg.passphrase="$MAVEN_GPG_PASSPHRASE" -pl common,android,ios,javascript,javase,win,lib -am -DskipTests deploy

BTDemo/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
<parent>
55
<groupId>com.codename1</groupId>
66
<artifactId>cn1-bluetooth</artifactId>
7-
<version>1.0-SNAPSHOT</version>
7+
<version>1.0.0</version>
88
</parent>
99
<groupId>com.codename1.btle</groupId>
1010
<artifactId>BTDemo</artifactId>
11-
<version>1.0-SNAPSHOT</version>
11+
<version>1.0.0</version>
1212
<packaging>jar</packaging>
1313

1414
<name>BTDemo</name>

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@ Add the library dependency to your project `pom.xml`:
1515
<dependency>
1616
<groupId>com.codename1</groupId>
1717
<artifactId>cn1-bluetooth-lib</artifactId>
18-
<version>LATEST_RELEASE_VERSION</version>
18+
<version>1.0.0</version>
1919
<type>pom</type>
2020
</dependency>
2121
```
2222

23-
As of 2026-03-14, this artifact is not yet listed on Maven Central, so replace `LATEST_RELEASE_VERSION`
24-
with the first published release once it is available. This is the same dependency form used by the sample
25-
app in [BTDemo/pom.xml](BTDemo/pom.xml).
23+
This is the same dependency form used by the sample app in [BTDemo/pom.xml](BTDemo/pom.xml).
2624

2725
### Classic Codename One project using `.cn1lib`
2826

android/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
<parent>
55
<groupId>com.codename1</groupId>
66
<artifactId>cn1-bluetooth</artifactId>
7-
<version>1.0-SNAPSHOT</version>
7+
<version>1.0.0</version>
88
</parent>
99
<groupId>com.codename1</groupId>
1010
<artifactId>cn1-bluetooth-android</artifactId>
11-
<version>1.0-SNAPSHOT</version>
11+
<version>1.0.0</version>
1212

1313
<name>cn1-bluetooth-android</name>
1414
<build>

common/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
<parent>
55
<groupId>com.codename1</groupId>
66
<artifactId>cn1-bluetooth</artifactId>
7-
<version>1.0-SNAPSHOT</version>
7+
<version>1.0.0</version>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>
1010
<groupId>com.codename1</groupId>
1111
<artifactId>cn1-bluetooth-common</artifactId>
12-
<version>1.0-SNAPSHOT</version>
12+
<version>1.0.0</version>
1313
<packaging>jar</packaging>
1414
<properties>
1515
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

ios/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
<parent>
55
<groupId>com.codename1</groupId>
66
<artifactId>cn1-bluetooth</artifactId>
7-
<version>1.0-SNAPSHOT</version>
7+
<version>1.0.0</version>
88
</parent>
99
<groupId>com.codename1</groupId>
1010
<artifactId>cn1-bluetooth-ios</artifactId>
11-
<version>1.0-SNAPSHOT</version>
11+
<version>1.0.0</version>
1212

1313
<name>cn1-bluetooth-ios</name>
1414
<build>

javascript/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
<parent>
55
<groupId>com.codename1</groupId>
66
<artifactId>cn1-bluetooth</artifactId>
7-
<version>1.0-SNAPSHOT</version>
7+
<version>1.0.0</version>
88
</parent>
99
<groupId>com.codename1</groupId>
1010
<artifactId>cn1-bluetooth-javascript</artifactId>
11-
<version>1.0-SNAPSHOT</version>
11+
<version>1.0.0</version>
1212

1313
<name>cn1-bluetooth-javascript</name>
1414
<build>

javase/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
<parent>
55
<groupId>com.codename1</groupId>
66
<artifactId>cn1-bluetooth</artifactId>
7-
<version>1.0-SNAPSHOT</version>
7+
<version>1.0.0</version>
88
</parent>
99
<groupId>com.codename1</groupId>
1010
<artifactId>cn1-bluetooth-javase</artifactId>
11-
<version>1.0-SNAPSHOT</version>
11+
<version>1.0.0</version>
1212

1313
<name>cn1-bluetooth-javase</name>
1414

lib/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
<parent>
55
<groupId>com.codename1</groupId>
66
<artifactId>cn1-bluetooth</artifactId>
7-
<version>1.0-SNAPSHOT</version>
7+
<version>1.0.0</version>
88
</parent>
99
<groupId>com.codename1</groupId>
1010
<artifactId>cn1-bluetooth-lib</artifactId>
11-
<version>1.0-SNAPSHOT</version>
11+
<version>1.0.0</version>
1212
<packaging>pom</packaging>
1313
<name>cn1-bluetooth-lib</name>
1414

pom.xml

Lines changed: 11 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.codename1</groupId>
66
<artifactId>cn1-bluetooth</artifactId>
7-
<version>1.0-SNAPSHOT</version>
7+
<version>1.0.0</version>
88
<packaging>pom</packaging>
99

1010
<name>cn1-bluetooth</name>
@@ -44,14 +44,14 @@
4444
<java.version>1.8</java.version>
4545
<java-tests.version>11</java-tests.version>
4646
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
47+
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
4748
<maven.compiler.source>1.8</maven.compiler.source>
4849
<maven.compiler.target>1.8</maven.compiler.target>
4950
<cn1lib.name>cn1-bluetooth</cn1lib.name>
5051
<kotlin.version>1.3.72</kotlin.version>
5152
<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
5253
<kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
53-
<nexus.server.id>nexus-staging</nexus.server.id>
54-
<nexus.url>https://s01.oss.sonatype.org</nexus.url>
54+
<central.server.id>central</central.server.id>
5555
</properties>
5656
<modules>
5757
<module>common</module>
@@ -203,6 +203,7 @@
203203
<plugin>
204204
<groupId>org.apache.maven.plugins</groupId>
205205
<artifactId>maven-source-plugin</artifactId>
206+
<version>${maven-source-plugin.version}</version>
206207
<executions>
207208
<execution>
208209
<id>attach-sources</id>
@@ -213,14 +214,14 @@
213214
</executions>
214215
</plugin>
215216
<plugin>
216-
<groupId>org.sonatype.plugins</groupId>
217-
<artifactId>nexus-staging-maven-plugin</artifactId>
218-
<version>1.7.0</version>
217+
<groupId>org.sonatype.central</groupId>
218+
<artifactId>central-publishing-maven-plugin</artifactId>
219+
<version>0.9.0</version>
219220
<extensions>true</extensions>
220221
<configuration>
221-
<serverId>${nexus.server.id}</serverId>
222-
<nexusUrl>${nexus.url}</nexusUrl>
223-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
222+
<publishingServerId>${central.server.id}</publishingServerId>
223+
<autoPublish>true</autoPublish>
224+
<waitUntil>published</waitUntil>
224225
</configuration>
225226
</plugin>
226227
</plugins>
@@ -242,7 +243,7 @@
242243
</profiles>
243244
<servers>
244245
<server>
245-
<id>nexus-staging</id>
246+
<id>central</id>
246247
<username>YOUR_USERNAME</username>
247248
<password>YOUR_PASSWORD</password>
248249
</server>
@@ -279,18 +280,6 @@
279280
</build>
280281
</profile>
281282
</profiles>
282-
<distributionManagement>
283-
<repository>
284-
<id>${nexus.server.id}</id>
285-
<name>Nexus Release Repository</name>
286-
<url>${nexus.url}/service/local/staging/deploy/maven2/</url>
287-
</repository>
288-
<snapshotRepository>
289-
<id>${nexus.server.id}</id>
290-
<name>Nexus Snapshot Repository</name>
291-
<url>${nexus.url}/content/repositories/snapshots</url>
292-
</snapshotRepository>
293-
</distributionManagement>
294283
<repositories>
295284
<repository>
296285
<id>central</id>
@@ -301,21 +290,5 @@
301290
<enabled>false</enabled>
302291
</snapshots>
303292
</repository>
304-
<repository>
305-
<id>sonatype-snapshots</id>
306-
<name>Sonatype Snapshots</name>
307-
<url>${nexus.url}/content/repositories/snapshots</url>
308-
<snapshots>
309-
<enabled>true</enabled>
310-
</snapshots>
311-
</repository>
312-
<repository>
313-
<id>sonatype-staging</id>
314-
<name>Sonatype Staging</name>
315-
<url>${nexus.url}/content/repositories/staging</url>
316-
<snapshots>
317-
<enabled>false</enabled>
318-
</snapshots>
319-
</repository>
320293
</repositories>
321294
</project>

0 commit comments

Comments
 (0)