Skip to content

Commit 5e18586

Browse files
authored
feat: upgrade bamboo to version 12
* feat: upgrade bamboo to version 12.1.3 * feat: changed to 12.0.0 version * chore: update shaded dependency version and jenkinsfile * chore: use atlassian-sdk compatible maven-shade-plugin version for jenkins * fix: ehcache dependency issue * fix: ehcache fix
1 parent 01d9ce2 commit 5e18586

6 files changed

Lines changed: 247 additions & 88 deletions

File tree

Jenkinsfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ pipeline {
2020
}
2121
}
2222

23+
// Build the local shaded Jersey module first so the root plugin can resolve com.codedx:jersey-shaded
24+
sh 'cd jersey-shaded && atlas-mvn install -DskipTests'
2325
sh 'atlas-unit-test'
2426
sh 'atlas-package'
2527
}

jersey-shaded/pom.xml

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77
<groupId>com.codedx</groupId>
88
<artifactId>jersey-shaded</artifactId>
9-
<version>2.0.1</version>
9+
<version>3.0.0</version>
1010
<packaging>jar</packaging>
1111
<name>Jersey 3.x Shaded (relocated to com.codedx.shaded.*)</name>
1212
<description>
@@ -91,7 +91,7 @@
9191
<plugin>
9292
<groupId>org.apache.maven.plugins</groupId>
9393
<artifactId>maven-shade-plugin</artifactId>
94-
<version>3.5.3</version>
94+
<version>3.2.4</version>
9595
<executions>
9696
<execution>
9797
<phase>package</phase>
@@ -168,6 +168,39 @@
168168
<exclude>META-INF/MANIFEST.MF</exclude>
169169
</excludes>
170170
</filter>
171+
<!-- Exclude jakarta.inject, jakarta.activation, and jakarta.xml.bind
172+
from the shaded JAR. These are provided by Bamboo's webapp
173+
classloader (parent-first). Including them in the shaded JAR
174+
causes AMPS to extract them into the plugin bundle root, creating
175+
a classloader split-brain with Bamboo's own copies and resulting
176+
in ClassCastException at runtime. -->
177+
<filter>
178+
<artifact>jakarta.inject:jakarta.inject-api</artifact>
179+
<excludes>
180+
<exclude>**</exclude>
181+
</excludes>
182+
</filter>
183+
<filter>
184+
<artifact>jakarta.activation:jakarta.activation-api</artifact>
185+
<excludes>
186+
<exclude>**</exclude>
187+
</excludes>
188+
</filter>
189+
<filter>
190+
<artifact>jakarta.xml.bind:jakarta.xml.bind-api</artifact>
191+
<excludes>
192+
<exclude>**</exclude>
193+
</excludes>
194+
</filter>
195+
<!-- Exclude javassist — it is a transitive dep of HK2 but is
196+
provided by Bamboo's webapp classloader. Excluding it prevents
197+
AMPS from extracting javassist/ classes into the plugin bundle root. -->
198+
<filter>
199+
<artifact>org.javassist:javassist</artifact>
200+
<excludes>
201+
<exclude>**</exclude>
202+
</excludes>
203+
</filter>
171204
</filters>
172205
<!-- ServicesResourceTransformer rewrites META-INF/services entries
173206
to use the relocated class names -->

pom.xml

Lines changed: 119 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<modelVersion>4.0.0</modelVersion>
88
<groupId>com.codedx</groupId>
99
<artifactId>codedx-bamboo-plugin</artifactId>
10-
<version>2.0.1</version>
10+
<version>3.0.0</version>
1111

1212
<organization>
1313
<name>Code Dx</name>
@@ -19,10 +19,9 @@
1919
<packaging>atlassian-plugin</packaging>
2020

2121
<properties>
22-
<!-- note: change to 9.0.0 for local development with `atlas-run` etc., prior versions have a broken UI -->
23-
<bamboo.version>10.2.0</bamboo.version>
22+
<bamboo.version>12.0.0</bamboo.version>
2423
<bamboo.data.version>${bamboo.version}</bamboo.data.version>
25-
<amps.version>9.11.6</amps.version>
24+
<amps.version>9.12.1</amps.version>
2625
<plugin.testrunner.version>2.0.2</plugin.testrunner.version>
2726
<atlassian.spring.scanner.version>6.0.2</atlassian.spring.scanner.version>
2827
<jersey-version>3.1.11</jersey-version>
@@ -57,7 +56,7 @@
5756
<dependency>
5857
<groupId>com.codedx</groupId>
5958
<artifactId>jersey-shaded</artifactId>
60-
<version>2.0.1</version>
59+
<version>3.0.0</version>
6160
<exclusions>
6261
<exclusion>
6362
<groupId>org.glassfish.jersey.core</groupId>
@@ -155,15 +154,16 @@
155154
</dependency>
156155

157156
<!--
158-
jakarta.ws.rs-api is provided by Bamboo (JAX-RS 2.x), but we need JAX-RS 3.1
159-
(jakarta.* namespace). Include it as compile scope so it gets embedded.
160-
The shaded JAR already contains it, but we also need it on the compile classpath
161-
for our source code that uses jakarta.ws.rs.* directly.
157+
jakarta.ws.rs-api: needed on the compile classpath (ApiClient.java uses jakarta.ws.rs.*).
158+
Bamboo 12.x provides jakarta.ws.rs 3.1.0 parent-first via its webapp classloader,
159+
so this must be 'provided' — embedding it causes AMPS to extract jakarta.ws.rs.*
160+
classes into the plugin bundle root, creating a classloader split-brain.
162161
-->
163162
<dependency>
164163
<groupId>jakarta.ws.rs</groupId>
165164
<artifactId>jakarta.ws.rs-api</artifactId>
166165
<version>3.1.0</version>
166+
<scope>provided</scope>
167167
</dependency>
168168

169169
<dependency>
@@ -210,6 +210,16 @@
210210
<groupId>org.glassfish.hk2</groupId>
211211
<artifactId>osgi-resource-locator</artifactId>
212212
</exclusion>
213+
<!--
214+
net.sf.ehcache:ehcache:2.10.9.4.10 is an Atlassian-patched version that
215+
does not exist in Maven Central and is not reliably available in
216+
atlassian-public. Since atlassian-bamboo-web is 'provided', Bamboo
217+
supplies ehcache at runtime — we do not need to resolve it here.
218+
-->
219+
<exclusion>
220+
<groupId>net.sf.ehcache</groupId>
221+
<artifactId>ehcache</artifactId>
222+
</exclusion>
213223
</exclusions>
214224
</dependency>
215225

@@ -251,11 +261,47 @@
251261
<groupId>com.fasterxml.jackson.module</groupId>
252262
<artifactId>jackson-module-jakarta-xmlbind-annotations</artifactId>
253263
<version>${jackson-version}</version>
264+
<exclusions>
265+
<!--
266+
jakarta.xml.bind-api and jakarta.activation-api are transitive compile-scope
267+
deps of this module. Bamboo 12.x provides these parent-first, so we must
268+
exclude them here to prevent AMPS from copying their classes into the bundle root.
269+
-->
270+
<exclusion>
271+
<groupId>jakarta.xml.bind</groupId>
272+
<artifactId>jakarta.xml.bind-api</artifactId>
273+
</exclusion>
274+
<exclusion>
275+
<groupId>jakarta.activation</groupId>
276+
<artifactId>jakarta.activation-api</artifactId>
277+
</exclusion>
278+
<exclusion>
279+
<groupId>com.sun.activation</groupId>
280+
<artifactId>jakarta.activation</artifactId>
281+
</exclusion>
282+
<exclusion>
283+
<groupId>javax.xml.bind</groupId>
284+
<artifactId>jaxb-api</artifactId>
285+
</exclusion>
286+
<exclusion>
287+
<groupId>com.sun.istack</groupId>
288+
<artifactId>istack-commons-runtime</artifactId>
289+
</exclusion>
290+
<exclusion>
291+
<groupId>com.sun.xml.fastinfoset</groupId>
292+
<artifactId>FastInfoset</artifactId>
293+
</exclusion>
294+
<exclusion>
295+
<groupId>org.glassfish.jaxb</groupId>
296+
<artifactId>jaxb-runtime</artifactId>
297+
</exclusion>
298+
</exclusions>
254299
</dependency>
255300
<dependency>
256301
<groupId>jakarta.annotation</groupId>
257302
<artifactId>jakarta.annotation-api</artifactId>
258303
<version>${jakarta-annotation-version}</version>
304+
<scope>provided</scope>
259305
</dependency>
260306

261307
<!-- Note: Required by Swagger-generated API client impl. for Basic Auth, but basic auth is not used here -->
@@ -267,6 +313,69 @@
267313

268314
</dependencies>
269315

316+
<dependencyManagement>
317+
<dependencies>
318+
<!--
319+
Override old org.glassfish.jaxb:jaxb-runtime versions that have broken POMs
320+
referencing defunct http://maven.java.net/ repositories. These old versions
321+
appear in dependency management of Bamboo's transitive deps and cause Maven
322+
to fail POM resolution. Overriding with a modern version avoids the issue.
323+
-->
324+
<dependency>
325+
<groupId>org.glassfish.jaxb</groupId>
326+
<artifactId>jaxb-runtime</artifactId>
327+
<version>4.0.5</version>
328+
<scope>provided</scope>
329+
</dependency>
330+
<dependency>
331+
<groupId>javax.xml.bind</groupId>
332+
<artifactId>jaxb-api</artifactId>
333+
<version>2.3.1</version>
334+
<scope>provided</scope>
335+
</dependency>
336+
<dependency>
337+
<groupId>com.sun.istack</groupId>
338+
<artifactId>istack-commons-runtime</artifactId>
339+
<version>4.1.2</version>
340+
<scope>provided</scope>
341+
</dependency>
342+
<dependency>
343+
<groupId>com.sun.xml.fastinfoset</groupId>
344+
<artifactId>FastInfoset</artifactId>
345+
<version>2.1.1</version>
346+
<scope>provided</scope>
347+
</dependency>
348+
<!--
349+
Force jakarta.* packages that Bamboo 12.x provides parent-first to 'provided'
350+
scope so AMPS never copies their classes into the plugin bundle root.
351+
-->
352+
<dependency>
353+
<groupId>jakarta.xml.bind</groupId>
354+
<artifactId>jakarta.xml.bind-api</artifactId>
355+
<version>3.0.1</version>
356+
<scope>provided</scope>
357+
</dependency>
358+
<dependency>
359+
<groupId>jakarta.activation</groupId>
360+
<artifactId>jakarta.activation-api</artifactId>
361+
<version>2.1.0</version>
362+
<scope>provided</scope>
363+
</dependency>
364+
<dependency>
365+
<groupId>com.sun.activation</groupId>
366+
<artifactId>jakarta.activation</artifactId>
367+
<version>2.0.1</version>
368+
<scope>provided</scope>
369+
</dependency>
370+
<dependency>
371+
<groupId>jakarta.inject</groupId>
372+
<artifactId>jakarta.inject-api</artifactId>
373+
<version>2.0.1</version>
374+
<scope>provided</scope>
375+
</dependency>
376+
</dependencies>
377+
</dependencyManagement>
378+
270379
<build>
271380
<plugins>
272381
<plugin>
@@ -298,18 +407,14 @@
298407
!jdk.internal*,
299408
!sun.misc*,
300409
!javassist*,
301-
!jakarta.inject*,
302-
!jakarta.annotation*,
303410
!org.aopalliance*,
304-
!jakarta.validation*,
305411
!com.opensymphony*,
412+
jakarta.*;resolution:=optional,
306413
*;resolution:=optional
307414
</Import-Package>
308415
<DynamicImport-Package></DynamicImport-Package>
309416
<Embed-Dependency>
310417
jersey-shaded,
311-
jakarta.ws.rs-api,
312-
jakarta.annotation-api,
313418
jackson-core,
314419
jackson-annotations,
315420
jackson-databind,

src/main/java/com/codedx/plugins/bamboo/ProjectRefresherServlet.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
import org.apache.log4j.Logger;
99

1010
import javax.net.ssl.SSLHandshakeException;
11-
import javax.servlet.ServletException;
12-
import javax.servlet.http.HttpServlet;
13-
import javax.servlet.http.HttpServletRequest;
14-
import javax.servlet.http.HttpServletResponse;
11+
import jakarta.servlet.ServletException;
12+
import jakarta.servlet.http.HttpServlet;
13+
import jakarta.servlet.http.HttpServletRequest;
14+
import jakarta.servlet.http.HttpServletResponse;
1515
import java.io.IOException;
1616
import java.net.ConnectException;
1717
import java.net.UnknownHostException;

src/main/java/com/codedx/plugins/bamboo/ServerConfigServlet.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
import org.apache.log4j.Logger;
44

5-
import javax.servlet.ServletException;
6-
import javax.servlet.http.HttpServlet;
7-
import javax.servlet.http.HttpServletRequest;
8-
import javax.servlet.http.HttpServletResponse;
5+
import jakarta.servlet.ServletException;
6+
import jakarta.servlet.http.HttpServlet;
7+
import jakarta.servlet.http.HttpServletRequest;
8+
import jakarta.servlet.http.HttpServletResponse;
99
import java.io.IOException;
1010
import java.io.InputStream;
1111
import java.io.PrintWriter;
@@ -20,6 +20,13 @@ public class ServerConfigServlet extends HttpServlet {
2020

2121
private static final Logger log = Logger.getLogger(ServerConfigServlet.class);
2222

23+
private static final String SAVED_BANNER_HTML =
24+
"<div id=\"codedx-saved-banner\" class=\"codedx-success-banner\">" +
25+
" <i class=\"fas fa-check-circle\"></i>" +
26+
" <span>Configuration saved successfully.</span>" +
27+
" <button class=\"close-btn\" onclick=\"document.getElementById('codedx-saved-banner').style.display='none'\">&times;</button>" +
28+
"</div>";
29+
2330
@Override
2431
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
2532
throws ServletException, IOException {
@@ -33,11 +40,15 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
3340
String atlToken = req.getParameter("atl_token");
3441
if (atlToken == null) atlToken = "";
3542

43+
boolean saved = "true".equals(req.getParameter("saved"));
44+
String savedBanner = saved ? SAVED_BANNER_HTML : "";
45+
3646
String html = loadTemplate();
3747
html = html.replace("${url}", escapeHtml(url));
3848
html = html.replace("${apiKey}", escapeHtml(apiKey));
3949
html = html.replace("${fingerprint}", escapeHtml(fingerprint));
4050
html = html.replace("${atl_token}", escapeHtml(atlToken));
51+
html = html.replace("${savedBanner}", savedBanner);
4152

4253
resp.setContentType("text/html;charset=UTF-8");
4354
PrintWriter out = resp.getWriter();
@@ -60,8 +71,8 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp)
6071

6172
log.info("Configuration saved successfully");
6273

63-
// Redirect back to GET to show the saved values (PRG pattern)
64-
resp.sendRedirect(req.getRequestURI());
74+
// PRG pattern: redirect back to GET with saved=true to show success banner
75+
resp.sendRedirect(req.getRequestURI() + "?saved=true");
6576
}
6677

6778
private String loadTemplate() throws IOException {

0 commit comments

Comments
 (0)