DennisP
DennisP

Reputation: 23

'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing

Trying to get familiar with maven and taking an online course and am stuck .... appreciate any help provided.

I'm running the Site phase and although it completes and I'm able to actually view index.html in a browser I am getting a lot of errors along the way, specifically:

'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing

Have no idea why it's generating this error. As you can see below I have the version in both dependency and plugins. And I tried all I can find on sites. Why does it think the version is missing? Any ideas how to resolve? thanks in advance for any help!

<?xml version="1.0" encoding="UTF-8"?>
<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.dp</groupId>
    <artifactId>TestNG77</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>11</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
    </properties>

            <dependencies>
                <dependency>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-lang3</artifactId>
                    <version>3.8.1</version>
                </dependency>

                <dependency>
                    <groupId>org.testng</groupId>
                    <artifactId>testng</artifactId>
                    <version>7.0.0</version>
                    <scope>test</scope>
                </dependency>

                <dependency>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.2</version>
                </dependency>


                <dependency>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-report-plugin</artifactId>
                    <version>2.22.2</version>
                </dependency>

            </dependencies>

            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-surefire-plugin</artifactId>
                            <version>2.22.2</version>
                        </plugin>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-site-plugin</artifactId>
                            <version>3.7.1</version>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>

            <reporting>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-report-plugin</artifactId>
                        <version>2.22.2</version>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-project-info-reports-plugin</artifactId>
                        <version>3.0.0</version>
                    </plugin>
                </plugins>
            </reporting>

Upvotes: 2

Views: 15890

Answers (1)

Ramu
Ramu

Reputation: 681

Removing the following 2 dependencies from <dependencies> should fix all the errors. These 2 are maven plugins and not required in <dependencies> section.

When you include these 2 as dependencies, maven-project-info-reports-plugin is trying to generate dependency report for these 2 plugins and failing. Hence you are seeing those errors.

    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.2</version>
    </dependency>


    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <version>2.22.2</version>
    </dependency>

Upvotes: 1

Related Questions