You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2016/11/20 14:42:29 UTC
svn commit: r1770562 - in /maven/plugin-tools/trunk/maven-plugin-plugin/src:
it/mplugin-329_report-since/ it/mplugin-329_report-since/src/
it/mplugin-329_report-since/src/main/
it/mplugin-329_report-since/src/main/java/
it/mplugin-329_report-since/src/...
Author: rfscholte
Date: Sun Nov 20 14:42:29 2016
New Revision: 1770562
URL: http://svn.apache.org/viewvc?rev=1770562&view=rev
Log:
[MPLUGIN-319] @since values ignored in report
Only use plugin.xml for M3.4.0 and above due to MNG-6109
Added:
maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/
maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/invoker.properties
maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/pom.xml
maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/src/
maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/src/main/
maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/src/main/java/
maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/src/main/java/org/
maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/src/main/java/org/MyMojo.java
maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/verify.groovy
Modified:
maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk/pom.xml
maven/plugin-tools/trunk/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java
Added: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/invoker.properties?rev=1770562&view=auto
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/invoker.properties (added)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/invoker.properties Sun Nov 20 14:42:29 2016
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.goals = clean plugin:report
Added: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/pom.xml?rev=1770562&view=auto
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/pom.xml (added)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/pom.xml Sun Nov 20 14:42:29 2016
@@ -0,0 +1,86 @@
+<?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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.its.plugin</groupId>
+ <artifactId>report-since</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>@sitePluginVersion@</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>2.4</version>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>index</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
Added: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/src/main/java/org/MyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/src/main/java/org/MyMojo.java?rev=1770562&view=auto
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/src/main/java/org/MyMojo.java (added)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/src/main/java/org/MyMojo.java Sun Nov 20 14:42:29 2016
@@ -0,0 +1,67 @@
+package org;
+
+/*
+ * 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 org.apache.maven.plugin.AbstractMojo;
+
+/**
+ * Does nothing.
+ *
+ * @goal noop
+ * @phase process-sources
+ * @requiresDependencyResolution test
+ * @requiresDirectInvocation true
+ * @requiresOnline
+ * @inheritByDefault false
+ * @execute phase="compile"
+ * @aggregator
+ * @since 1.0
+ *
+ * @deprecated You don't use test goals, do you?
+ */
+public class MyMojo
+ extends AbstractMojo
+{
+
+ /**
+ * This is a test.
+ *
+ * @parameter
+ * @required
+ */
+ @SuppressWarnings( "unused" )
+ private String required;
+
+ /**
+ * This is a test.
+ *
+ * @parameter expression="${string}" default-value="${project.version}/</markup-must-be-escaped>"
+ * @deprecated Just testing.
+ * @since 1.1
+ */
+ @SuppressWarnings( "unused" )
+ private String string;
+
+ public void execute()
+ {
+ // intentional do nothing
+ }
+
+}
Added: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/verify.groovy?rev=1770562&view=auto
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/verify.groovy (added)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/mplugin-329_report-since/verify.groovy Sun Nov 20 14:42:29 2016
@@ -0,0 +1,27 @@
+
+/*
+ * 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, 'target/generated-site' ).exists()
+
+content = new File( basedir, 'target/generated-site/xdoc/noop-mojo.xml' ).text
+
+assert content.contains( '<li><strong>Since</strong>: <code>1.0</code></li>' )
+assert content.contains( '<li><strong>Since</strong>: <code>1.1</code></li>' )
+
+return true
\ No newline at end of file
Modified: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk/pom.xml?rev=1770562&r1=1770561&r2=1770562&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk/pom.xml (original)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk/pom.xml Sun Nov 20 14:42:29 2016
@@ -90,6 +90,10 @@ under the License.
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>@project.version@</version>
+ <configuration>
+ <!-- ignore MNG-6109 issue -->
+ <pluginXmlSpec>[2.0,)</pluginXmlSpec>
+ </configuration>
</plugin>
</plugins>
</reporting>
Modified: maven/plugin-tools/trunk/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java?rev=1770562&r1=1770561&r2=1770562&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java Sun Nov 20 14:42:29 2016
@@ -19,10 +19,24 @@ package org.apache.maven.plugin.plugin;
* under the License.
*/
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.Set;
+
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.siterenderer.Renderer;
+import org.apache.maven.execution.RuntimeInformation;
import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
@@ -50,17 +64,6 @@ import org.codehaus.plexus.configuration
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.Xpp3Dom;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.ResourceBundle;
-import java.util.Set;
-
/**
* Generates the Plugin's documentation report: <code>plugin-info.html</code> plugin overview page,
* and one <code><i>goal</i>-mojo.html</code> per goal.
@@ -186,6 +189,19 @@ public class PluginReport
*/
@Parameter( defaultValue = "${localRepository}", required = true, readonly = true )
protected ArtifactRepository local;
+
+ /**
+ * @since 3.5.1
+ */
+ @Component
+ private RuntimeInformation rtInfo;
+
+ /**
+ * By default pluginXml should be read with Maven-3.4.0+ (MNG-6109)
+ * For some integration-tests this is not an issue, they can reduce this spec.
+ */
+ @Parameter( readonly = true )
+ private String pluginXmlSpec = "(3.3.9,)";
/**
* {@inheritDoc}
@@ -250,19 +266,22 @@ public class PluginReport
private PluginDescriptor extractPluginDescriptor()
throws MavenReportException
{
- PluginDescriptorBuilder builder = new PluginDescriptorBuilder();
- try
- {
- return builder.build( new FileReader( new File( project.getBuild().getOutputDirectory(),
- "META-INF/maven/plugin.xml" ) ) );
- }
- catch ( FileNotFoundException e )
+ if ( usePluginXml() )
{
- getLog().debug( "Failed to read META-INF/maven/plugin.xml, fall back to mojoScanner" );
- }
- catch ( PlexusConfigurationException e )
- {
- getLog().debug( "Failed to read META-INF/maven/plugin.xml, fall back to mojoScanner" );
+ PluginDescriptorBuilder builder = new PluginDescriptorBuilder();
+ try
+ {
+ return builder.build( new FileReader( new File( project.getBuild().getOutputDirectory(),
+ "META-INF/maven/plugin.xml" ) ) );
+ }
+ catch ( FileNotFoundException e )
+ {
+ getLog().debug( "Failed to read META-INF/maven/plugin.xml, fall back to mojoScanner" );
+ }
+ catch ( PlexusConfigurationException e )
+ {
+ getLog().debug( "Failed to read META-INF/maven/plugin.xml, fall back to mojoScanner" );
+ }
}
// Copy from AbstractGeneratorMojo#execute()
@@ -319,6 +338,19 @@ public class PluginReport
return pluginDescriptor;
}
+ private boolean usePluginXml()
+ {
+ try
+ {
+ VersionRange versionRange = VersionRange.createFromVersionSpec( pluginXmlSpec );
+ return versionRange.containsVersion( rtInfo.getApplicationVersion() );
+ }
+ catch ( InvalidVersionSpecificationException e )
+ {
+ return false;
+ }
+ }
+
/**
* {@inheritDoc}
*/