You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by bi...@apache.org on 2012/04/24 02:39:21 UTC
svn commit: r1329514 - in /maven/plugins/trunk/maven-changes-plugin/src:
it/report-changes-skip-snapshots/ main/java/org/apache/maven/plugin/changes/
Author: bimargulies
Date: Tue Apr 24 00:39:20 2012
New Revision: 1329514
URL: http://svn.apache.org/viewvc?rev=1329514&view=rev
Log:
[MCHANGES-272]: Please add an option to the 'changes-check' goal to allow skipping release date checks of snapshot versions.
Added:
maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-skip-snapshots/
maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-skip-snapshots/pom.xml
maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-skip-snapshots/verify.groovy
Modified:
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesCheckMojo.java
Added: maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-skip-snapshots/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-skip-snapshots/pom.xml?rev=1329514&view=auto
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-skip-snapshots/pom.xml (added)
+++ maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-skip-snapshots/pom.xml Tue Apr 24 00:39:20 2012
@@ -0,0 +1,99 @@
+<?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</groupId>
+ <artifactId>maven-changes-plugin-test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Maven</name>
+ <packaging>jar</packaging>
+ <description>Test report.</description>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <issueManagement>
+ <system>jira</system>
+ <url>http://localhost/bla</url>
+ </issueManagement>
+ <properties>
+ <changesPluginVersion>@pom.version@</changesPluginVersion>
+ </properties>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changes-plugin</artifactId>
+ <version>${changesPluginVersion}</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changes-plugin</artifactId>
+ <version>${changesPluginVersion}</version>
+ <executions>
+ <execution>
+ <id>check-changes</id>
+ <phase>pre-site</phase>
+ <goals>
+ <goal>changes-check</goal>
+ </goals>
+ <configuration>
+ <skipSnapshots>true</skipSnapshots>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <excludeDefaults>true</excludeDefaults>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changes-plugin</artifactId>
+ <version>@pom.version@</version>
+ <configuration>
+ <issueLinkTemplatePerSystem>
+ <jira>http://myjira/browse/%ISSUE%</jira>
+ </issueLinkTemplatePerSystem>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>changes-report</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>
Added: maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-skip-snapshots/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-skip-snapshots/verify.groovy?rev=1329514&view=auto
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-skip-snapshots/verify.groovy (added)
+++ maven/plugins/trunk/maven-changes-plugin/src/it/report-changes-skip-snapshots/verify.groovy Tue Apr 24 00:39:20 2012
@@ -0,0 +1,25 @@
+
+/*
+ * 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.
+ */
+assert new File(basedir, 'build.log').exists();
+content = new File(basedir, 'build.log').text;
+
+assert content.contains( "Skipping snapshot version '1.0-SNAPSHOT'." );
+
+return true;
Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesCheckMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesCheckMojo.java?rev=1329514&r1=1329513&r2=1329514&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesCheckMojo.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/ChangesCheckMojo.java Tue Apr 24 00:39:20 2012
@@ -32,7 +32,7 @@ import org.apache.maven.plugins.changes.
/**
* Goal which checks that the changes.xml file has the necessary data to
* generate an announcement or a report for the current release.
- *
+ *
* @goal changes-check
* @author Justin Edelson
* @author Dennis Lundberg
@@ -64,6 +64,14 @@ public class ChangesCheckMojo extends Ab
*/
private File xmlPath;
+ /**
+ * Flag controlling snapshot processing. If set, versions ending with <code>-SNAPSHOT</code> won't be checked.
+ *
+ * @parameter expression="${changes.skipSnapshots}" default-value="false"
+ * @since 2.7
+ */
+ private boolean skipSnapshots;
+
private ReleaseUtils releaseUtils = new ReleaseUtils( getLog() );
/**
@@ -74,16 +82,22 @@ public class ChangesCheckMojo extends Ab
public void execute()
throws MojoExecutionException
{
- if ( xmlPath.exists() )
+ if ( this.version.endsWith( "-SNAPSHOT" ) && this.skipSnapshots )
+ {
+ getLog().info( "Skipping snapshot version '" + this.version + "'." );
+ }
+ else if ( xmlPath.exists() )
{
ChangesXML xml = new ChangesXML( xmlPath, getLog() );
ReleaseUtils releaseUtils = new ReleaseUtils( getLog() );
- Release release = releaseUtils.getLatestRelease( releaseUtils.convertReleaseList( xml.getReleaseList() ),
- version );
+ Release release =
+ releaseUtils.getLatestRelease( releaseUtils.convertReleaseList( xml.getReleaseList() ), version );
+
if ( !isValidDate( release.getDateRelease(), releaseDateFormat ) )
{
throw new MojoExecutionException(
"The file " + xmlPath.getAbsolutePath() + " has an invalid release date." );
+
}
}
else