Skip to content

Migrate build to Maven/Java 25, upgrade JOGL 2.6, Jackson 2.x, JUnit 5 - #287

Open
BadRumplestiltskin wants to merge 4 commits into
NASAWorldWind:developfrom
BadRumplestiltskin:master
Open

Migrate build to Maven/Java 25, upgrade JOGL 2.6, Jackson 2.x, JUnit 5#287
BadRumplestiltskin wants to merge 4 commits into
NASAWorldWind:developfrom
BadRumplestiltskin:master

Conversation

@BadRumplestiltskin

Copy link
Copy Markdown

Summary

This PR modernises the WorldWind Java build infrastructure and runtime dependencies to support Java 25, replacing the legacy Ant build and vendored libraries with a clean Maven build.

What changed

Build system

  • Replace Ant build.xml with pom.xml (Maven 3.x, Java 25 release flag)
  • Flat source layout preserved (src/, test/) via <sourceDirectory> / <testSourceDirectory>
  • Non-Java resources under src/ included in the output JAR automatically
  • testFunctional/ added as a second test-source root (compiled but excluded from Surefire)
  • MIL-STD-2525 SVG → PNG rasterisation moved into a rasterize-milstd2525 Maven profile (replaces Batik 1.7 Ant target; now uses Batik 1.17 via maven-antrun-plugin)

JOGL / GlueGen — 2.4.0-rc → 2.6.0

  • Resolved via Maven Central (org.jogamp.jogl:jogl-all, org.jogamp.gluegen:gluegen-rt)
  • Bundled JOGL JARs and native JARs removed from the repo
  • --add-opens flags required by JOGL on Java 17+ added to maven-surefire-plugin and exec-maven-plugin

Jackson — vendored 1.x source → 2.18.2

  • Removed src/org/codehaus/jackson/ (vendored Jackson 1.x, ca. 2009)
  • Added com.fasterxml.jackson.core:jackson-core:2.18.2 dependency
  • Updated BasicJSONEventParserContext and JSONDoc: getCurrentName()currentName(), createJsonParser()createParser()

JUnit 4 → JUnit 5 (Jupiter 5.11.4)

  • All 49 test files migrated: annotations, assert argument order (JUnit 5 puts message last), parameterised tests
  • @RunWith(Parameterized.class) + constructor pattern replaced with @ParameterizedTest @MethodSource in KMLExportTest and ShapeAttributesTest
  • Private assertEquals helpers in layer tests renamed to assertIterablesEqual to avoid shadowing the static import
  • maven-surefire-plugin 3.5.2 auto-discovers Jupiter tests; no explicit @RunWith needed

CI/CD

  • .github/workflows/ci.yml — push/PR builds on Java 25 with Xvfb for JOGL headless display
  • .github/workflows/release.yml — tag-triggered release: compile → test → package → Javadoc → GitHub Release

Test quality (simplify pass)

  • KMLExportTest: attribute setup moved to @BeforeAll; data() is now a pure data provider
  • ShapeAttributesTest.testRestoreNullDocument: try/catch/failassertThrows
  • Layer tests (Annotation, Icon, Renderable): 14 try/catch/fail patterns → assertThrows; malicious-getter e.printStackTrace()ignored with comment
  • ZebraInputHandler: added missing @Overrides, iterator → enhanced for-each
  • AbstractSceneController: diamond operator on two generic constructors

Test plan

  • mvn compile succeeds on Java 25
  • mvn test passes all 49 migrated test files (headless; run with xvfb-run on Linux)
  • mvn -Prasterize-milstd2525 generate-resources produces PNG files in target/milstd2525/png/
  • mvn exec:exec -Dexec.mainClass=gov.nasa.worldwindx.examples.ApplicationTemplate launches the globe

Notes

  • GDAL and VPF-symbols JARs remain as system-scope dependencies (TODO §10 in MIGRATION_JAVA25.md — needs native library rebuild against Java 25)
  • WebView JNI native libraries not yet recompiled for Java 25 (TODO §9)

🤖 Generated with Claude Code

Beak-man and others added 3 commits June 3, 2022 15:49
Comprehensive Java 25 migration and tech-debt reduction across the full
project. All changes verified via `mvn compile` and `mvn test-compile`
with zero errors.

- Add pom.xml: Maven 3 build replacing Ant; Java 25 compiler release;
  maven-surefire-plugin 3.5.2, exec-maven-plugin 3.4.1,
  build-helper-maven-plugin 3.6.0, maven-jar-plugin 3.4.2
- Add rasterize-milstd2525 Maven profile (antrun + batik-all:1.17)
  replacing the bundled Batik 1.7 JARs
- Update run-demo.bash / run-demo.bat to launch via `mvn exec:exec`

- Add .github/workflows/ci.yml: Temurin 25, `mvn compile` + `xvfb-run
  mvn test`, Surefire report upload on failure
- Add .github/workflows/release.yml: tag-triggered; builds JAR +
  Javadoc zip; publishes via softprops/action-gh-release@v2
- Archive .travis.yml → .travis.yml.archived

- Remove 8 bundled JOGL 2.4-rc / GlueGen JARs (total ~4.4 MB)
- JOGL 2.6.0 and GlueGen 2.6.0 now resolved via Maven Central;
  required --add-opens flags declared in pom.xml surefire/exec config

- Replace OS-specific reflection branches (com.apple.eio.FileManager,
  Runtime.exec) with java.awt.Desktop.browse()

- Replace removed sun.arch.data.model property with os.arch checks
  (x86, i386, i686) for 32-bit architecture detection

- Remove 75 vendored Jackson 1.x source files under src/org/codehaus/
- Add com.fasterxml.jackson.core:jackson-core:2.18.2 Maven dependency
- Migrate 5 WWJ source files: org.codehaus.jackson.* →
  com.fasterxml.jackson.core.*; factory.createJsonParser() →
  factory.createParser(); parser.getCurrentName() → parser.currentName()
- Update LICENSE.jackson.txt to reference FasterXML 2.18.2

- Remove lib-external/batik/ (Batik 1.7+r608262 + Ant 1.6.5, ~7.7 MB)
- SVG→PNG rasterisation now runs via the new rasterize-milstd2525 Maven
  profile at release time (no compile-time dependency)

- Replace junit:junit:4.13.2 with org.junit.jupiter:junit-jupiter:5.11.4
  (aggregator: API + engine + params; Surefire 3.5.2 auto-discovers)
- Migrate all 49 test files:
  · @RunWith(JUnit4.class) removed (47 files)
  · @RunWith(Parameterized.class) → @ParameterizedTest @MethodSource
    (KMLExportTest, ShapeAttributesTest — constructors removed, data()
    returns Stream<List<Exportable>> / Stream<Arguments>)
  · @Before/@after → @BeforeEach/@AfterEach (8 files)
  · @ignore@disabled (4 files)
  · @test(expected=…) → assertThrows() (KMLExportTest)
  · All org.junit.Assert/org.junit.* imports → org.junit.jupiter.api.*
  · 1,688 assert argument-order fixes (JUnit 4 message-first →
    JUnit 5 message-last) across 35 files
  · Private assertEquals(Iterable<T>…) helpers renamed
    assertIterablesEqual in 3 layer test files to prevent name-shadowing

- Add MIGRATION_JAVA25.md: complete migration guide + tech-debt register
  (TD-01 through TD-11) with priority scores and completion status

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CI/CD (ci.yml, release.yml):
- Remove redundant single-entry matrix in ci.yml; use literal '25' throughout
- Collapse three separate Maven invocations in release.yml (test → package →
  javadoc) into one: `mvn verify javadoc:javadoc`, eliminating two full
  compile cycles and two JVM startups

Test quality (KMLExportTest, ShapeAttributesTest, layer tests):
- KMLExportTest: extract attribute setup into @BeforeAll so data() is a pure
  data provider with no setup side-effects; remove @SuppressWarnings("unused")
- ShapeAttributesTest.testRestoreNullDocument: replace broken try/catch/fail
  with assertThrows(IllegalArgumentException.class, ...)
- AnnotationLayerTest, IconLayerTest, RenderableLayerTest: replace 14
  try/catch/fail patterns with assertThrows; replace `e.printStackTrace()`
  in malicious-getter tests with `ignored` + explanatory comment

Source modernisation (ZebraInputHandler, AbstractSceneController):
- Add missing @OverRide annotations; convert iterator while-loop to enhanced
  for-each; use diamond operator on generic constructors

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
注册 for free to join this conversation on GitHub. Already have an account? 登录 to comment

标签

None yet

Development

Successfully merging this pull request may close these issues.

2 participants