maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1637762 - in /maven/plugin-tools/trunk/maven-plugin-plugin/src: it/plugin-info-jdk-default-property/ it/plugin-info-jdk-default-property/src/ it/plugin-info-jdk-default-property/src/main/ it/plugin-info-jdk-default-property/src/main/java/ ...
Date Sun, 09 Nov 2014 23:26:30 GMT
Author: hboutemy
Date: Sun Nov  9 23:26:29 2014
New Revision: 1637762

URL: http://svn.apache.org/r1637762
Log:
[MPLUGIN-279] use default properties when no configuration in m-compiler-p

Added:
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/invoker.properties
  (with props)
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/pom.xml
  (with props)
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/main/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/main/java/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/main/java/org/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/main/java/org/apache/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/main/java/org/apache/maven/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/main/java/org/apache/maven/plugins/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/main/java/org/apache/maven/plugins/issues/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/main/java/org/apache/maven/plugins/issues/plugin/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/main/java/org/apache/maven/plugins/issues/plugin/MyMojo.java
  (with props)
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/site/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/site/site.xml
  (with props)
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/verify.groovy
  (with props)
Modified:
    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/plugin-info-jdk-default-property/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/invoker.properties?rev=1637762&view=auto
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/invoker.properties
(added)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/invoker.properties
Sun Nov  9 23:26:29 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 site -DskipTests

Propchange: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/invoker.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/pom.xml?rev=1637762&view=auto
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/pom.xml
(added)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/pom.xml
Sun Nov  9 23:26:29 2014
@@ -0,0 +1,87 @@
+<?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.its</groupId>
+  <artifactId>jdk-default-property</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>maven-plugin</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <maven.compiler.source>1.5</maven.compiler.source>
+    <maven.compiler.target>${maven.compiler.source}</maven.compiler.target>
+  </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>
+          <!--
+            <configuration>
+              <source>1.5</source>
+              <target>1.5</target>
+            </configuration>
+            -->
+        </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>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-plugin-plugin</artifactId>
+        <version>@project.version@</version>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>

Propchange: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/main/java/org/apache/maven/plugins/issues/plugin/MyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/main/java/org/apache/maven/plugins/issues/plugin/MyMojo.java?rev=1637762&view=auto
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/main/java/org/apache/maven/plugins/issues/plugin/MyMojo.java
(added)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/main/java/org/apache/maven/plugins/issues/plugin/MyMojo.java
Sun Nov  9 23:26:29 2014
@@ -0,0 +1,81 @@
+package org.apache.maven.plugins.issues.plugin;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+/**
+ * Goal which touches a timestamp file.
+ *
+ * @goal touch
+ * 
+ * @phase process-sources
+ */
+public class MyMojo
+    extends AbstractMojo
+{
+    /**
+     * Location of the file.
+     * @parameter expression="${project.build.directory}"
+     * @required
+     */
+    private File outputDirectory;
+
+    public void execute()
+        throws MojoExecutionException
+    {
+        File f = outputDirectory;
+
+        if ( !f.exists() )
+        {
+            f.mkdirs();
+        }
+
+        File touch = new File( f, "touch.txt" );
+
+        FileWriter w = null;
+        try
+        {
+            w = new FileWriter( touch );
+
+            w.write( "touch.txt" );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "Error creating file " + touch, e );
+        }
+        finally
+        {
+            if ( w != null )
+            {
+                try
+                {
+                    w.close();
+                }
+                catch ( IOException e )
+                {
+                    // ignore
+                }
+            }
+        }
+    }
+}

Propchange: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/main/java/org/apache/maven/plugins/issues/plugin/MyMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/main/java/org/apache/maven/plugins/issues/plugin/MyMojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/main/java/org/apache/maven/plugins/issues/plugin/MyMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/site/site.xml?rev=1637762&view=auto
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/site/site.xml
(added)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/site/site.xml
Sun Nov  9 23:26:29 2014
@@ -0,0 +1,30 @@
+<?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/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
+  <body>
+    <menu name="Overview">
+      <item name="Goals" href="plugin-info.html"/>
+    </menu>
+    <menu ref="reports" inherit="bottom" />
+  </body>
+</project>

Propchange: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/site/site.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/site/site.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/src/site/site.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/verify.groovy?rev=1637762&view=auto
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/verify.groovy
(added)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/verify.groovy
Sun Nov  9 23:26:29 2014
@@ -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/site' ).exists();
+
+content = new File( basedir, 'target/site/plugin-info.html' ).text;
+
+assert content.contains( '<td>1.5</td>' );
+assert !content.contains( '<td>Default target for maven-compiler-plugin version' );
+
+return true;
\ No newline at end of file

Propchange: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/verify.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-property/verify.groovy
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

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=1637762&r1=1637761&r2=1637762&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  9 23:26:29 2014
@@ -54,6 +54,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Properties;
 import java.util.ResourceBundle;
 import java.util.Set;
 
@@ -667,11 +668,13 @@ public class PluginReport
             String jdk = requirements.getJdk();
             if ( jdk == null )
             {
-                jdk = discoverJdkRequirementFromPlugins( project.getBuild().getPluginsAsMap()
);
+                jdk = discoverJdkRequirementFromPlugins( project.getBuild().getPluginsAsMap(),
project.getProperties() );
             }
             if ( jdk == null && project.getPluginManagement() != null )
             {
-                jdk = discoverJdkRequirementFromPlugins( project.getPluginManagement().getPluginsAsMap()
);
+                jdk =
+                    discoverJdkRequirementFromPlugins( project.getPluginManagement().getPluginsAsMap(),
+                                                       project.getProperties() );
             }
             if ( jdk == null )
             {
@@ -685,7 +688,7 @@ public class PluginReport
          * @param pluginsAsMap could be null
          * @return the value of the <code>target</code> in the configuration
of <code>maven-compiler-plugin</code>.
          */
-        private static String discoverJdkRequirementFromPlugins( Map<String, Object>
pluginsAsMap )
+        private static String discoverJdkRequirementFromPlugins( Map<String, Object>
pluginsAsMap, Properties props )
         {
             if ( pluginsAsMap == null )
             {
@@ -704,6 +707,9 @@ public class PluginReport
                 Object value = entry.getValue();
                 Xpp3Dom pluginConf = null;
 
+                // default value
+                jdk = props.getProperty( "maven.compiler.target" );
+
                 backupJdk = "Default version for maven-compiler-plugin";
                 if ( value instanceof Plugin )
                 {



Mime
View raw message