Author: olamy
Date: Tue May 30 02:28:50 2017
New Revision: 1796724

URL: http://svn.apache.org/viewvc?rev=1796724&view=rev
Log:
[MCOMPILER-298] Add support for "parameters" flag
fixes #114

Added:
    maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/
    
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/invoker.properties
   (with props)
    maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/pom.xml   
(with props)
    maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/
    maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/main/
    
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/main/java/
    
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/main/java/com/
    
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/main/java/com/foo/
    
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/main/java/com/foo/ParameterClass.java
   (with props)
    maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/test/
    
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/test/java/
    
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/test/java/com/
    
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/test/java/com/foo/
    
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/test/java/com/foo/ParameterTest.java
   (with props)
Modified:
    maven/plugins/trunk/maven-compiler-plugin/pom.xml
    
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java

Modified: maven/plugins/trunk/maven-compiler-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/pom.xml?rev=1796724&r1=1796723&r2=1796724&view=diff
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-compiler-plugin/pom.xml Tue May 30 02:28:50 2017
@@ -63,7 +63,7 @@ under the License.
       ! The following property is used in the integration tests MCOMPILER-157
     -->
     <mavenPluginPluginVersion>3.5</mavenPluginPluginVersion>
-    <plexusCompilerVersion>2.8.1</plexusCompilerVersion>
+    <plexusCompilerVersion>2.8.2-SNAPSHOT</plexusCompilerVersion>
     <groovyVersion>1.8.0</groovyVersion>
     <groovyEclipseCompilerVersion>2.7.0-01</groovyEclipseCompilerVersion>
     <groovy-eclipse-batch>2.0.4-04</groovy-eclipse-batch>

Added: 
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/invoker.properties
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/invoker.properties?rev=1796724&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/invoker.properties
 (added)
+++ 
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/invoker.properties
 Tue May 30 02:28:50 2017
@@ -0,0 +1,19 @@
+# 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.java.version = 1.8+
+invoker.goals = test

Propchange: 
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/pom.xml?rev=1796724&view=auto
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/pom.xml 
(added)
+++ maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/pom.xml Tue 
May 30 02:28:50 2017
@@ -0,0 +1,60 @@
+<?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.compiler.it</groupId>
+  <artifactId>mcompiler298</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <url>https://issues.apache.org/jira/browse/MCOMPILER-298</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.12</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+          <parameters>true</parameters>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: 
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/main/java/com/foo/ParameterClass.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/main/java/com/foo/ParameterClass.java?rev=1796724&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/main/java/com/foo/ParameterClass.java
 (added)
+++ 
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/main/java/com/foo/ParameterClass.java
 Tue May 30 02:28:50 2017
@@ -0,0 +1,29 @@
+package com.foo;
+
+/*
+ * 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.
+ */
+
+
+public class ParameterClass
+{
+    public void method( String parameterName )
+    {
+        // nothing
+    }
+}

Propchange: 
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/main/java/com/foo/ParameterClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/main/java/com/foo/ParameterClass.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/test/java/com/foo/ParameterTest.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/test/java/com/foo/ParameterTest.java?rev=1796724&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/test/java/com/foo/ParameterTest.java
 (added)
+++ 
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/test/java/com/foo/ParameterTest.java
 Tue May 30 02:28:50 2017
@@ -0,0 +1,36 @@
+package com.foo;
+
+/*
+ * 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 static org.junit.Assert.*;
+
+import org.junit.Test;
+
+
+
+public class ParameterTest
+{
+
+    @Test
+    public void testParameter() throws Exception
+    {
+        assertEquals( "parameterName", ParameterClass.class.getMethod( 
"method", String.class ).getParameters()[0].getName() );
+    }
+}

Propchange: 
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/test/java/com/foo/ParameterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-compiler-plugin/src/it/MCOMPILER-298/src/test/java/com/foo/ParameterTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: 
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java?rev=1796724&r1=1796723&r2=1796724&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
 Tue May 30 02:28:50 2017
@@ -118,6 +118,12 @@ public abstract class AbstractCompilerMo
     private boolean debug = true;
 
     /**
+     * Set to <code>true</code> to generate metadata for reflection on method 
parameters.
+     */
+    @Parameter( property = "maven.compiler.parameters", defaultValue = "false" 
)
+    private boolean parameters;
+
+    /**
      * Set to <code>true</code> to show messages about what the compiler is 
doing.
      */
     @Parameter( property = "maven.compiler.verbose", defaultValue = "false" )
@@ -588,6 +594,8 @@ public abstract class AbstractCompilerMo
             compilerConfiguration.setDebugLevel( debuglevel );
         }
 
+        compilerConfiguration.setParameters( parameters );
+
         compilerConfiguration.setVerbose( verbose );
 
         compilerConfiguration.setShowWarnings( showWarnings );


Reply via email to