You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by de...@apache.org on 2014/03/10 16:14:13 UTC

svn commit: r1575964 - in /maven/plugins/trunk/maven-pmd-plugin/src: it/MPMD-172/ it/MPMD-172/src/ it/MPMD-172/src/main/ it/MPMD-172/src/main/resources/ main/java/org/apache/maven/plugin/pmd/

Author: dennisl
Date: Mon Mar 10 15:14:13 2014
New Revision: 1575964

URL: http://svn.apache.org/r1575964
Log:
[MPMD-172] Warning about missing XRef for module with no source.

Added:
    maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/
    maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/invoker.properties   (with props)
    maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/pom.xml   (with props)
    maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/src/
    maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/src/main/
    maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/src/main/resources/
    maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/src/main/resources/my.properties   (with props)
    maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/verify.groovy   (with props)
Modified:
    maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/AbstractPmdReport.java

Added: maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/invoker.properties?rev=1575964&view=auto
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/invoker.properties (added)
+++ maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/invoker.properties Mon Mar 10 15:14:13 2014
@@ -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 verify jxr:jxr pmd:pmd

Propchange: maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author Id

Added: maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/pom.xml?rev=1575964&view=auto
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/pom.xml (added)
+++ maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/pom.xml Mon Mar 10 15:14:13 2014
@@ -0,0 +1,51 @@
+<?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.plugin.pmd.its</groupId>
+  <artifactId>MPMD-172</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <description>
+    Verify that no WARNING is issued from the plugin during the build.
+  </description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jxr-plugin</artifactId>
+        <version>2.4</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-pmd-plugin</artifactId>
+        <version>@project.version@</version>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author Id

Added: maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/src/main/resources/my.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/src/main/resources/my.properties?rev=1575964&view=auto
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/src/main/resources/my.properties (added)
+++ maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/src/main/resources/my.properties Mon Mar 10 15:14:13 2014
@@ -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.
+
+some.property = value

Propchange: maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/src/main/resources/my.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/src/main/resources/my.properties
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author Id

Added: maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/verify.groovy?rev=1575964&view=auto
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/verify.groovy (added)
+++ maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/verify.groovy Mon Mar 10 15:14:13 2014
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+File buildLog = new File( basedir, 'build.log' )
+assert buildLog.exists()
+
+// This warning should not appear in the log
+assert 0 == buildLog.getText().count('[WARNING] Unable to locate Source XRef to link to - DISABLED')

Propchange: maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/verify.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-pmd-plugin/src/it/MPMD-172/verify.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author Id

Modified: maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/AbstractPmdReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/AbstractPmdReport.java?rev=1575964&r1=1575963&r2=1575964&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/AbstractPmdReport.java (original)
+++ maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/AbstractPmdReport.java Mon Mar 10 15:14:13 2014
@@ -271,9 +271,6 @@ public abstract class AbstractPmdReport
     protected Map<File, PmdFileInfo> getFilesToProcess()
         throws IOException
     {
-        String sourceXref = constructXRefLocation( false );
-        String testXref = includeTests ? constructXRefLocation( true ) : "";
-
         if ( aggregate && !project.isExecutionRoot() )
         {
             return Collections.emptyMap();
@@ -296,11 +293,14 @@ public abstract class AbstractPmdReport
 
         if ( compileSourceRoots != null )
         {
-
             for ( String root : compileSourceRoots )
             {
                 File sroot = new File( root );
-                directories.add( new PmdFileInfo( project, sroot, sourceXref ) );
+                if ( sroot.exists() )
+                {
+                    String sourceXref = constructXRefLocation( false );
+                    directories.add( new PmdFileInfo( project, sroot, sourceXref ) );
+                }
             }
 
         }
@@ -311,7 +311,11 @@ public abstract class AbstractPmdReport
                 for ( String root : testSourceRoots )
                 {
                     File sroot = new File( root );
-                    directories.add( new PmdFileInfo( project, sroot, testXref ) );
+                    if ( sroot.exists() )
+                    {
+                        String testXref = constructXRefLocation( true );
+                        directories.add( new PmdFileInfo( project, sroot, testXref ) );
+                    }
                 }
             }
         }
@@ -324,7 +328,11 @@ public abstract class AbstractPmdReport
                 for ( String root : localCompileSourceRoots )
                 {
                     File sroot = new File( root );
-                    directories.add( new PmdFileInfo( localProject, sroot, sourceXref ) );
+                    if ( sroot.exists() )
+                    {
+                        String sourceXref = constructXRefLocation( false );
+                        directories.add( new PmdFileInfo( localProject, sroot, sourceXref ) );
+                    }
                 }
                 if ( includeTests )
                 {
@@ -333,7 +341,11 @@ public abstract class AbstractPmdReport
                     for ( String root : localTestCompileSourceRoots )
                     {
                         File sroot = new File( root );
-                        directories.add( new PmdFileInfo( localProject, sroot, testXref ) );
+                      if ( sroot.exists() )
+                      {
+                          String testXref = constructXRefLocation( true );
+                          directories.add( new PmdFileInfo( localProject, sroot, testXref ) );
+                      }
                     }
                 }
             }