My Maven project gives me reporting.plugins.plugin.version warnings like these:
[WARNING] Some problems were encountered while building the effective model for com.example:test:jar:1.0-SNAPSHOT
[WARNING] 'reporting.plugins.plugin.version' for org.jacoco:jacoco-maven-plugin is missing. @ line 10, column 21
I'm aware that Maven 3 is stricter about plugin versions and that plugin version must be specified. I specified the version in pluginManagement:
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.2.201409121644</version>
</plugin>
</plugins>
</pluginManagement>
This works fine and without warnings when I use plugin in build/plugins
:
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
It doesn't work , however, in reporting/plugins
:
<reporting>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
</plugins>
</reporting>
My questions are: Is the scope of version specified in build/plugingManagement
limited only to within the <build>
tag? Can I fix the warning without duplicating the plugin version at two places?
Here is a full example generating the warning:
<?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.example</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<reporting>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
</plugins>
</reporting>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.2.201409121644</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
This seems to be a bug in older maven versions. Have a look at this bug ticket at apache.
. Try using Maven 3 and maven-site-plugin-3.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.