apache / apache/maven-archetypes

Maven Quickstart Archetype does not work with JUnit 6

Open
#128 1 comment 2 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
37
Forks
46
Avg merge
5h 44m
Merged PRs (30d)
1

Description

### Affected version

1.5

### Bug description

# TL;DR

When creating a new project based on the Maven Quickstart Archetype and setting the `junitVersion` to `6.0.1`, no JUnit dependencies are added to the POM.

# Steps to reproduce

## Create project that is supposed to use JUnit 5

```shell
❯ mvn archetype:generate \
-DarchetypeArtifactId=maven-archetype-quickstart \
-DarchetypeVersion=1.5 \
-DjavaCompilerVersion=21 \
-DjunitVersion=5.14.1 \
-DgroupId=issues \
-DartifactId=junit-version-5 \
-DinteractiveMode=false
```

## Create project that is supposed to use JUnit 6

```shell
❯ mvn archetype:generate \
-DarchetypeArtifactId=maven-archetype-quickstart \
-DarchetypeVersion=1.5 \
-DjavaCompilerVersion=21 \
-DjunitVersion=6.0.1 \
-DgroupId=issues \
-DartifactId=junit-version-6 \
-DinteractiveMode=false
```

## Examine differences

```shell
❯ diff -u -r junit-version-5 junit-version-6
```

```diff
diff -u -r junit-version-5/pom.xml junit-version-6/pom.xml
--- junit-version-5/pom.xml 2025-11-21 18:28:21
+++ junit-version-6/pom.xml 2025-11-21 18:28:45
@@ -4,10 +4,10 @@
4.0.0

issues
- junit-version-5
+ junit-version-6
1.0-SNAPSHOT

- junit-version-5
+ junit-version-6

http://www.example.com

@@ -16,31 +16,6 @@
21


-
-
-
- org.junit
- junit-bom
- 5.14.1
- pom
- import
-
-
-
-
-
-
- org.junit.jupiter
- junit-jupiter-api
- test
-
-
-
- org.junit.jupiter
- junit-jupiter-params
- test
-
-



```

# Additional details

## Maven version

```shell
❯ mvn -version
Apache Maven 3.9.11 (3e54c93a704957b63ee3494413a2b544fd3d825b)
Maven home: /opt/homebrew/Cellar/maven/3.9.11/libexec
Java version: 25.0.1, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-25.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "15.7.2", arch: "aarch64", family: "mac"
```

## Java version

```shell
❯ java -version
openjdk version "25.0.1" 2025-10-21 LTS
OpenJDK Runtime Environment Temurin-25.0.1+8 (build 25.0.1+8-LTS)
OpenJDK 64-Bit Server VM Temurin-25.0.1+8 (build 25.0.1+8-LTS, mixed mode, sharing)
```

## `MAVEN_OPTS`

```shell
❯ echo $MAVEN_OPTS
--sun-misc-unsafe-memory-access=allow
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the two provided mvn archetype:generate commands and comparing their generated pom.xml files. Trace how the Maven Quickstart Archetype handles junitVersion, then verify that using 6.0.1 retains the JUnit dependencies present for 5.14.1. The issue names no source file or test, so locate the relevant archetype template or generation test first.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.