2 years ago

#61541

test-img

Azu

mvn reports does not generate jacoco/surefire/findbugs reports

Initial question : "I'm a beginner in java programming and i'm a bit lost. I've issues with my current project. Indeed, I try to generate reports with the command mvn site but it seems that some reports are missing. I try to generate jacoco, surefire and findbugs report. How can I modify my build to generate these reports ? I link my pom.xml and the result. Thank you in advance for your help."

Thank you a lot for your answer. Ive modified my Pom following your advices. I still have issues. Here is my POM.xml. Thank you again for your help. Kind regards.

<?xml version="1.0" encoding="UTF-8"?>

4.0.0 com.parkit parking-system 1.0-SNAPSHOT jar

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

<url>D:/Workspace/parkingsystem/target/site/</url>


<dependencies>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>2.17.0</version>
    </dependency>
    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>3.22.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>2.17.0</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>8.0.25</version>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>5.8.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>5.8.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-junit-jupiter</artifactId>
        <version>4.2.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.7</version>
        <type>maven-plugin</type>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.maven/maven-plugin-api -->
    <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-plugin-api</artifactId>
        <version>3.8.4</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-math3</artifactId>
        <version>3.6.1</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <archive>
                            <manifest>
                                <mainClass>
                                    com.parkit.parkingsystem.App
                                </mainClass>
                            </manifest>
                        </archive>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <version>3.10.0</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.21.0</version>
            <executions>
                <execution>
                    <id>integration-test</id>
                    <goals>
                        <goal>test</goal>
                    </goals>
                    <phase>integration-test</phase>
                    <configuration>
                        <excludes>
                            <exclude>none</exclude>
                        </excludes>
                        <includes>
                            <include>**/*IT.java</include>
                        </includes>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.8.7</version>
            <executions>
                <execution>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <id>jacoco-report</id>
                    <phase>test</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
    [INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------< com.parkit:parking-system >----------------------
[INFO] Building parking-system 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-site-plugin:3.10.0:site (default-site) @ parking-system ---
[WARNING] Report plugin org.apache.maven.plugins:maven-project-info-reports-plugin has an empty version.
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[INFO] configuring report plugin org.apache.maven.plugins:maven-project-info-reports-plugin:3.1.2
[INFO] 15 reports detected for maven-project-info-reports-plugin:3.1.2: ci-management, dependencies, dependency-info, dependency-management, distribution-management, index, issue-management, licenses, mailing
-lists, modules, plugin-management, plugins, scm, summary, team
[INFO] Rendering site with default locale English (en)
[INFO] Relativizing decoration links with respect to localized project URL: D:/Workspace/parkingsystem/target/site/
[INFO] Rendering content with org.apache.maven.skins:maven-default-skin:jar:1.3 skin.
[INFO] Generating "Dependencies" report  --- maven-project-info-reports-plugin:3.1.2:dependencies
[INFO] Unable to create Maven project from repository for artifact 'org.apache.maven:maven-artifact-manager:jar:2.0.2', for more information run with -X
[INFO] Unable to create Maven project from repository for artifact 'org.apache.maven.wagon:wagon-provider-api:jar:1.0-alpha-6', for more information run with -X
[INFO] Unable to create Maven project from repository for artifact 'org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9', for more information run with -X
[INFO] Unable to create Maven project from repository for artifact 'org.apache.maven:maven-artifact-manager:jar:2.0.2', for more information run with -X
[INFO] Unable to create Maven project from repository for artifact 'org.apache.maven.wagon:wagon-provider-api:jar:1.0-alpha-6', for more information run with -X
[INFO] Unable to create Maven project from repository for artifact 'org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9', for more information run with -X
[INFO] Generating "Dependency Information" report --- maven-project-info-reports-plugin:3.1.2:dependency-info
[INFO] Generating "About" report         --- maven-project-info-reports-plugin:3.1.2:index
[INFO] Generating "Plugin Management" report --- maven-project-info-reports-plugin:3.1.2:plugin-management
[INFO] Generating "Plugins" report       --- maven-project-info-reports-plugin:3.1.2:plugins
[INFO] Generating "Summary" report       --- maven-project-info-reports-plugin:3.1.2:summary
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  7.094 s
[INFO] Finished at: 2022-01-18T11:57:00+01:00
[INFO] ------------------------------------------------------------------------

EXAMPLES OF ERRORS WHEN I RUN IN DEBUG MODE :

2 problems were encountered while building the effective model for org.codehaus.plexus:plexus-container-default:1.0-alpha-9 [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 13, column 15 [ERROR] 'distributionManagement.status' must not be specified. @ line 43, column 13

org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs: [ERROR] 'distributionManagement.status' must not be specified. @ line 43, column 13

java

maven

jacoco

maven-surefire-plugin

findbugs

0 Answers

Your Answer

Accepted video resources