Skip to content

Commit cf8b83e

Browse files
committed
add jakarta artifacts and CI drift-guard
1 parent d168477 commit cf8b83e

File tree

7 files changed

+142
-6
lines changed

7 files changed

+142
-6
lines changed

.github/workflows/maven-pulls.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ jobs:
2929
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
3030
restore-keys: |
3131
${{ runner.os }}-maven-
32+
- name: Check swagger-bom version matches root version
33+
run: |
34+
ROOT_VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
35+
BOM_VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec --file modules/swagger-bom/pom.xml)
36+
echo "Root version: ${ROOT_VERSION}"
37+
echo "BOM version: ${BOM_VERSION}"
38+
if [ "${ROOT_VERSION}" != "${BOM_VERSION}" ]; then
39+
echo "ERROR: swagger-bom version (${BOM_VERSION}) does not match root version (${ROOT_VERSION}). Update modules/swagger-bom/pom.xml."
40+
exit 1
41+
fi
3242
- name: Build with Maven and Gradle
3343
run: |
3444
./mvnw --no-transfer-progress -B install --file pom.xml

.github/workflows/maven.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ jobs:
2929
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
3030
restore-keys: |
3131
${{ runner.os }}-maven-
32+
- name: Check swagger-bom version matches root version
33+
run: |
34+
ROOT_VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
35+
BOM_VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec --file modules/swagger-bom/pom.xml)
36+
echo "Root version: ${ROOT_VERSION}"
37+
echo "BOM version: ${BOM_VERSION}"
38+
if [ "${ROOT_VERSION}" != "${BOM_VERSION}" ]; then
39+
echo "ERROR: swagger-bom version (${BOM_VERSION}) does not match root version (${ROOT_VERSION}). Update modules/swagger-bom/pom.xml."
40+
exit 1
41+
fi
3242
- name: Build with Maven and Gradle, Deploy snapshot to maven central
3343
run: |
3444
export MY_POM_VERSION=`./mvnw -q -Dexec.executable="echo" -Dexec.args='${projects.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Changelog
2+
3+
## 2.2.47-SNAPSHOT
4+
5+
### New Features
6+
7+
- **`swagger-bom`**: Added Maven Bill of Materials (BOM) module (`io.swagger.core.v3:swagger-bom`).
8+
The BOM manages **both** the `javax` artifact family and the Jakarta (`-jakarta` suffix) artifact family
9+
in a single import. Consumers can import the BOM once and omit explicit versions on all
10+
`io.swagger.core.v3` runtime dependencies.
11+
Covered artifacts: `swagger-annotations`, `swagger-models`, `swagger-core`, `swagger-integration`,
12+
`swagger-jaxrs2`, `swagger-jaxrs2-servlet-initializer`, `swagger-jaxrs2-servlet-initializer-v2`,
13+
`swagger-java17-support`, and their `-jakarta` counterparts.
14+
Build plugins are intentionally excluded from the BOM.
15+
16+
---
17+
18+
For earlier releases see the [GitHub Releases page](https://github.com/swagger-api/swagger-core/releases).

CI/post-release.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ python $CUR/CI/publishRelease.py "$SC_RELEASE_TAG"
2323
./mvnw versions:set -DnewVersion="${SC_NEXT_VERSION}-SNAPSHOT"
2424
./mvnw versions:commit
2525

26+
cd modules/swagger-bom
27+
../../mvnw versions:set -DnewVersion="${SC_NEXT_VERSION}-SNAPSHOT"
28+
../../mvnw versions:commit
29+
cd ../..
30+
2631
cd modules/swagger-project-jakarta
2732
../../mvnw versions:set -DnewVersion="${SC_NEXT_VERSION}-SNAPSHOT"
2833
../../mvnw versions:commit

CI/prepare-release.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ python $CUR/CI/releaseNotes.py "$SC_LAST_RELEASE" "$SC_RELEASE_TITLE" "$SC_RELEA
2525
./mvnw versions:set -DnewVersion=$SC_VERSION
2626
./mvnw versions:commit
2727

28+
cd modules/swagger-bom
29+
../../mvnw versions:set -DnewVersion=$SC_VERSION
30+
../../mvnw versions:commit
31+
cd ../..
32+
2833
cd modules/swagger-project-jakarta
2934
../../mvnw versions:set -DnewVersion=$SC_VERSION
3035
../../mvnw versions:commit

README.md

Lines changed: 57 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,16 @@ Of course if you don't want to build locally you can grab artifacts from maven c
158158

159159
### Maven BOM
160160

161-
To manage Swagger dependencies consistently across modules, import the Swagger Core BOM and omit versions on individual Swagger dependencies:
161+
The `swagger-bom` artifact is a Bill of Materials that manages **both** the `javax` and Jakarta (`-jakarta` suffix) artifact families.
162+
Import it once and omit versions on all individual Swagger dependencies.
163+
164+
> **Note:** Maven and Gradle build plugins (`swagger-maven-plugin`, `swagger-gradle-plugin`,
165+
> `swagger-eclipse-transformer-maven-plugin`) are intentionally **excluded** from the BOM.
166+
> Plugins are applied via `<build><plugins>` or `plugins {}`, not via `<dependencyManagement>`,
167+
> so including them in the BOM would be misleading and could conflict with the plugin
168+
> management section of a consumer's build.
169+
170+
#### Maven
162171

163172
```xml
164173
<dependencyManagement>
@@ -171,11 +180,11 @@ To manage Swagger dependencies consistently across modules, import the Swagger C
171180
<scope>import</scope>
172181
</dependency>
173182
</dependencies>
174-
175183
</dependencyManagement>
176184

177-
<!-- Then declare Swagger dependencies without versions -->
185+
<!-- Then declare Swagger dependencies without explicit versions -->
178186
<dependencies>
187+
<!-- javax artifacts -->
179188
<dependency>
180189
<groupId>io.swagger.core.v3</groupId>
181190
<artifactId>swagger-annotations</artifactId>
@@ -196,7 +205,6 @@ To manage Swagger dependencies consistently across modules, import the Swagger C
196205
<groupId>io.swagger.core.v3</groupId>
197206
<artifactId>swagger-jaxrs2</artifactId>
198207
</dependency>
199-
<!-- Optional servlet initializer helpers -->
200208
<dependency>
201209
<groupId>io.swagger.core.v3</groupId>
202210
<artifactId>swagger-jaxrs2-servlet-initializer</artifactId>
@@ -205,14 +213,58 @@ To manage Swagger dependencies consistently across modules, import the Swagger C
205213
<groupId>io.swagger.core.v3</groupId>
206214
<artifactId>swagger-jaxrs2-servlet-initializer-v2</artifactId>
207215
</dependency>
208-
<!-- Optional support for Java 17 module-path consumers -->
209216
<dependency>
210217
<groupId>io.swagger.core.v3</groupId>
211218
<artifactId>swagger-java17-support</artifactId>
212219
</dependency>
220+
<!-- Jakarta namespace artifacts (use instead of, or alongside, the javax ones above) -->
221+
<dependency>
222+
<groupId>io.swagger.core.v3</groupId>
223+
<artifactId>swagger-annotations-jakarta</artifactId>
224+
</dependency>
225+
<dependency>
226+
<groupId>io.swagger.core.v3</groupId>
227+
<artifactId>swagger-models-jakarta</artifactId>
228+
</dependency>
229+
<dependency>
230+
<groupId>io.swagger.core.v3</groupId>
231+
<artifactId>swagger-core-jakarta</artifactId>
232+
</dependency>
233+
<dependency>
234+
<groupId>io.swagger.core.v3</groupId>
235+
<artifactId>swagger-integration-jakarta</artifactId>
236+
</dependency>
237+
<dependency>
238+
<groupId>io.swagger.core.v3</groupId>
239+
<artifactId>swagger-jaxrs2-jakarta</artifactId>
240+
</dependency>
241+
<dependency>
242+
<groupId>io.swagger.core.v3</groupId>
243+
<artifactId>swagger-jaxrs2-servlet-initializer-jakarta</artifactId>
244+
</dependency>
245+
<dependency>
246+
<groupId>io.swagger.core.v3</groupId>
247+
<artifactId>swagger-jaxrs2-servlet-initializer-v2-jakarta</artifactId>
248+
</dependency>
213249
</dependencies>
214250
```
215251

252+
#### Gradle
253+
254+
```kotlin
255+
dependencies {
256+
implementation(platform("io.swagger.core.v3:swagger-bom:${swaggerOpenapiv3Version}"))
257+
258+
// javax artifacts — no version needed
259+
implementation("io.swagger.core.v3:swagger-annotations")
260+
implementation("io.swagger.core.v3:swagger-core")
261+
262+
// Jakarta namespace artifacts — no version needed
263+
implementation("io.swagger.core.v3:swagger-annotations-jakarta")
264+
implementation("io.swagger.core.v3:swagger-core-jakarta")
265+
}
266+
```
267+
216268
## Sample Apps
217269
The samples have moved to [a new repository](https://github.com/swagger-api/swagger-samples/tree/2.0) and contain various integrations and configurations.
218270

modules/swagger-bom/pom.xml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>io.swagger.core.v3</groupId>
66
<artifactId>swagger-bom</artifactId>
7-
<version>2.2.38-SNAPSHOT</version>
7+
<version>2.2.47-SNAPSHOT</version>
88
<packaging>pom</packaging>
99

1010
<name>swagger-bom</name>
@@ -68,6 +68,42 @@
6868
<artifactId>swagger-java17-support</artifactId>
6969
<version>${project.version}</version>
7070
</dependency>
71+
<!-- Jakarta namespace artifacts -->
72+
<dependency>
73+
<groupId>io.swagger.core.v3</groupId>
74+
<artifactId>swagger-annotations-jakarta</artifactId>
75+
<version>${project.version}</version>
76+
</dependency>
77+
<dependency>
78+
<groupId>io.swagger.core.v3</groupId>
79+
<artifactId>swagger-models-jakarta</artifactId>
80+
<version>${project.version}</version>
81+
</dependency>
82+
<dependency>
83+
<groupId>io.swagger.core.v3</groupId>
84+
<artifactId>swagger-core-jakarta</artifactId>
85+
<version>${project.version}</version>
86+
</dependency>
87+
<dependency>
88+
<groupId>io.swagger.core.v3</groupId>
89+
<artifactId>swagger-integration-jakarta</artifactId>
90+
<version>${project.version}</version>
91+
</dependency>
92+
<dependency>
93+
<groupId>io.swagger.core.v3</groupId>
94+
<artifactId>swagger-jaxrs2-jakarta</artifactId>
95+
<version>${project.version}</version>
96+
</dependency>
97+
<dependency>
98+
<groupId>io.swagger.core.v3</groupId>
99+
<artifactId>swagger-jaxrs2-servlet-initializer-jakarta</artifactId>
100+
<version>${project.version}</version>
101+
</dependency>
102+
<dependency>
103+
<groupId>io.swagger.core.v3</groupId>
104+
<artifactId>swagger-jaxrs2-servlet-initializer-v2-jakarta</artifactId>
105+
<version>${project.version}</version>
106+
</dependency>
71107
</dependencies>
72108
</dependencyManagement>
73109

0 commit comments

Comments
 (0)