This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-site.git
commit 51bd0d4a4b12523fe588f5aeef1ad3cf0f339bcb Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Mon Nov 2 08:00:46 2026 +0000 Drop the remaining JUnit 3 and 4 references from the examples The Ant comparison runs the tests with <junitlauncher>, which needs the JUnit Platform; the <junit> task only runs JUnit 3 and 4 tests. The missing-dependency example is Maven 3.10.0 output. --- content/markdown/guides/getting-started/index.md | 2 +- content/markdown/guides/mini/guide-assemblies.md | 2 +- content/markdown/pom.md | 6 ++-- content/markdown/run-maven/index.md | 36 +++++++----------------- content/markdown/tools/mvnval.md | 8 +++--- content/resources/ant/build-a3.xml | 2 +- content/resources/ant/build-a4.xml | 24 ++++++++-------- 7 files changed, 33 insertions(+), 47 deletions(-) diff --git a/content/markdown/guides/getting-started/index.md b/content/markdown/guides/getting-started/index.md index 2a30f655..935664d5 100644 --- a/content/markdown/guides/getting-started/index.md +++ b/content/markdown/guides/getting-started/index.md @@ -1032,7 +1032,7 @@ How does this work? Firstly, the parent POM created (called `app`), has a packag Next, we tell the WAR that it requires the `my-app` JAR. This does a few things: it makes it available on the classpath to any code in the WAR (none in this case), it makes sure the JAR is always built before the WAR, and it indicates to the WAR plugin to include the JAR in its library directory. -You may have noticed that `junit-4.11.jar` was a dependency, but didn't end up in the WAR. The reason for this is the `<scope>test</scope>` element - it is only required for testing, and so is not included in the web application as the compile time dependency `my-app` is. +You may have noticed that `junit-jupiter-5.11.0.jar` was a dependency, but didn't end up in the WAR. The reason for this is the `<scope>test</scope>` element - it is only required for testing, and so is not included in the web application as the compile time dependency `my-app` is. The final step was to include a parent definition. This ensures that the POM can always be located even if the project is distributed separately from its parent by looking it up in the repository. diff --git a/content/markdown/guides/mini/guide-assemblies.md b/content/markdown/guides/mini/guide-assemblies.md index 5a960423..43d2ce05 100644 --- a/content/markdown/guides/mini/guide-assemblies.md +++ b/content/markdown/guides/mini/guide-assemblies.md @@ -126,7 +126,7 @@ How to use such pre-defined assembly descriptors is described in the [documentat <unpack>true</unpack> <scope>runtime</scope> <excludes> - <exclude>junit:junit</exclude> + <exclude>org.junit.jupiter:junit-jupiter</exclude> <exclude>commons-lang:commons-lang</exclude> <exclude>commons-logging:commons-logging</exclude> <exclude>commons-cli:commons-cli</exclude> diff --git a/content/markdown/pom.md b/content/markdown/pom.md index 30b323aa..677dd645 100644 --- a/content/markdown/pom.md +++ b/content/markdown/pom.md @@ -113,7 +113,7 @@ This marks a specific place in a repository, acting like a coordinate system for * `<groupId>`: This is generally unique amongst an organization or a project. For example, all core Maven artifacts do (well, should) live under the groupId `org.apache.maven`. Group ID's do not - necessarily use the dot notation, for example, the junit project. Note that the dot-notated + necessarily use the dot notation, for example, the commons-io project (groupId `commons-io`). Note that the dot-notated groupId does not have to correspond to the package structure that the project contains. It is, however, a good practice to follow. When stored within a repository, the group acts much like the Java packaging structure does in an operating system. The dots are replaced by OS specific directory @@ -132,8 +132,8 @@ This marks a specific place in a repository, acting like a coordinate system for * `<version>`: This is the last piece of the naming puzzle. `groupId:artifactId` denotes a single project, but - it does not indicate which incarnation of that project we are talking about. Do we want the `junit:junit` - of 2018 (version 4.12), or of 2007 (version 3.8.2)? In short: code changes, those changes + it does not indicate which incarnation of that project we are talking about. Do we want the `commons-io:commons-io` + of 2026 (version 2.22.0), or of 2008 (version 1.4)? In short: code changes, those changes should be versioned, and this element keeps those versions in line. It is also used within an artifact's repository to separate versions from each other. `my-project` version 1.0 files live in the directory structure `$M2_REPO/org/codehaus/mojo/my-project/1.0`. diff --git a/content/markdown/run-maven/index.md b/content/markdown/run-maven/index.md index 96d20ce9..8c6d80b7 100644 --- a/content/markdown/run-maven/index.md +++ b/content/markdown/run-maven/index.md @@ -47,37 +47,21 @@ The following are some common problems when building with Maven, and how to reso A missing dependency presents with an error like the following: ``` -[INFO] Failed to resolve artifact. - -Missing: - ---------- -1) jnuit:junit:jar:3.8.1 - - Try downloading the file manually from the project website. - - Then, install it using the command: - mvn install:install-file -DgroupId=jnuit -DartifactId=junit \ - -Dversion=3.8.1 -Dpackaging=jar -Dfile=/path/to/file - - Path to dependency: - 1) org.apache.maven:maven:pom:2.1-SNAPSHOT - 2) jnuit:junit:jar:3.8.1 - - ---------- -1 required artifact is missing. - -for artifact: - org.apache.maven:maven:pom:2.1-SNAPSHOT - -from the specified remote repositories: - central (https://repo.maven.apache.org/maven2) +[WARNING] The POM for org.junit.jupitr:junit-jupiter:jar:5.11.0 is missing, no dependency information available +[INFO] ------------------------------------------------------------------------ +[ERROR] BUILD FAILURE +[INFO] ------------------------------------------------------------------------ +... +[ERROR] Failed to execute goal on project my-app: Could not resolve dependencies for project com.mycompany.app:my-app:jar:1.0-SNAPSHOT +[ERROR] dependency: org.junit.jupitr:junit-jupiter:jar:5.11.0 (test) +[ERROR] Could not find artifact org.junit.jupitr:junit-jupiter:jar:5.11.0 in central (https://repo.maven.apache.org/maven2) ``` To resolve this issue, it depends on what the dependency is and why it is missing. -The most common cause is because it can not be redistributed from the repository and must be manually installed using the instructions given in the message. +The most common cause is because it can not be redistributed from the repository and must be installed manually with `mvn install:install-file`. This is most common with some older JARs from Sun (usually `javax.*` group IDs), and is further documented in the [Guide to Coping with Sun JARs](../guides/mini/guide-coping-with-sun-jars.html). -You can check the list of repositories at the end of the error to ensure that the expected ones are listed - it may be that the project requires an alternative repository that has not been declared properly or is not accessible with your Maven configuration. +You can check the repositories named in the error to ensure that the expected ones are listed - it may be that the project requires an alternative repository that has not been declared properly or is not accessible with your Maven configuration. In other cases, it may be an incorrectly declared dependency (like the typo in the example above) which the project would need to fix, like a compilation error. diff --git a/content/markdown/tools/mvnval.md b/content/markdown/tools/mvnval.md index 904d3d4a..95e1e0ca 100644 --- a/content/markdown/tools/mvnval.md +++ b/content/markdown/tools/mvnval.md @@ -90,11 +90,11 @@ By default `mvnval` writes human-readable text output with XML context lines aro ``` pom.xml: ERROR 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: - junit:junit:jar -> version 4.13.2 vs 4.12 @ line 12, column 5 + org.junit.jupiter:junit-jupiter:jar -> version 5.11.0 vs 5.10.0 @ line 12, column 5 10 | <dependency> - 11 | <groupId>junit</groupId> - > 12 | <artifactId>junit</artifactId> - 13 | <version>4.12</version> + 11 | <groupId>org.junit.jupiter</groupId> + > 12 | <artifactId>junit-jupiter</artifactId> + 13 | <version>5.10.0</version> 14 | </dependency> ``` diff --git a/content/resources/ant/build-a3.xml b/content/resources/ant/build-a3.xml index 0ecef233..68386f1d 100644 --- a/content/resources/ant/build-a3.xml +++ b/content/resources/ant/build-a3.xml @@ -38,7 +38,7 @@ under the License. </src> <classpath> <fileset dir="${libdir}"> - <include name="/path/to/junit-3.8.1.jar"/> + <include name="/path/to/junit-jupiter-api-5.11.0.jar"/> </fileset> </classpath> </javac> diff --git a/content/resources/ant/build-a4.xml b/content/resources/ant/build-a4.xml index e517b6e9..f3774145 100644 --- a/content/resources/ant/build-a4.xml +++ b/content/resources/ant/build-a4.xml @@ -38,7 +38,7 @@ under the License. </src> <classpath> <fileset dir="${libdir}"> - <include name="/path/to/junit-3.8.1.jar"/> + <include name="/path/to/junit-jupiter-api-5.11.0.jar"/> </fileset> </classpath> </javac> @@ -46,19 +46,21 @@ under the License. <target name="jar" description="o Create the jar" depends="compile"> <jar jarfile="target/${final.name.api}.jar"/> </target> - <target name="test" depends="test:compile" description="Run all acceptance tests and unit tests"> + <target name="test" depends="test-compile" description="Run all acceptance tests and unit tests"> <mkdir dir="${test.reports.dir}"/> - <junit printsummary="no" fork="yes" forkmode="once" haltonfailure="${junit.haltonfailure}" includeantruntime="true"> - <sysproperty key="java.awt.headless" value="true"/> + <junitlauncher printsummary="true" haltonfailure="${junit.haltonfailure}"> <classpath refid="classpath"/> - <formatter type="brief" usefile="no"/> - <formatter type="xml"/> - <batchtest todir="${test.reports.dir}"> - <fileset dir="src/test/java"> - <include name="${test.src.includes}"/> + <testclasses outputdir="${test.reports.dir}"> + <fileset dir="${test.classesdir}"> + <include name="**/*Test.class"/> </fileset> - </batchtest> - </junit> + <fork> + <sysproperty key="java.awt.headless" value="true"/> + </fork> + <listener type="legacy-brief" sendSysOut="true"/> + <listener type="legacy-xml" sendSysErr="true" sendSysOut="true"/> + </testclasses> + </junitlauncher> <junitreport todir="${test.reports.dir}"> <fileset dir="${test.reports.dir}"> <include name="TEST-*.xml"/>
