[MCHECKSTYLE-417] Upgrade Maven Reporting API to 3.1.1/Maven Reporting Impl to 3.2.0
This plugin hasn't been touched testwise for a very long time. The testing
approach from MPIR has been applied to accommodate M-R-Impl 3.2.0 and future
versions of it. The negative effect is that the parameter 'encoding'
has duplicated 'inputEncoding' from AbstractMavenReport for a long time.
For the sake of consistency it has been replaced with 'inputEncoding' which
breaks backward compatibility. Users are advised to use
${project.build.sourceEncoding} anyway.
This also upgrades for ITs:
* Maven Site Plugin to 3.12.1
* Maven JXR Plugin to 3.3.0
This closes #87
diff --git a/pom.xml b/pom.xml
index ae15401..910c8b6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,4 +1,4 @@
-<?xml version='1.0' encoding='UTF-8'?>
+<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -64,11 +64,13 @@
<properties>
<javaVersion>8</javaVersion>
+ <aetherVersion>1.0.0.v20140518</aetherVersion>
<mavenVersion>3.2.5</mavenVersion>
<checkstyleVersion>9.3</checkstyleVersion>
<doxiaVersion>1.11.1</doxiaVersion>
- <sitePluginVersion>3.9.1</sitePluginVersion>
- <surefire.version>2.22.2</surefire.version>
+ <doxiaSitetoolsVersion>1.11.1</doxiaSitetoolsVersion>
+ <sitePluginVersion>3.12.1</sitePluginVersion>
+ <jxrPluginVersion>3.3.0</jxrPluginVersion>
<project.build.outputTimestamp>2021-01-23T22:30:12Z</project.build.outputTimestamp>
</properties>
@@ -119,32 +121,30 @@
<!-- shared -->
<dependency>
<groupId>org.apache.maven.reporting</groupId>
+ <artifactId>maven-reporting-api</artifactId>
+ <version>3.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
- <version>3.1.0</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
+ <version>3.2.0</version>
</dependency>
<!-- doxia -->
<dependency>
<groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-site-renderer</artifactId>
+ <artifactId>doxia-sink-api</artifactId>
<version>${doxiaVersion}</version>
- <exclusions>
- <exclusion>
- <artifactId>plexus-container-default</artifactId>
- <groupId>org.codehaus.plexus</groupId>
- </exclusion>
- </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.doxia</groupId>
+ <artifactId>doxia-core</artifactId>
+ <version>${doxiaVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-integration-tools</artifactId>
- <version>${doxiaVersion}</version>
+ <version>${doxiaSitetoolsVersion}</version>
</dependency>
<!-- plexus -->
@@ -170,11 +170,6 @@
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-interpolation</artifactId>
- <version>1.26</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-velocity</artifactId>
<version>1.2</version>
<exclusions>
@@ -209,16 +204,64 @@
<!-- test -->
<dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-container-default</artifactId>
+ <version>2.1.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.7.36</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<version>3.3.0</version>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-container-default</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-api</artifactId>
+ <version>${aetherVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-impl</artifactId>
+ <version>${aetherVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-connector-basic</artifactId>
+ <version>${aetherVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-transport-wagon</artifactId>
+ <version>${aetherVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-http-lightweight</artifactId>
+ <version>3.5.1</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
@@ -335,6 +378,7 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<configuration>
<goals>
@@ -376,7 +420,7 @@
</plugins>
</reporting>
</profile>
-
+
<profile>
<id>jdk9</id>
<activation>
diff --git a/src/it/MCHECKSTYLE-129/pom.xml b/src/it/MCHECKSTYLE-129/pom.xml
index 33079a3..7d3f51b 100644
--- a/src/it/MCHECKSTYLE-129/pom.xml
+++ b/src/it/MCHECKSTYLE-129/pom.xml
@@ -25,9 +25,6 @@
<version>1.0-SNAPSHOT</version>
<name>checkstyle-new</name>
<url>http://maven.apache.org</url>
- <properties>
- <checkstyleVersion>@pom.version@</checkstyleVersion>
- </properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -46,16 +43,16 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyleVersion}</version>
- </plugin>
+ <version>@project.version@</version>
+ </plugin>
</plugins>
- </build>
+ </build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyleVersion}</version>
+ <version>@project.version@</version>
<configuration>
<configLocation>https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-8.28/src/main/resources/sun_checks.xml</configLocation>
</configuration>
diff --git a/src/it/MCHECKSTYLE-131/pom.xml b/src/it/MCHECKSTYLE-131/pom.xml
index 0e0409d..5420962 100644
--- a/src/it/MCHECKSTYLE-131/pom.xml
+++ b/src/it/MCHECKSTYLE-131/pom.xml
@@ -43,11 +43,11 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
</configuration>
</plugin>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
diff --git a/src/it/MCHECKSTYLE-137/pom.xml b/src/it/MCHECKSTYLE-137/pom.xml
index 7050b4d..c30b6fc 100644
--- a/src/it/MCHECKSTYLE-137/pom.xml
+++ b/src/it/MCHECKSTYLE-137/pom.xml
@@ -37,17 +37,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
- <configuration>
- <encoding>UTF-8</encoding>
- </configuration>
+ <version>@project.version@</version>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<configuration>
<configLocation>checkstyle.xml</configLocation>
- <encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
diff --git a/src/it/MCHECKSTYLE-169/pom.xml b/src/it/MCHECKSTYLE-169/pom.xml
index abfa9e7..d1da462 100644
--- a/src/it/MCHECKSTYLE-169/pom.xml
+++ b/src/it/MCHECKSTYLE-169/pom.xml
@@ -31,7 +31,6 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <checkstyleVersion>@project.version@</checkstyleVersion>
</properties>
<build>
@@ -41,7 +40,7 @@
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyleVersion}</version>
+ <version>@project.version@</version>
</plugin>
<plugin>
<inherited>true</inherited>
diff --git a/src/it/MCHECKSTYLE-172/pom.xml b/src/it/MCHECKSTYLE-172/pom.xml
index e29f7c6..8a8a2bb 100644
--- a/src/it/MCHECKSTYLE-172/pom.xml
+++ b/src/it/MCHECKSTYLE-172/pom.xml
@@ -40,13 +40,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>@sitePluginVersion@</version>
- </plugin>
+ </plugin>
</plugins>
</build>
<reporting>
@@ -55,7 +55,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
</plugin>
</plugins>
</reporting>
diff --git a/src/it/MCHECKSTYLE-173-with-charset/pom.xml b/src/it/MCHECKSTYLE-173-with-charset/pom.xml
index fefa985..b336688 100644
--- a/src/it/MCHECKSTYLE-173-with-charset/pom.xml
+++ b/src/it/MCHECKSTYLE-173-with-charset/pom.xml
@@ -47,7 +47,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<configuration>
<configLocation>checkstyle-with-charset.xml</configLocation>
</configuration>
diff --git a/src/it/MCHECKSTYLE-173-without-charset/pom.xml b/src/it/MCHECKSTYLE-173-without-charset/pom.xml
index eaf6c58..7a042ac 100644
--- a/src/it/MCHECKSTYLE-173-without-charset/pom.xml
+++ b/src/it/MCHECKSTYLE-173-without-charset/pom.xml
@@ -47,7 +47,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<configuration>
<configLocation>checkstyle-without-charset.xml</configLocation>
</configuration>
diff --git a/src/it/MCHECKSTYLE-193/pom.xml b/src/it/MCHECKSTYLE-193/pom.xml
index 0b93fbb..37cce0c 100644
--- a/src/it/MCHECKSTYLE-193/pom.xml
+++ b/src/it/MCHECKSTYLE-193/pom.xml
@@ -37,13 +37,11 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<configuration>
- <encoding>UTF-8</encoding>
- <configLocation>checkstyle.xml</configLocation>
- <encoding>UTF-8</encoding>
- <consoleOutput>true</consoleOutput>
- <failsOnError>true</failsOnError>
+ <configLocation>checkstyle.xml</configLocation>
+ <consoleOutput>true</consoleOutput>
+ <failsOnError>true</failsOnError>
</configuration>
<executions>
<execution>
diff --git a/src/it/MCHECKSTYLE-219-no-license_failure/pom.xml b/src/it/MCHECKSTYLE-219-no-license_failure/pom.xml
index fc38b6c..b2cd411 100644
--- a/src/it/MCHECKSTYLE-219-no-license_failure/pom.xml
+++ b/src/it/MCHECKSTYLE-219-no-license_failure/pom.xml
@@ -40,7 +40,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<executions>
<execution>
<id>check</id>
diff --git a/src/it/MCHECKSTYLE-219-no-license_success/pom.xml b/src/it/MCHECKSTYLE-219-no-license_success/pom.xml
index 5159d79..2cf51cc 100644
--- a/src/it/MCHECKSTYLE-219-no-license_success/pom.xml
+++ b/src/it/MCHECKSTYLE-219-no-license_success/pom.xml
@@ -40,7 +40,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<executions>
<execution>
<id>check</id>
diff --git a/src/it/MCHECKSTYLE-222-no-resources/pom.xml b/src/it/MCHECKSTYLE-222-no-resources/pom.xml
index 1b6e463..b4541e6 100644
--- a/src/it/MCHECKSTYLE-222-no-resources/pom.xml
+++ b/src/it/MCHECKSTYLE-222-no-resources/pom.xml
@@ -31,7 +31,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
</plugin>
</plugins>
</build>
@@ -42,7 +42,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<reportSets>
<reportSet>
<reports>
diff --git a/src/it/MCHECKSTYLE-222-resources/pom.xml b/src/it/MCHECKSTYLE-222-resources/pom.xml
index c8f486b..3263bad 100644
--- a/src/it/MCHECKSTYLE-222-resources/pom.xml
+++ b/src/it/MCHECKSTYLE-222-resources/pom.xml
@@ -31,7 +31,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
</plugin>
</plugins>
</build>
@@ -42,7 +42,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<reportSets>
<reportSet>
<reports>
diff --git a/src/it/MCHECKSTYLE-222-testResources/pom.xml b/src/it/MCHECKSTYLE-222-testResources/pom.xml
index 0da4318..e002236 100644
--- a/src/it/MCHECKSTYLE-222-testResources/pom.xml
+++ b/src/it/MCHECKSTYLE-222-testResources/pom.xml
@@ -31,7 +31,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
</plugin>
</plugins>
</build>
@@ -42,7 +42,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<reportSets>
<reportSet>
<reports>
diff --git a/src/it/MCHECKSTYLE-224/pom.xml b/src/it/MCHECKSTYLE-224/pom.xml
index fc57262..9812548 100644
--- a/src/it/MCHECKSTYLE-224/pom.xml
+++ b/src/it/MCHECKSTYLE-224/pom.xml
@@ -39,7 +39,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
- <version>2.4</version>
+ <version>@jxrPluginVersion@</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/src/it/MCHECKSTYLE-225-LICENSE.txt/core/pom.xml b/src/it/MCHECKSTYLE-225-LICENSE.txt/core/pom.xml
index 189c2b5..ab68edc 100644
--- a/src/it/MCHECKSTYLE-225-LICENSE.txt/core/pom.xml
+++ b/src/it/MCHECKSTYLE-225-LICENSE.txt/core/pom.xml
@@ -1,58 +1,58 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-
-<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/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.apache.maven.plugins.checkstyle</groupId>
- <artifactId>mcheckstyle-225-core</artifactId>
- <version>1.0-SNAPSHOT</version>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>mcheckstyle-225-build-tools</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- <executions>
- <execution>
- <id>check</id>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.checkstyle</groupId>
+ <artifactId>mcheckstyle-225-core</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>@project.version@</version>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>mcheckstyle-225-build-tools</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>check</id>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/it/MCHECKSTYLE-225-customHeader/core/pom.xml b/src/it/MCHECKSTYLE-225-customHeader/core/pom.xml
index f342d3a..4ea2316 100644
--- a/src/it/MCHECKSTYLE-225-customHeader/core/pom.xml
+++ b/src/it/MCHECKSTYLE-225-customHeader/core/pom.xml
@@ -36,7 +36,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
diff --git a/src/it/MCHECKSTYLE-225-pluginManagement/core/pom.xml b/src/it/MCHECKSTYLE-225-pluginManagement/core/pom.xml
index 4544068..7fe3666 100644
--- a/src/it/MCHECKSTYLE-225-pluginManagement/core/pom.xml
+++ b/src/it/MCHECKSTYLE-225-pluginManagement/core/pom.xml
@@ -1,57 +1,57 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-
-<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/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.maven.plugins.checkstyle</groupId>
- <artifactId>mcheckstyle-225</artifactId>
- <version>1.0-SNAPSHOT</version>
- </parent>
- <artifactId>mcheckstyle-225-core</artifactId>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
- <executions>
- <execution>
- <id>check</id>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <headerLocation>test/custom-header.txt</headerLocation>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.plugins.checkstyle</groupId>
+ <artifactId>mcheckstyle-225</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>mcheckstyle-225-core</artifactId>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <id>check</id>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <headerLocation>test/custom-header.txt</headerLocation>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/it/MCHECKSTYLE-225-pluginManagement/pom.xml b/src/it/MCHECKSTYLE-225-pluginManagement/pom.xml
index 12b0bdf..f61ae9e 100644
--- a/src/it/MCHECKSTYLE-225-pluginManagement/pom.xml
+++ b/src/it/MCHECKSTYLE-225-pluginManagement/pom.xml
@@ -1,46 +1,46 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more
- contributor license agreements. See the NOTICE file ~ distributed with this
- work for additional information ~ regarding copyright ownership. The ASF
- licenses this file ~ to you under the Apache License, Version 2.0 (the ~
- "License"); you may not use this file except in compliance ~ with the License.
- You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0
- ~ ~ Unless required by applicable law or agreed to in writing, ~ software
- distributed under the License is distributed on an ~ "AS IS" BASIS, WITHOUT
- WARRANTIES OR CONDITIONS OF ANY ~ KIND, either express or implied. See the
- License for the ~ specific language governing permissions and limitations
- ~ under the License. -->
-
-<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/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.apache.maven.plugins.checkstyle</groupId>
- <artifactId>mcheckstyle-225</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>pom</packaging>
-
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>mcheckstyle-225-build-tools</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
- <modules>
- <module>build-tools</module>
- <module>core</module>
- </modules>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more
+ contributor license agreements. See the NOTICE file ~ distributed with this
+ work for additional information ~ regarding copyright ownership. The ASF
+ licenses this file ~ to you under the Apache License, Version 2.0 (the ~
+ "License"); you may not use this file except in compliance ~ with the License.
+ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~ ~ Unless required by applicable law or agreed to in writing, ~ software
+ distributed under the License is distributed on an ~ "AS IS" BASIS, WITHOUT
+ WARRANTIES OR CONDITIONS OF ANY ~ KIND, either express or implied. See the
+ License for the ~ specific language governing permissions and limitations
+ ~ under the License. -->
+
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.checkstyle</groupId>
+ <artifactId>mcheckstyle-225</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>@project.version@</version>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>mcheckstyle-225-build-tools</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <modules>
+ <module>build-tools</module>
+ <module>core</module>
+ </modules>
+</project>
diff --git a/src/it/MCHECKSTYLE-268/pom.xml b/src/it/MCHECKSTYLE-268/pom.xml
index 8a152b3..4af529b 100644
--- a/src/it/MCHECKSTYLE-268/pom.xml
+++ b/src/it/MCHECKSTYLE-268/pom.xml
@@ -34,7 +34,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<executions>
<execution>
<id>check</id>
diff --git a/src/it/MCHECKSTYLE-332_cache-checker/pom.xml b/src/it/MCHECKSTYLE-332_cache-checker/pom.xml
index 388aaa8..2e4713f 100644
--- a/src/it/MCHECKSTYLE-332_cache-checker/pom.xml
+++ b/src/it/MCHECKSTYLE-332_cache-checker/pom.xml
@@ -41,7 +41,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
</plugin>
</plugins>
</build>
diff --git a/src/it/MCHECKSTYLE-337/pom.xml b/src/it/MCHECKSTYLE-337/pom.xml
index 3dbbf1a..29ffd16 100644
--- a/src/it/MCHECKSTYLE-337/pom.xml
+++ b/src/it/MCHECKSTYLE-337/pom.xml
@@ -40,7 +40,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<executions>
<execution>
<id>check</id>
diff --git a/src/it/MCHECKSTYLE-338/pom.xml b/src/it/MCHECKSTYLE-338/pom.xml
index dcfc979..3ecd7f0 100644
--- a/src/it/MCHECKSTYLE-338/pom.xml
+++ b/src/it/MCHECKSTYLE-338/pom.xml
@@ -33,7 +33,7 @@
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
</configuration>
diff --git a/src/it/MCHECKSTYLE-347/pom.xml b/src/it/MCHECKSTYLE-347/pom.xml
index 445012a..6f1237a 100644
--- a/src/it/MCHECKSTYLE-347/pom.xml
+++ b/src/it/MCHECKSTYLE-347/pom.xml
@@ -36,7 +36,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<configuration>
<!-- making sure there is one checkstyle error -->
<configLocation>checkstyle.xml</configLocation>
diff --git a/src/it/MCHECKSTYLE-357-with-header-override/pom.xml b/src/it/MCHECKSTYLE-357-with-header-override/pom.xml
index 6a0d990..9a11d16 100644
--- a/src/it/MCHECKSTYLE-357-with-header-override/pom.xml
+++ b/src/it/MCHECKSTYLE-357-with-header-override/pom.xml
@@ -33,11 +33,11 @@
<plugins>
<plugin>
<artifactId>maven-site-plugin</artifactId>
- <version>3.7.1</version>
+ <version>@sitePluginVersion@</version>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<configuration>
<checkstyleRules>
<module name="Checker">
diff --git a/src/it/MCHECKSTYLE-357/pom.xml b/src/it/MCHECKSTYLE-357/pom.xml
index 4ac7dc9..3e809bf 100644
--- a/src/it/MCHECKSTYLE-357/pom.xml
+++ b/src/it/MCHECKSTYLE-357/pom.xml
@@ -33,11 +33,11 @@
<plugins>
<plugin>
<artifactId>maven-site-plugin</artifactId>
- <version>3.7.1</version>
+ <version>@sitePluginVersion@</version>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<configuration>
<checkstyleRules>
<module name="Checker">
diff --git a/src/it/MCHECKSTYLE-365/pom.xml b/src/it/MCHECKSTYLE-365/pom.xml
index 2f829d2..d1d6729 100644
--- a/src/it/MCHECKSTYLE-365/pom.xml
+++ b/src/it/MCHECKSTYLE-365/pom.xml
@@ -33,11 +33,11 @@
<plugins>
<plugin>
<artifactId>maven-site-plugin</artifactId>
- <version>3.7.1</version>
+ <version>@sitePluginVersion@</version>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<configuration>
<checkstyleRules>
<module name="Checker">
diff --git a/src/it/MCHECKSTYLE-99-custom-xref-test-location/pom.xml b/src/it/MCHECKSTYLE-99-custom-xref-test-location/pom.xml
index 2c3839f..f5f8664 100644
--- a/src/it/MCHECKSTYLE-99-custom-xref-test-location/pom.xml
+++ b/src/it/MCHECKSTYLE-99-custom-xref-test-location/pom.xml
@@ -25,10 +25,6 @@
<version>1.0-SNAPSHOT</version>
<name>checkstyle-new</name>
<url>http://maven.apache.org</url>
- <properties>
- <checkstyleVersion>@pom.version@</checkstyleVersion>
- <jxrPluginVersion>3.0.0</jxrPluginVersion>
- </properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -43,7 +39,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<configuration>
<configLocation>https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-8.28/src/main/resources/sun_checks.xml</configLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
@@ -53,10 +49,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
- <version>${jxrPluginVersion}</version>
+ <version>@jxrPluginVersion@</version>
</plugin>
</plugins>
- </pluginManagement>
+ </pluginManagement>
</build>
<reporting>
<plugins>
diff --git a/src/it/MCHECKSTYLE-99/pom.xml b/src/it/MCHECKSTYLE-99/pom.xml
index 450f13c..bf629fd 100644
--- a/src/it/MCHECKSTYLE-99/pom.xml
+++ b/src/it/MCHECKSTYLE-99/pom.xml
@@ -25,10 +25,6 @@
<version>1.0-SNAPSHOT</version>
<name>checkstyle-new</name>
<url>http://maven.apache.org</url>
- <properties>
- <checkstyleVersion>@pom.version@</checkstyleVersion>
- <jxrPluginVersion>3.0.0</jxrPluginVersion>
- </properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -43,7 +39,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<configuration>
<configLocation>https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-8.28/src/main/resources/sun_checks.xml</configLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
@@ -52,10 +48,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
- <version>${jxrPluginVersion}</version>
+ <version>@jxrPluginVersion@</version>
</plugin>
</plugins>
- </pluginManagement>
+ </pluginManagement>
</build>
<reporting>
<plugins>
diff --git a/src/it/check-fail/pom.xml b/src/it/check-fail/pom.xml
index ebf692b..a7e6de4 100644
--- a/src/it/check-fail/pom.xml
+++ b/src/it/check-fail/pom.xml
@@ -40,7 +40,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<executions>
<execution>
<id>check</id>
diff --git a/src/it/check-pass/pom.xml b/src/it/check-pass/pom.xml
index a2303f9..532139c 100644
--- a/src/it/check-pass/pom.xml
+++ b/src/it/check-pass/pom.xml
@@ -45,7 +45,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<executions>
<execution>
<id>check</id>
diff --git a/src/it/check-tests-only/pom.xml b/src/it/check-tests-only/pom.xml
index d377267..b56faa2 100644
--- a/src/it/check-tests-only/pom.xml
+++ b/src/it/check-tests-only/pom.xml
@@ -31,7 +31,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<configuration>
<includes>**/*.*</includes>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
diff --git a/src/it/checkstyle-goal/pom.xml b/src/it/checkstyle-goal/pom.xml
index 821dcb2..373425c 100644
--- a/src/it/checkstyle-goal/pom.xml
+++ b/src/it/checkstyle-goal/pom.xml
@@ -40,7 +40,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<configuration>
<enableRSS>true</enableRSS>
</configuration>
@@ -53,7 +53,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<reportSets>
<reportSet>
<reports>
diff --git a/src/it/checkstyle-report/pom.xml b/src/it/checkstyle-report/pom.xml
index 686c43c..9755cab 100644
--- a/src/it/checkstyle-report/pom.xml
+++ b/src/it/checkstyle-report/pom.xml
@@ -40,7 +40,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -55,7 +55,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<configuration>
<enableRSS>true</enableRSS>
</configuration>
diff --git a/src/it/minimal-pom/pom.xml b/src/it/minimal-pom/pom.xml
index 11f7781..d30a26a 100644
--- a/src/it/minimal-pom/pom.xml
+++ b/src/it/minimal-pom/pom.xml
@@ -49,7 +49,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
</plugin>
</plugins>
</reporting>
diff --git a/src/it/multi-modules-aggregate/child-a/pom.xml b/src/it/multi-modules-aggregate/child-a/pom.xml
index 9483924..973a8f6 100644
--- a/src/it/multi-modules-aggregate/child-a/pom.xml
+++ b/src/it/multi-modules-aggregate/child-a/pom.xml
@@ -43,7 +43,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
</plugin>
</plugins>
</pluginManagement>
@@ -56,7 +56,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
</plugin>
</plugins>
</build>
diff --git a/src/it/multi-modules-aggregate/pom.xml b/src/it/multi-modules-aggregate/pom.xml
index 82ac112..c97e517 100644
--- a/src/it/multi-modules-aggregate/pom.xml
+++ b/src/it/multi-modules-aggregate/pom.xml
@@ -37,7 +37,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
</plugin>
</plugins>
</pluginManagement>
@@ -50,7 +50,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
</plugin>
</plugins>
</build>
@@ -61,7 +61,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<configuration>
<!-- this is the file we had in 2.13, slightly adapted to Checkstyle 8.x -->
<configLocation>maven_checks.xml</configLocation>
diff --git a/src/it/multi-modules/multi-modules-child/pom.xml b/src/it/multi-modules/multi-modules-child/pom.xml
index 0cd429c..00fdde8 100644
--- a/src/it/multi-modules/multi-modules-child/pom.xml
+++ b/src/it/multi-modules/multi-modules-child/pom.xml
@@ -43,7 +43,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
</plugin>
</plugins>
</pluginManagement>
@@ -56,7 +56,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
</plugin>
</plugins>
</build>
diff --git a/src/it/multi-modules/pom.xml b/src/it/multi-modules/pom.xml
index 1539b19..e618dcf 100644
--- a/src/it/multi-modules/pom.xml
+++ b/src/it/multi-modules/pom.xml
@@ -38,8 +38,8 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
- </plugin>
+ <version>@project.version@</version>
+ </plugin>
</plugins>
</pluginManagement>
<plugins>
@@ -55,4 +55,4 @@
<module>multi-modules-child</module>
<module>multi-modules-child-nosource</module>
</modules>
-</project>
\ No newline at end of file
+</project>
diff --git a/src/it/multimoduleproject/pom.xml b/src/it/multimoduleproject/pom.xml
index dff6b12..cfe9b22 100644
--- a/src/it/multimoduleproject/pom.xml
+++ b/src/it/multimoduleproject/pom.xml
@@ -32,7 +32,7 @@
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>@pom.version@</version>
+ <version>@project.version@</version>
<!-- version>2.4</version -->
<configuration>
<!--
diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java b/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java
index 583c5f3..14344b6 100644
--- a/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java
+++ b/src/main/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleReport.java
@@ -33,7 +33,7 @@
import java.util.ResourceBundle;
import org.apache.maven.artifact.Artifact;
-import org.apache.maven.doxia.tools.SiteTool;
+import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginManagement;
@@ -77,6 +77,9 @@
private static final String DEFAULT_CONFIG_LOCATION = "sun_checks.xml";
+ @Parameter( defaultValue = "${session}", readonly = true, required = true )
+ private MavenSession session;
+
/**
* Specifies the cache file used to speed up Checkstyle on successive runs.
*/
@@ -114,16 +117,6 @@
protected boolean consoleOutput;
/**
- * The file encoding to use when reading the source files. If the property <code>project.build.sourceEncoding</code>
- * is not set, the platform default encoding is used. <strong>Note:</strong> This parameter always overrides the
- * property <code>charset</code> from Checkstyle's <code>TreeWalker</code> module.
- *
- * @since 2.2
- */
- @Parameter( property = "encoding", defaultValue = "${project.build.sourceEncoding}" )
- protected String encoding;
-
- /**
* Specifies if the build should fail upon a violation.
*/
@Parameter( defaultValue = "false" )
@@ -363,14 +356,6 @@
private boolean enableRSS;
/**
- * SiteTool.
- *
- * @since 2.2
- */
- @Component( role = SiteTool.class )
- protected SiteTool siteTool;
-
- /**
* The Plugin Descriptor
*/
@Parameter( defaultValue = "${plugin}", readonly = true, required = true )
diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleAggregateReport.java b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleAggregateReport.java
index d2981d7..dee6f64 100644
--- a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleAggregateReport.java
+++ b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleAggregateReport.java
@@ -76,7 +76,7 @@
.setTestSourceDirectories( getTestSourceDirectories() ).setConfigLocation( configLocation )
.setPropertyExpansion( propertyExpansion ).setHeaderLocation( headerLocation )
.setCacheFile( cacheFile ).setSuppressionsFileExpression( suppressionsFileExpression )
- .setEncoding( encoding ).setPropertiesLocation( propertiesLocation );
+ .setEncoding( getInputEncoding() ).setPropertiesLocation( propertiesLocation );
return request;
}
diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleReport.java b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleReport.java
index faf0a16..0d3af2d 100644
--- a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleReport.java
+++ b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleReport.java
@@ -69,7 +69,7 @@
.setTestSourceDirectories( getTestSourceDirectories() ).setConfigLocation( configLocation )
.setPropertyExpansion( propertyExpansion ).setHeaderLocation( headerLocation )
.setCacheFile( cacheFile ).setSuppressionsFileExpression( suppressionsFileExpression )
- .setEncoding( encoding ).setPropertiesLocation( propertiesLocation );
+ .setEncoding( getInputEncoding() ).setPropertiesLocation( propertiesLocation );
return request;
}
@@ -86,7 +86,7 @@
{
return false;
}
-
+
// TODO: would be good to scan the files here
for ( File sourceDirectory : getSourceDirectories() )
{
@@ -95,7 +95,7 @@
return true;
}
}
-
+
if ( includeTestSourceDirectory )
{
for ( File testSourceDirectory : getTestSourceDirectories() )
@@ -106,7 +106,7 @@
}
}
}
-
+
return ( ( includeResources && hasResources( resources ) )
|| ( includeTestResources && hasResources( testResources ) )
);
diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
index f3e645c..43c07a1 100644
--- a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
+++ b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
@@ -172,7 +172,7 @@
*/
@Parameter( defaultValue = "${project.resources}", readonly = true )
protected List<Resource> resources;
-
+
/**
* Specifies the location of the test resources to be used for Checkstyle.
*
@@ -292,7 +292,7 @@
* @since 2.2
*/
@Parameter( property = "encoding", defaultValue = "${project.build.sourceEncoding}" )
- private String encoding;
+ private String inputEncoding;
/**
* @since 2.5
@@ -311,7 +311,7 @@
*/
@Parameter ( defaultValue = "${project}", readonly = true, required = true )
protected MavenProject project;
-
+
/**
* The Plugin Descriptor
*/
@@ -392,7 +392,7 @@
/**
* Specifies the location of the source directory to be used for Checkstyle.
- *
+ *
* @deprecated instead use {@link #sourceDirectories}. For version 3.0.0, this parameter is only defined to break
* the build if you use it!
*/
@@ -451,7 +451,7 @@
private PlexusConfiguration checkstyleRules;
/**
- * Dump file for inlined Checkstyle rules.
+ * Dump file for inlined Checkstyle rules.
*/
@Parameter( property = "checkstyle.output.rules.file",
defaultValue = "${project.build.directory}/checkstyle-rules.xml" )
@@ -469,7 +469,7 @@
/**
* Specifies whether modules with a configured severity of <code>ignore</code> should be omitted during Checkstyle
* invocation.
- *
+ *
* @since 3.0.0
*/
@Parameter( defaultValue = "false" )
@@ -540,7 +540,7 @@
.setPropertyExpansion( propertyExpansion )
.setHeaderLocation( headerLocation ).setLicenseArtifacts( collectArtifacts( "license" ) )
.setCacheFile( cacheFile ).setSuppressionsFileExpression( suppressionsFileExpression )
- .setEncoding( encoding ).setPropertiesLocation( propertiesLocation )
+ .setEncoding( inputEncoding ).setPropertiesLocation( propertiesLocation )
.setOmitIgnoredModules( omitIgnoredModules );
checkstyleExecutor.executeCheckstyle( request );
@@ -876,7 +876,7 @@
return listener;
}
-
+
private List<Artifact> collectArtifacts( String hint )
{
List<Artifact> artifacts = new ArrayList<>();
@@ -895,7 +895,7 @@
private List<Artifact> getCheckstylePluginDependenciesAsArtifacts( Map<String, Plugin> plugins, String hint )
{
List<Artifact> artifacts = new ArrayList<>();
-
+
Plugin checkstylePlugin = plugins.get( plugin.getGroupId() + ":" + plugin.getArtifactId() );
if ( checkstylePlugin != null )
{
@@ -908,7 +908,7 @@
}
return artifacts;
}
-
+
private List<File> getSourceDirectories()
{
if ( sourceDirectories == null )
@@ -922,7 +922,7 @@
}
return sourceDirs;
}
-
+
private List<File> getTestSourceDirectories()
{
if ( testSourceDirectories == null )
@@ -936,5 +936,5 @@
}
return testSourceDirs;
}
-
+
}
diff --git a/src/test/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleTestCase.java b/src/test/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleTestCase.java
new file mode 100644
index 0000000..0d925d3
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugins/checkstyle/AbstractCheckstyleTestCase.java
@@ -0,0 +1,168 @@
+package org.apache.maven.plugins.checkstyle;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.util.Locale;
+
+import org.apache.maven.plugin.LegacySupport;
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.apache.maven.plugin.testing.ArtifactStubFactory;
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.repository.LocalRepository;
+
+/**
+ * Abstract class to test reports generation.
+ */
+public abstract class AbstractCheckstyleTestCase
+ extends AbstractMojoTestCase
+{
+ private Locale oldLocale;
+
+ private ArtifactStubFactory artifactStubFactory;
+
+ /**
+ * The current project to be test.
+ */
+ private MavenProject testMavenProject;
+
+ @Override
+ protected void setUp()
+ throws Exception
+ {
+ // required for mojo lookups to work
+ super.setUp();
+
+ oldLocale = Locale.getDefault();
+ Locale.setDefault( Locale.ENGLISH );
+
+ artifactStubFactory = new DependencyArtifactStubFactory( getTestFile( "target" ), true, false );
+ artifactStubFactory.getWorkingDir().mkdirs();
+ }
+
+ @Override
+ protected void tearDown()
+ throws Exception
+ {
+ super.tearDown();
+
+ Locale.setDefault( oldLocale );
+ oldLocale = null;
+ }
+
+ /**
+ * Get the current Maven project
+ *
+ * @return the maven project
+ */
+ protected MavenProject getTestMavenProject()
+ {
+ return testMavenProject;
+ }
+
+ /**
+ * Get the generated report as file in the test maven project.
+ *
+ * @param name the name of the report.
+ * @return the generated report as file
+ * @throws IOException if the return file doesnt exist
+ */
+ protected File getGeneratedReport( String name )
+ throws IOException
+ {
+ String outputDirectory = getBasedir() + "/target/test/test-harness/" + getTestMavenProject().getArtifactId();
+
+ File report = new File( outputDirectory, name );
+ if ( !report.exists() )
+ {
+ throw new IOException( "File not found. Attempted: " + report );
+ }
+
+ return report;
+ }
+
+ /**
+ * Generate the report and return the generated file
+ *
+ * @param goal the mojo goal.
+ * @param pluginXml the name of the xml file in "src/test/resources/plugin-configs/".
+ * @return the generated HTML file
+ * @throws Exception if any
+ */
+ protected File generateReport( String goal, String pluginXml )
+ throws Exception
+ {
+ File pluginXmlFile = new File( getBasedir(), "src/test/resources/plugin-configs/" + pluginXml );
+ CheckstyleReport mojo = createReportMojo( goal, pluginXmlFile );
+ return generateReport( mojo, pluginXmlFile );
+ }
+
+ protected CheckstyleReport createReportMojo( String goal, File pluginXmlFile )
+ throws Exception
+ {
+ CheckstyleReport mojo = (CheckstyleReport) lookupMojo( goal, pluginXmlFile );
+ assertNotNull( "Mojo not found.", mojo );
+
+ LegacySupport legacySupport = lookup( LegacySupport.class );
+ legacySupport.setSession( newMavenSession( new MavenProjectStub() ) );
+ DefaultRepositorySystemSession repoSession =
+ (DefaultRepositorySystemSession) legacySupport.getRepositorySession();
+ repoSession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repoSession, new LocalRepository( artifactStubFactory.getWorkingDir() ) ) );
+
+ setVariableValueToObject( mojo, "session", legacySupport.getSession() );
+ setVariableValueToObject( mojo, "remoteRepositories", mojo.getProject().getRemoteArtifactRepositories() );
+ return mojo;
+ }
+
+ protected File generateReport( CheckstyleReport mojo, File pluginXmlFile )
+ throws Exception
+ {
+ mojo.execute();
+
+ ProjectBuilder builder = lookup( ProjectBuilder.class );
+
+ ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest();
+ buildingRequest.setRepositorySession( lookup( LegacySupport.class ).getRepositorySession() );
+
+ testMavenProject = builder.build( pluginXmlFile, buildingRequest ).getProject();
+
+ File outputDir = mojo.getReportOutputDirectory();
+ String filename = mojo.getOutputName() + ".html";
+
+ return new File( outputDir, filename );
+ }
+
+ /**
+ * Read the contents of the specified file object into a string
+ */
+ protected String readFile( File checkstyleTestDir, String fileName ) throws IOException
+ {
+ return new String( Files.readAllBytes( checkstyleTestDir.toPath().resolve( fileName ) ) );
+ }
+
+}
diff --git a/src/test/java/org/apache/maven/plugins/checkstyle/CheckstyleReportTest.java b/src/test/java/org/apache/maven/plugins/checkstyle/CheckstyleReportTest.java
index 81ec866..b6575c8 100644
--- a/src/test/java/org/apache/maven/plugins/checkstyle/CheckstyleReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/checkstyle/CheckstyleReportTest.java
@@ -19,70 +19,30 @@
* under the License.
*/
+
+import java.io.BufferedReader;
import java.io.File;
+import java.io.FileReader;
import java.io.IOException;
-import java.io.Writer;
import java.util.Locale;
import java.util.ResourceBundle;
-
-
import org.apache.maven.artifact.DependencyResolutionRequiredException;
-import org.apache.maven.doxia.site.decoration.DecorationModel;
-import org.apache.maven.doxia.siterenderer.RendererException;
-import org.apache.maven.doxia.siterenderer.SiteRenderingContext;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.apache.maven.reporting.MavenReport;
import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.WriterFactory;
/**
* @author Edwin Punzalan
*
*/
public class CheckstyleReportTest
- extends AbstractMojoTestCase
+ extends AbstractCheckstyleTestCase
{
- private Locale oldLocale;
-
- /** {@inheritDoc} */
- protected void setUp()
- throws Exception
- {
- super.setUp();
-
- oldLocale = Locale.getDefault();
- Locale.setDefault( Locale.ENGLISH );
- }
-
- /** {@inheritDoc} */
- protected void tearDown()
- throws Exception
- {
- super.tearDown();
-
- Locale.setDefault( oldLocale );
- oldLocale = null;
- }
-
public void testNoSource()
throws Exception
{
- File pluginXmlFile = new File( getBasedir(), "src/test/plugin-configs/no-source-plugin-config.xml" );
-
- CheckstyleReport mojo = (CheckstyleReport) lookupMojo( "checkstyle", pluginXmlFile );
- assertNotNull( "Mojo found.", mojo );
- mojo.execute();
-
- File outputFile = (File) getVariableValueFromObject( mojo, "outputFile" );
-
- renderer( mojo, outputFile );
-
- assertTrue( outputFile.getAbsolutePath() + " not generated!", outputFile.exists() );
-
- assertTrue( outputFile.getAbsolutePath() + " is empty!", outputFile.length() <= 0 );
+ File generatedReport = generateReport( "checkstyle", "no-source-plugin-config.xml" );
+ assertFalse( FileUtils.fileExists( generatedReport.getAbsolutePath() ) );
}
public void testMinConfiguration()
@@ -159,23 +119,46 @@
generateReport( "test-source-directory-plugin-config.xml" );
}
- private File generateReport( String pluginXml )
+ /**
+ * Read the contents of the specified file object into a string
+ *
+ * @param file the file to be read
+ * @return a String object that contains the contents of the file
+ * @throws java.io.IOException
+ */
+ private String readFile( File file )
+ throws IOException
+ {
+ String strTmp;
+ StringBuilder str = new StringBuilder( (int) file.length() );
+ try ( BufferedReader in = new BufferedReader( new FileReader( file ) ) )
+ {
+ while ( ( strTmp = in.readLine() ) != null )
+ {
+ str.append( ' ' );
+ str.append( strTmp );
+ }
+ }
+
+ return str.toString();
+ }
+
+ private void generateReport( String pluginXml )
throws Exception
{
- File pluginXmlFile = new File( getBasedir(), "src/test/plugin-configs/" + pluginXml );
+ File pluginXmlFile = new File( getBasedir(), "src/test/resources/plugin-configs/" + pluginXml );
ResourceBundle bundle =
ResourceBundle.getBundle( "checkstyle-report", Locale.getDefault(), this.getClassLoader() );
- CheckstyleReport mojo = (CheckstyleReport) lookupMojo( "checkstyle", pluginXmlFile );
+ CheckstyleReport mojo = createReportMojo( "checkstyle", pluginXmlFile );
- assertNotNull( "Mojo found.", mojo );
-
PluginDescriptor descriptorStub = new PluginDescriptor();
descriptorStub.setGroupId( "org.apache.maven.plugins" );
descriptorStub.setArtifactId( "maven-checkstyle-plugin" );
setVariableValueToObject( mojo, "plugin", descriptorStub );
- mojo.execute();
+ File generatedReport = generateReport( mojo, pluginXmlFile );
+ assertTrue( FileUtils.fileExists( generatedReport.getAbsolutePath() ) );
File outputFile = (File) getVariableValueFromObject( mojo, "outputFile" );
assertNotNull( "Test output file", outputFile );
@@ -187,8 +170,7 @@
assertTrue( "Test cache file exists", new File( cacheFile ).exists() );
}
- MavenReport reportMojo = mojo;
- File outputDir = reportMojo.getReportOutputDirectory();
+ File outputDir = mojo.getReportOutputDirectory();
Boolean rss = (Boolean) getVariableValueFromObject( mojo, "enableRSS" );
if (rss)
@@ -203,19 +185,10 @@
assertTrue( "Test useFile exists", useFile.exists() );
}
- String filename = reportMojo.getOutputName() + ".html";
- File outputHtml = new File( outputDir, filename );
-
- renderer( mojo, outputHtml );
-
- assertTrue( outputHtml.getAbsolutePath() + " not generated!", outputHtml.exists() );
-
- assertTrue( outputHtml.getAbsolutePath() + " is empty!", outputHtml.length() > 0 );
-
- String htmlString = FileUtils.fileRead( outputHtml );
+ String str = readFile( generatedReport );
boolean searchHeaderFound =
- htmlString.contains( getHtmlHeader( bundle.getString( "report.checkstyle.rules" ) ) );
+ str.contains( getHtmlHeader( bundle.getString( "report.checkstyle.rules" ) ) );
Boolean rules = (Boolean) getVariableValueFromObject( mojo, "enableRulesSummary" );
if (rules)
{
@@ -226,7 +199,7 @@
assertFalse( "Test for Rules Summary", searchHeaderFound );
}
- searchHeaderFound = htmlString.contains( getHtmlHeader( bundle.getString( "report.checkstyle.summary" ) ) );
+ searchHeaderFound = str.contains( getHtmlHeader( bundle.getString( "report.checkstyle.summary" ) ) );
Boolean severity = (Boolean) getVariableValueFromObject( mojo, "enableSeveritySummary" );
if (severity)
{
@@ -237,7 +210,7 @@
assertFalse( "Test for Severity Summary", searchHeaderFound );
}
- searchHeaderFound = htmlString.contains( getHtmlHeader( bundle.getString( "report.checkstyle.files" ) ) );
+ searchHeaderFound = str.contains( getHtmlHeader( bundle.getString( "report.checkstyle.files" ) ) );
Boolean files = (Boolean) getVariableValueFromObject( mojo, "enableFilesSummary" );
if (files)
{
@@ -247,45 +220,10 @@
{
assertFalse( "Test for Files Summary", searchHeaderFound );
}
-
- return outputHtml;
}
private static String getHtmlHeader( String s )
{
return ">" + s + "</h2>";
}
-
- /**
- * Renderer the sink from the report mojo.
- *
- * @param mojo not null
- * @param outputHtml not null
- * @throws RendererException if any
- * @throws IOException if any
- */
- private void renderer( CheckstyleReport mojo, File outputHtml )
- throws RendererException, Exception
- {
- Writer writer = null;
- SiteRenderingContext context = new SiteRenderingContext();
- context.setDecoration( new DecorationModel() );
- context.setTemplateName( "org/apache/maven/doxia/siterenderer/resources/default-site.vm" );
- context.setLocale( Locale.ENGLISH );
-
- try
- {
- outputHtml.getParentFile().mkdirs();
- writer = WriterFactory.newXmlWriter( outputHtml );
-
- mojo.execute();
-
- writer.close();
- writer = null;
- }
- finally
- {
- IOUtil.close( writer );
- }
- }
}
diff --git a/src/test/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojoTest.java b/src/test/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojoTest.java
index af9ba83..ee1f2c9 100644
--- a/src/test/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojoTest.java
@@ -37,22 +37,19 @@
public class CheckstyleViolationCheckMojoTest
extends AbstractMojoTestCase
{
-
-
-
public void testDefaultConfig()
throws Exception
{
- File pluginXmlFile = new File( getBasedir(), "src/test/plugin-configs/check-plugin-config.xml" );
+ File pluginXmlFile = new File( getBasedir(), "src/test/resources/plugin-configs/check-plugin-config.xml" );
CheckstyleViolationCheckMojo mojo = (CheckstyleViolationCheckMojo) lookupMojo( "check", pluginXmlFile );
-
+
mojoSetup( mojo );
-
+
assertNotNull( "Mojo found.", mojo );
-
+
assertNotNull( "project null.", mojo.project );
-
+
try
{
mojo.execute();
@@ -68,14 +65,14 @@
public void testInvalidFormatWithSkipExec()
throws Exception
{
- File pluginXmlFile = new File( getBasedir(), "src/test/plugin-configs/check-plugin-config.xml" );
+ File pluginXmlFile = new File( getBasedir(), "src/test/resources/plugin-configs/check-plugin-config.xml" );
Mojo mojo = lookupMojo( "check", pluginXmlFile );
assertNotNull( "Mojo found.", mojo );
mojoSetup( mojo );
-
+
setVariableValueToObject( mojo, "outputFileFormat", "plain" );
try
@@ -93,14 +90,14 @@
public void testNoOutputFile()
throws Exception
{
- File pluginXmlFile = new File( getBasedir(), "src/test/plugin-configs/check-plugin-config.xml" );
+ File pluginXmlFile = new File( getBasedir(), "src/test/resources/plugin-configs/check-plugin-config.xml" );
Mojo mojo = lookupMojo( "check", pluginXmlFile );
assertNotNull( "Mojo found.", mojo );
mojoSetup( mojo );
-
+
setVariableValueToObject( mojo, "outputFile", new File( "target/NoSuchFile.xml" ) );
mojo.execute();
@@ -109,7 +106,7 @@
private void doTestPlainOutputFile( boolean failsOnError )
throws Exception
{
- File pluginXmlFile = new File( getBasedir(), "src/test/plugin-configs/check-plugin-plain-output.xml" );
+ File pluginXmlFile = new File( getBasedir(), "src/test/resources/plugin-configs/check-plugin-plain-output.xml" );
Mojo mojo = lookupMojo( "check", pluginXmlFile );
@@ -149,19 +146,19 @@
public void testNoFail()
throws Exception
{
- File pluginXmlFile = new File( getBasedir(), "src/test/plugin-configs/check-plugin-config.xml" );
+ File pluginXmlFile = new File( getBasedir(), "src/test/resources/plugin-configs/check-plugin-config.xml" );
Mojo mojo = lookupMojo( "check", pluginXmlFile );
assertNotNull( "Mojo found.", mojo );
mojoSetup( mojo );
-
+
setVariableValueToObject( mojo, "failOnViolation", Boolean.FALSE );
mojo.execute();
}
-
+
protected void mojoSetup( Mojo mojo )
throws Exception
{
@@ -193,7 +190,7 @@
setVariableValueToObject( mojo, "configLocation", "sun_checks.xml" );
setVariableValueToObject( mojo, "cacheFile", getBasedir() + "/target/classes/checkstyle-cachefile" );
setVariableValueToObject( mojo, "sourceDirectories", Arrays.asList( getBasedir() + "/src/test/plugin-configs/src" ));// new File( getBasedir() + "/target" ) );
- setVariableValueToObject( mojo, "encoding", "UTF-8" );
+ setVariableValueToObject( mojo, "inputEncoding", "UTF-8" );
setVariableValueToObject( mojo, "skipExec", Boolean.TRUE );
}
diff --git a/src/test/java/org/apache/maven/plugins/checkstyle/DependencyArtifactStubFactory.java b/src/test/java/org/apache/maven/plugins/checkstyle/DependencyArtifactStubFactory.java
new file mode 100644
index 0000000..5a15a42
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugins/checkstyle/DependencyArtifactStubFactory.java
@@ -0,0 +1,69 @@
+package org.apache.maven.plugins.checkstyle;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.plugin.testing.ArtifactStubFactory;
+
+public class DependencyArtifactStubFactory
+ extends ArtifactStubFactory
+{
+ private boolean flattenedPath = true;
+
+ public DependencyArtifactStubFactory( File theWorkingDir, boolean theCreateFiles, boolean flattenedPath )
+ {
+ this( theWorkingDir, theCreateFiles );
+ this.flattenedPath = flattenedPath;
+ }
+
+ public DependencyArtifactStubFactory( File theWorkingDir, boolean theCreateFiles )
+ {
+ super( theWorkingDir, theCreateFiles );
+ }
+
+ @Override
+ public Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String scope,
+ String type, String classifier, boolean optional )
+ throws IOException
+ {
+ File workingDir = getWorkingDir();
+
+ if ( !flattenedPath )
+ {
+ // don't use flatten directories, won't happen at runtime
+ String path = groupId.replace( '.', '/' ) + '/' +
+ artifactId + '/' +
+ ArtifactUtils.toSnapshotVersion( versionRange.getRecommendedVersion().toString() );
+ setWorkingDir( new File( workingDir, path ) );
+ }
+
+ Artifact artifact =
+ super.createArtifact( groupId, artifactId, versionRange, scope, type, classifier, optional );
+
+ setWorkingDir( workingDir );
+
+ return artifact;
+ }
+}
diff --git a/src/test/java/org/apache/maven/plugins/checkstyle/stubs/CheckstyleProjectStub.java b/src/test/java/org/apache/maven/plugins/checkstyle/stubs/CheckstyleProjectStub.java
new file mode 100644
index 0000000..528a00f
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugins/checkstyle/stubs/CheckstyleProjectStub.java
@@ -0,0 +1,42 @@
+package org.apache.maven.plugins.checkstyle.stubs;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.repository.MavenArtifactRepository;
+import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+
+public abstract class CheckstyleProjectStub
+ extends MavenProjectStub
+{
+ @Override
+ public List<ArtifactRepository> getRemoteArtifactRepositories()
+ {
+ ArtifactRepository repository = new MavenArtifactRepository( "central", "https://repo1.maven.org/maven2",
+ new DefaultRepositoryLayout(), new ArtifactRepositoryPolicy(), new ArtifactRepositoryPolicy() );
+
+ return Collections.singletonList( repository );
+ }
+}
diff --git a/src/test/java/org/apache/maven/plugins/checkstyle/stubs/MinMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/checkstyle/stubs/MinMavenProjectStub.java
index 795b835..ab83801 100644
--- a/src/test/java/org/apache/maven/plugins/checkstyle/stubs/MinMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/checkstyle/stubs/MinMavenProjectStub.java
@@ -35,7 +35,7 @@
*
*/
public class MinMavenProjectStub
- extends org.apache.maven.plugin.testing.stubs.MavenProjectStub
+ extends CheckstyleProjectStub
{
/** {@inheritDoc} */
public List<String> getCompileClasspathElements()
diff --git a/src/test/java/org/apache/maven/plugins/checkstyle/stubs/ModuleMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/checkstyle/stubs/ModuleMavenProjectStub.java
index 71debc5..5c92929 100644
--- a/src/test/java/org/apache/maven/plugins/checkstyle/stubs/ModuleMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/checkstyle/stubs/ModuleMavenProjectStub.java
@@ -35,7 +35,7 @@
*
*/
public class ModuleMavenProjectStub
- extends org.apache.maven.plugin.testing.stubs.MavenProjectStub
+ extends CheckstyleProjectStub
{
/** {@inheritDoc} */
diff --git a/src/test/java/org/apache/maven/plugins/checkstyle/stubs/MultiMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/checkstyle/stubs/MultiMavenProjectStub.java
index 5c415a7..b39d9e0 100644
--- a/src/test/java/org/apache/maven/plugins/checkstyle/stubs/MultiMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/checkstyle/stubs/MultiMavenProjectStub.java
@@ -34,7 +34,7 @@
*
*/
public class MultiMavenProjectStub
- extends org.apache.maven.plugin.testing.stubs.MavenProjectStub
+ extends CheckstyleProjectStub
{
public MultiMavenProjectStub()
diff --git a/src/test/plugin-configs/check-plugin-config.xml b/src/test/resources/plugin-configs/check-plugin-config.xml
similarity index 99%
rename from src/test/plugin-configs/check-plugin-config.xml
rename to src/test/resources/plugin-configs/check-plugin-config.xml
index a2c5d09..754c8e4 100644
--- a/src/test/plugin-configs/check-plugin-config.xml
+++ b/src/test/resources/plugin-configs/check-plugin-config.xml
@@ -30,4 +30,4 @@
</plugin>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
diff --git a/src/test/plugin-configs/check-plugin-plain-output.xml b/src/test/resources/plugin-configs/check-plugin-plain-output.xml
similarity index 96%
rename from src/test/plugin-configs/check-plugin-plain-output.xml
rename to src/test/resources/plugin-configs/check-plugin-plain-output.xml
index 4d5e29c..0fb56a7 100644
--- a/src/test/plugin-configs/check-plugin-plain-output.xml
+++ b/src/test/resources/plugin-configs/check-plugin-plain-output.xml
@@ -33,7 +33,7 @@
</sourceDirectories>
<project implementation="org.apache.maven.plugins.checkstyle.stubs.MinMavenProjectStub"/>
<consoleOutput>false</consoleOutput>
- <encoding>UTF-8</encoding>
+ <inputEncoding>UTF-8</inputEncoding>
</configuration>
</plugin>
</plugins>
diff --git a/src/test/plugin-configs/custom-plugin-config.xml b/src/test/resources/plugin-configs/custom-plugin-config.xml
similarity index 90%
rename from src/test/plugin-configs/custom-plugin-config.xml
rename to src/test/resources/plugin-configs/custom-plugin-config.xml
index 309762e..43bd679 100644
--- a/src/test/plugin-configs/custom-plugin-config.xml
+++ b/src/test/resources/plugin-configs/custom-plugin-config.xml
@@ -18,12 +18,17 @@
-->
<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>test</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<outputDirectory>${basedir}/target/test-harness/checkstyle/custom</outputDirectory>
+ <localRepository>${localRepository}</localRepository>
<enableRulesSummary>true</enableRulesSummary>
<enableSeveritySummary>true</enableSeveritySummary>
<enableFilesSummary>true</enableFilesSummary>
@@ -44,7 +49,7 @@
<!-- value not really important, just point to an existing dir -->
<xrefLocation>${basedir}/target/test-harness/checkstyle/custom</xrefLocation>
<xrefTestLocation>${basedir}/target/test-harness/checkstyle/custom</xrefTestLocation>
- <encoding>UTF-8</encoding>
+ <inputEncoding>UTF-8</inputEncoding>
</configuration>
</plugin>
</plugins>
diff --git a/src/test/plugin-configs/dep-resolution-exception-plugin-config.xml b/src/test/resources/plugin-configs/dep-resolution-exception-plugin-config.xml
similarity index 95%
rename from src/test/plugin-configs/dep-resolution-exception-plugin-config.xml
rename to src/test/resources/plugin-configs/dep-resolution-exception-plugin-config.xml
index d2c0218..e9aa739 100644
--- a/src/test/plugin-configs/dep-resolution-exception-plugin-config.xml
+++ b/src/test/resources/plugin-configs/dep-resolution-exception-plugin-config.xml
@@ -24,6 +24,7 @@
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<outputDirectory>${basedir}/target/test-harness/checkstyle/dep-resolution</outputDirectory>
+ <localRepository>${localRepository}</localRepository>
<enableRulesSummary>true</enableRulesSummary>
<enableSeveritySummary>true</enableSeveritySummary>
<enableFilesSummary>true</enableFilesSummary>
@@ -43,7 +44,7 @@
<linkXRef>true</linkXRef>
<xrefLocation>${basedir}/target/site/xref</xrefLocation>
<xrefTestLocation>${basedir}/target/site/xref-test</xrefTestLocation>
- <encoding>UTF-8</encoding>
+ <inputEncoding>UTF-8</inputEncoding>
</configuration>
</plugin>
</plugins>
diff --git a/src/test/plugin-configs/fail-on-error-plugin-config.xml b/src/test/resources/plugin-configs/fail-on-error-plugin-config.xml
similarity index 97%
rename from src/test/plugin-configs/fail-on-error-plugin-config.xml
rename to src/test/resources/plugin-configs/fail-on-error-plugin-config.xml
index 06853a1..4090e09 100644
--- a/src/test/plugin-configs/fail-on-error-plugin-config.xml
+++ b/src/test/resources/plugin-configs/fail-on-error-plugin-config.xml
@@ -43,7 +43,7 @@
<linkXRef>true</linkXRef>
<xrefLocation>${basedir}/target/site/xref</xrefLocation>
<xrefTestLocation>${basedir}/target/site/xref-test</xrefTestLocation>
- <encoding>UTF-8</encoding>
+ <inputEncoding>UTF-8</inputEncoding>
</configuration>
</plugin>
</plugins>
diff --git a/src/test/plugin-configs/min-plugin-config.xml b/src/test/resources/plugin-configs/min-plugin-config.xml
similarity index 90%
rename from src/test/plugin-configs/min-plugin-config.xml
rename to src/test/resources/plugin-configs/min-plugin-config.xml
index a151bdb..5ce4ca1 100644
--- a/src/test/plugin-configs/min-plugin-config.xml
+++ b/src/test/resources/plugin-configs/min-plugin-config.xml
@@ -18,12 +18,17 @@
-->
<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>test</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<outputDirectory>${basedir}/target/test-harness/checkstyle/min</outputDirectory>
+ <localRepository>${localRepository}</localRepository>
<enableRulesSummary>true</enableRulesSummary>
<enableSeveritySummary>true</enableSeveritySummary>
<enableFilesSummary>true</enableFilesSummary>
@@ -43,7 +48,7 @@
<linkXRef>true</linkXRef>
<xrefLocation>${basedir}/target/site/xref</xrefLocation>
<xrefTestLocation>${basedir}/target/site/xref-test</xrefTestLocation>
- <encoding>UTF-8</encoding>
+ <inputEncoding>UTF-8</inputEncoding>
</configuration>
</plugin>
</plugins>
diff --git a/src/test/plugin-configs/multi-plugin-config.xml b/src/test/resources/plugin-configs/multi-plugin-config.xml
similarity index 97%
rename from src/test/plugin-configs/multi-plugin-config.xml
rename to src/test/resources/plugin-configs/multi-plugin-config.xml
index 4f3d4f2..9bb0c05 100644
--- a/src/test/plugin-configs/multi-plugin-config.xml
+++ b/src/test/resources/plugin-configs/multi-plugin-config.xml
@@ -43,7 +43,7 @@
<linkXRef>true</linkXRef>
<xrefLocation>${basedir}/target/site/xref</xrefLocation>
<xrefTestLocation>${basedir}/target/site/xref-test</xrefTestLocation>
- <encoding>UTF-8</encoding>
+ <inputEncoding>UTF-8</inputEncoding>
</configuration>
</plugin>
</plugins>
diff --git a/src/test/plugin-configs/no-files-plugin-config.xml b/src/test/resources/plugin-configs/no-files-plugin-config.xml
similarity index 90%
rename from src/test/plugin-configs/no-files-plugin-config.xml
rename to src/test/resources/plugin-configs/no-files-plugin-config.xml
index ad5e125..ce32b86 100644
--- a/src/test/plugin-configs/no-files-plugin-config.xml
+++ b/src/test/resources/plugin-configs/no-files-plugin-config.xml
@@ -18,12 +18,17 @@
-->
<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>test</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<outputDirectory>${basedir}/target/test-harness/checkstyle/no-files</outputDirectory>
+ <localRepository>${localRepository}</localRepository>
<enableRulesSummary>true</enableRulesSummary>
<enableSeveritySummary>true</enableSeveritySummary>
<enableFilesSummary>false</enableFilesSummary>
@@ -43,7 +48,7 @@
<linkXRef>true</linkXRef>
<xrefLocation>${basedir}/target/site/xref</xrefLocation>
<xrefTestLocation>${basedir}/target/site/xref-test</xrefTestLocation>
- <encoding>UTF-8</encoding>
+ <inputEncoding>UTF-8</inputEncoding>
</configuration>
</plugin>
</plugins>
diff --git a/src/test/plugin-configs/no-rules-plugin-config.xml b/src/test/resources/plugin-configs/no-rules-plugin-config.xml
similarity index 90%
rename from src/test/plugin-configs/no-rules-plugin-config.xml
rename to src/test/resources/plugin-configs/no-rules-plugin-config.xml
index b189c75..899bc84 100644
--- a/src/test/plugin-configs/no-rules-plugin-config.xml
+++ b/src/test/resources/plugin-configs/no-rules-plugin-config.xml
@@ -18,12 +18,17 @@
-->
<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>test</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<outputDirectory>${basedir}/target/test-harness/checkstyle/no-rules</outputDirectory>
+ <localRepository>${localRepository}</localRepository>
<enableRulesSummary>false</enableRulesSummary>
<enableSeveritySummary>true</enableSeveritySummary>
<enableFilesSummary>true</enableFilesSummary>
@@ -43,7 +48,7 @@
<linkXRef>true</linkXRef>
<xrefLocation>${basedir}/target/site/xref</xrefLocation>
<xrefTestLocation>${basedir}/target/site/xref-test</xrefTestLocation>
- <encoding>UTF-8</encoding>
+ <inputEncoding>UTF-8</inputEncoding>
</configuration>
</plugin>
</plugins>
diff --git a/src/test/plugin-configs/no-severity-plugin-config.xml b/src/test/resources/plugin-configs/no-severity-plugin-config.xml
similarity index 90%
rename from src/test/plugin-configs/no-severity-plugin-config.xml
rename to src/test/resources/plugin-configs/no-severity-plugin-config.xml
index 91d5fae..416c9fc 100644
--- a/src/test/plugin-configs/no-severity-plugin-config.xml
+++ b/src/test/resources/plugin-configs/no-severity-plugin-config.xml
@@ -18,12 +18,17 @@
-->
<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>test</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<outputDirectory>${basedir}/target/test-harness/checkstyle/no-severity</outputDirectory>
+ <localRepository>${localRepository}</localRepository>
<enableRulesSummary>true</enableRulesSummary>
<enableSeveritySummary>false</enableSeveritySummary>
<enableFilesSummary>true</enableFilesSummary>
@@ -43,7 +48,7 @@
<linkXRef>true</linkXRef>
<xrefLocation>${basedir}/target/site/xref</xrefLocation>
<xrefTestLocation>${basedir}/target/site/xref-test</xrefTestLocation>
- <encoding>UTF-8</encoding>
+ <inputEncoding>UTF-8</inputEncoding>
</configuration>
</plugin>
</plugins>
diff --git a/src/test/plugin-configs/no-source-plugin-config.xml b/src/test/resources/plugin-configs/no-source-plugin-config.xml
similarity index 92%
rename from src/test/plugin-configs/no-source-plugin-config.xml
rename to src/test/resources/plugin-configs/no-source-plugin-config.xml
index 37a110e..fab7251 100644
--- a/src/test/plugin-configs/no-source-plugin-config.xml
+++ b/src/test/resources/plugin-configs/no-source-plugin-config.xml
@@ -18,6 +18,10 @@
-->
<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>test</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
@@ -43,7 +47,7 @@
<linkXRef>true</linkXRef>
<xrefLocation>${basedir}/target/site/xref</xrefLocation>
<xrefTestLocation>${basedir}/target/site/xref-test</xrefTestLocation>
- <encoding>UTF-8</encoding>
+ <inputEncoding>UTF-8</inputEncoding>
</configuration>
</plugin>
</plugins>
diff --git a/src/test/plugin-configs/test-source-directory-plugin-config.xml b/src/test/resources/plugin-configs/test-source-directory-plugin-config.xml
similarity index 90%
rename from src/test/plugin-configs/test-source-directory-plugin-config.xml
rename to src/test/resources/plugin-configs/test-source-directory-plugin-config.xml
index 2f6defe..4678fa4 100644
--- a/src/test/plugin-configs/test-source-directory-plugin-config.xml
+++ b/src/test/resources/plugin-configs/test-source-directory-plugin-config.xml
@@ -18,12 +18,17 @@
-->
<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>test</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<outputDirectory>${basedir}/target/test-harness/checkstyle/no-source</outputDirectory>
+ <localRepository>${localRepository}</localRepository>
<enableRulesSummary>true</enableRulesSummary>
<enableSeveritySummary>true</enableSeveritySummary>
<enableFilesSummary>true</enableFilesSummary>
@@ -46,7 +51,7 @@
<linkXRef>true</linkXRef>
<xrefLocation>${basedir}/target/site/xref</xrefLocation>
<xrefTestLocation>${basedir}/target/site/xref-test</xrefTestLocation>
- <encoding>UTF-8</encoding>
+ <inputEncoding>UTF-8</inputEncoding>
</configuration>
</plugin>
</plugins>
diff --git a/src/test/plugin-configs/useFile-plugin-config.xml b/src/test/resources/plugin-configs/useFile-plugin-config.xml
similarity index 90%
rename from src/test/plugin-configs/useFile-plugin-config.xml
rename to src/test/resources/plugin-configs/useFile-plugin-config.xml
index b488964..89e78b4 100644
--- a/src/test/plugin-configs/useFile-plugin-config.xml
+++ b/src/test/resources/plugin-configs/useFile-plugin-config.xml
@@ -18,12 +18,17 @@
-->
<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>test</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<outputDirectory>${basedir}/target/test-harness/checkstyle/useFile</outputDirectory>
+ <localRepository>${localRepository}</localRepository>
<enableRulesSummary>true</enableRulesSummary>
<enableSeveritySummary>true</enableSeveritySummary>
<enableFilesSummary>true</enableFilesSummary>
@@ -44,7 +49,7 @@
<xrefLocation>${basedir}/target/site/xref</xrefLocation>
<xrefTestLocation>${basedir}/target/site/xref-test</xrefTestLocation>
<useFile>${basedir}/target/test-harness/checkstyle/useFile/checkstyle-output.txt</useFile>
- <encoding>UTF-8</encoding>
+ <inputEncoding>UTF-8</inputEncoding>
</configuration>
</plugin>
</plugins>