Author: rfscholte
Date: Sat Oct 27 17:19:26 2012
New Revision: 1402826

URL: http://svn.apache.org/viewvc?rev=1402826&view=rev
Log:
[MINVOKER-142] Make it possible to specify debug-mode in invoker.properties 

Added:
    maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/
    maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/pom.xml
    maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/src/
    maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/src/it/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/src/it/minvoker-142/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/src/it/minvoker-142/invoker.properties
    
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/src/it/minvoker-142/pom.xml
    
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/src/it/minvoker-142/verify.groovy
Modified:
    
maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/AbstractInvokerMojo.java
    
maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerProperties.java

Added: maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/pom.xml?rev=1402826&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/pom.xml 
(added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/pom.xml 
Sat Oct 27 17:19:26 2012
@@ -0,0 +1,64 @@
+<?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.invoker.its</groupId>
+  <artifactId>invocation-debug</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <description>
+    Test to check for usage of debug mode.
+  </description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-invoker-plugin</artifactId>
+        <version>@pom.version@</version>
+        <configuration>
+          <goals>
+            <goal>validate</goal>
+          </goals>
+          <debug>false</debug>
+          <postBuildHookScript>verify</postBuildHookScript>
+        </configuration>
+        <executions>
+          <execution>
+            <id>integration-test</id>
+            <phase>initialize</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/src/it/minvoker-142/invoker.properties
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/src/it/minvoker-142/invoker.properties?rev=1402826&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/src/it/minvoker-142/invoker.properties
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/src/it/minvoker-142/invoker.properties
 Sat Oct 27 17:19:26 2012
@@ -0,0 +1 @@
+invoker.debug = true
\ No newline at end of file

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/src/it/minvoker-142/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/src/it/minvoker-142/pom.xml?rev=1402826&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/src/it/minvoker-142/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/src/it/minvoker-142/pom.xml
 Sat Oct 27 17:19:26 2012
@@ -0,0 +1,54 @@
+<?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.invoker.its</groupId>
+  <artifactId>minvoker-142</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>1.1.1</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <AlwaysPass/>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/src/it/minvoker-142/verify.groovy
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/src/it/minvoker-142/verify.groovy?rev=1402826&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/src/it/minvoker-142/verify.groovy
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-debug/src/it/minvoker-142/verify.groovy
 Sat Oct 27 17:19:26 2012
@@ -0,0 +1,20 @@
+/*
+ * 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.text.contains( '[DEBUG] Executing rule: 
org.apache.maven.plugins.enforcer.AlwaysPass' )  
\ No newline at end of file

Modified: 
maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/AbstractInvokerMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/AbstractInvokerMojo.java?rev=1402826&r1=1402825&r2=1402826&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/AbstractInvokerMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/AbstractInvokerMojo.java
 Sat Oct 27 17:19:26 2012
@@ -512,6 +512,10 @@ public abstract class AbstractInvokerMoj
      * # A comma separated list of Maven versions on which this build should 
be run.
      * # Since plugin version 1.5
      * invoker.maven.version = 2.0.10+, !2.1.0, !2.2.0
+     * 
+     * # A boolean value controlling the debug logging level of Maven, , 
defaults to &quot;false&quot;
+     * # Since plugin version 1.8
+     * invoker.debug = true
      * </pre>
      *
      * @since 1.2

Modified: 
maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerProperties.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerProperties.java?rev=1402826&r1=1402825&r2=1402826&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerProperties.java
 (original)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerProperties.java
 Sat Oct 27 17:19:26 2012
@@ -81,6 +81,12 @@ class InvokerProperties
      */
     private static final String SYSTEM_PROPERTIES_FILE = 
"invoker.systemPropertiesFile";
 
+    
+    /**
+     * The constant for the invoker property.
+     */
+    private static final String DEBUG = "invoker.debug";
+    
     /**
      * Creates a new facade for the specified invoker properties. The 
properties will not be copied, so any changes to
      * them will be reflected by the facade.
@@ -162,7 +168,7 @@ class InvokerProperties
     public boolean isInvocationDefined( int index )
     {
         String[] keys =
-            { PROJECT, GOALS, PROFILES, MAVEN_OPTS, FAILURE_BEHAVIOR, 
NON_RECURSIVE, OFFLINE, SYSTEM_PROPERTIES_FILE };
+            { PROJECT, GOALS, PROFILES, MAVEN_OPTS, FAILURE_BEHAVIOR, 
NON_RECURSIVE, OFFLINE, SYSTEM_PROPERTIES_FILE, DEBUG };
         for ( int i = 0; i < keys.length; i++ )
         {
             if ( properties.getProperty( keys[i] + '.' + index ) != null )
@@ -233,6 +239,12 @@ class InvokerProperties
         {
             request.setOffline( Boolean.valueOf( offline ).booleanValue() );
         }
+        
+        String debug = get( DEBUG, index );
+        if( debug != null )
+        {
+            request.setDebug( Boolean.valueOf( debug ).booleanValue() );    
+        }
     }
 
     /**


Reply via email to