Author: hboutemy
Date: Sun Jan 18 21:40:14 2015
New Revision: 1652857
URL: http://svn.apache.org/r1652857
Log:
[MCHECKSTYLE-281] fail if deprecated parameters are used and display update
instructions
Modified:
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
maven/plugins/trunk/maven-checkstyle-plugin/src/test/plugin-configs/custom-plugin-config.xml
Modified:
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java?rev=1652857&r1=1652856&r2=1652857&view=diff
==============================================================================
---
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
(original)
+++
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
Sun Jan 18 21:40:14 2015
@@ -239,14 +239,19 @@ public class CheckstyleReport
/**
* Merge in the deprecated parameters to the new ones, unless the new
* parameters have values.
+ * @throws MavenReportException
*
* @deprecated Remove when deprecated params are removed.
*/
private void mergeDeprecatedInfo()
+ throws MavenReportException
{
if ( "config/sun_checks.xml".equals( configLocation ) &&
!"sun".equals( format ) )
{
configLocation = FORMAT_TO_CONFIG_LOCATION.get( format );
+
+ throw new MavenReportException( "'format' parameter is deprecated:
please replace with <configLocation>"
+ + configLocation + "</configLocation>." );
}
if ( StringUtils.isEmpty( propertiesLocation ) )
@@ -254,10 +259,16 @@ public class CheckstyleReport
if ( propertiesFile != null )
{
propertiesLocation = propertiesFile.getPath();
+
+ throw new MavenReportException( "'propertiesFile' parameter is
deprecated: please replace with "
+ + "<propertiesLocation>" + propertiesLocation +
"</propertiesLocation>." );
}
else if ( propertiesURL != null )
{
propertiesLocation = propertiesURL.toExternalForm();
+
+ throw new MavenReportException( "'propertiesURL' parameter is
deprecated: please replace with "
+ + "<propertiesLocation>" + propertiesLocation
+ "</propertiesLocation>." );
}
}
@@ -273,11 +284,23 @@ public class CheckstyleReport
if ( StringUtils.isEmpty( suppressionsLocation ) )
{
suppressionsLocation = suppressionsFile;
+
+ if ( StringUtils.isNotEmpty( suppressionsFile ) )
+ {
+ throw new MavenReportException( "'suppressionsFile' parameter
is deprecated: please replace with "
+ + "<suppressionsLocation>" + suppressionsLocation +
"</suppressionsLocation>." );
+ }
}
if ( StringUtils.isEmpty( packageNamesLocation ) )
{
packageNamesLocation = packageNamesFile;
+
+ if ( StringUtils.isNotEmpty( packageNamesFile ) )
+ {
+ throw new MavenReportException( "'packageNamesFile' parameter
is deprecated: please replace with "
+ + "<packageNamesFile>" + suppressionsLocation +
"</packageNamesFile>." );
+ }
}
}
Modified:
maven/plugins/trunk/maven-checkstyle-plugin/src/test/plugin-configs/custom-plugin-config.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/test/plugin-configs/custom-plugin-config.xml?rev=1652857&r1=1652856&r2=1652857&view=diff
==============================================================================
---
maven/plugins/trunk/maven-checkstyle-plugin/src/test/plugin-configs/custom-plugin-config.xml
(original)
+++
maven/plugins/trunk/maven-checkstyle-plugin/src/test/plugin-configs/custom-plugin-config.xml
Sun Jan 18 21:40:14 2015
@@ -29,8 +29,7 @@ under the License.
<enableFilesSummary>true</enableFilesSummary>
<enableRSS>true</enableRSS>
<includes>**/*.java</includes>
- <configLocation>config/sun_checks.xml</configLocation>
- <format>maven</format>
+ <configLocation>config/maven_checks.xml</configLocation>
<headerLocation>LICENSE.txt</headerLocation>
<headerFile>${basedir}/src/test/test-sources/LICENSE.txt</headerFile>
<cacheFile>${basedir}/target/test-harness/checkstyle/custom/checkstyle-cachefile</cacheFile>