CodexBloom - Programming Q&A Platform

Maven scenarios to build with 'best practices for plugin org.apache.maven.plugins:maven-surefire-plugin' using Java 11

šŸ‘€ Views: 1 šŸ’¬ Answers: 1 šŸ“… Created: 2025-06-14
maven java plugins Java

I'm converting an old project and I've spent hours debugging this and I'm sure I'm missing something obvious here, but I've been banging my head against this for hours. After trying multiple solutions online, I still can't figure this out. I'm working on a project and hit a roadblock... I'm currently working with an scenario with my Maven project where the build fails with the behavior message: `want to resolve plugin org.apache.maven.plugins:maven-surefire-plugin`. This happens when I attempt to run `mvn clean install` on my project, which is supposed to use Java 11. I checked my `pom.xml` and it contains the following configuration for the Surefire plugin: ```xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>my-app</artifactId> <version>1.0-SNAPSHOT</version> <properties> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> </plugin> </plugins> </build> </project> ``` Despite this correct configuration, I keep getting the same behavior. I verified that I have access to the internet and I can reach the Maven Central repository. Running `mvn help:effective-pom` shows that the Surefire plugin is being recognized, but it still does not resolve during the build process. I also tried cleaning my local repository by running `mvn dependency:purge-local-repository` and then rebuilding, but that didn't help. As a last resort, I manually added the plugin repository in my `pom.xml` like this: ```xml <pluginRepositories> <pluginRepository> <id>central</id> <url>https://repo.maven.apache.org/maven2</url> </pluginRepository> </pluginRepositories> ``` However, this didn't change anything either. I’m using Maven version 3.8.1 and Java 11, and I would appreciate any guidance on resolving this plugin scenario. Could there be something wrong with my network settings or any proxy configurations I might be missing? This is part of a larger application I'm building. Is there a better approach? For context: I'm using Java on Ubuntu. How would you solve this? I'd really appreciate any guidance on this. Any feedback is welcome! I'm using Java stable in this project. Thanks in advance! My team is using Java for this CLI tool. Could someone point me to the right documentation?