maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r1164584 - in /maven/plugin-tools/trunk/maven-plugin-plugin/src: it/plugin-info-jdk-default-version/ it/plugin-info-jdk-default-version/src/ it/plugin-info-jdk-default-version/src/main/ it/plugin-info-jdk-default-version/src/main/java/ it/p...
Date Fri, 02 Sep 2011 15:38:56 GMT
Author: bimargulies
Date: Fri Sep  2 15:38:56 2011
New Revision: 1164584

URL: http://svn.apache.org/viewvc?rev=1164584&view=rev
Log:
[MPLUGIN-177] Required JDK incorrectly specified if using default for m-compiler-p
o if the target isn't there, refer the reader to the compiler plugin. Don't try to 
maintain a list of default versions for compiler plugin versions, and never say '1.1'.

Added:
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/pom.xml
  (with props)
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/src/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/src/main/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/src/main/java/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/src/main/java/org/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/src/main/java/org/apache/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/src/main/java/org/apache/maven/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/src/main/java/org/apache/maven/plugins/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/src/main/java/org/apache/maven/plugins/issues/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/src/main/java/org/apache/maven/plugins/issues/plugin/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/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-version/src/site/
    maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/src/site/site.xml
  (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-version/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/pom.xml?rev=1164584&view=auto
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/pom.xml
(added)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/pom.xml
Fri Sep  2 15:38:56 2011
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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-version</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>
+                    <!--
+					<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-version/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/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-version/src/main/java/org/apache/maven/plugins/issues/plugin/MyMojo.java?rev=1164584&view=auto
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/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-version/src/main/java/org/apache/maven/plugins/issues/plugin/MyMojo.java
Fri Sep  2 15:38:56 2011
@@ -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-version/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-version/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-version/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/src/site/site.xml?rev=1164584&view=auto
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/src/site/site.xml
(added)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-info-jdk-default-version/src/site/site.xml
Fri Sep  2 15:38:56 2011
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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-version/src/site/site.xml
------------------------------------------------------------------------------
    svn:eol-style = native

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

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=1164584&r1=1164583&r2=1164584&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
Fri Sep  2 15:38:56 2011
@@ -615,8 +615,7 @@ public class PluginReport
             }
             if ( jdk == null )
             {
-                // The Maven Compiler Plugin uses a fixed default value, not the current
JDK version.
-                jdk = "1.1";
+                jdk = "Unknown";
             }
 
             return jdk;
@@ -635,6 +634,7 @@ public class PluginReport
             }
 
             String jdk = null;
+            String backupJdk = null;
             for ( Iterator it = pluginsAsMap.keySet().iterator(); it.hasNext(); )
             {
                 String key = it.next().toString();
@@ -647,17 +647,18 @@ public class PluginReport
                 Object value = pluginsAsMap.get( key );
                 Xpp3Dom pluginConf = null;
 
+                backupJdk = "Default version for maven-compiler-plugin";
                 if ( value instanceof Plugin )
                 {
                     Plugin plugin = (Plugin) value;
-
+                    backupJdk = "Default target for maven-compiler-plugin version " + plugin.getVersion();
                     pluginConf = (Xpp3Dom) plugin.getConfiguration();
                 }
 
                 if ( value instanceof ReportPlugin )
                 {
                     ReportPlugin reportPlugin = (ReportPlugin) value;
-
+                    backupJdk = "Default target for maven-compiler-plugin version " + reportPlugin.getVersion();
                     pluginConf = (Xpp3Dom) reportPlugin.getConfiguration();
                 }
 
@@ -674,7 +675,14 @@ public class PluginReport
                 jdk = pluginConf.getChild( "target" ).getValue();
             }
 
-            return jdk;
+            if ( jdk == null ) 
+            {
+                return backupJdk;
+            }
+            else 
+            {
+                return jdk;
+            }
         }
     }
 }



Mime
View raw message