Author: bentmann
Date: Sat May 2 18:10:05 2009
New Revision: 770974
URL: http://svn.apache.org/viewvc?rev=770974&view=rev
Log:
[MANT-51] Configuration from plugin management is not considered
Added:
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/pom.xml
(with props)
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/src/
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/src/main/
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/src/main/java/
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/src/main/java/Main.java
(with props)
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/verify.bsh
(with props)
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/pom.xml
(with props)
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/src/
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/src/main/
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/src/main/java/
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/src/main/java/Main.java
(with props)
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/verify.bsh
(with props)
Modified:
maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java
Added:
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/pom.xml?rev=770974&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/pom.xml
(added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/pom.xml
Sat May 2 18:10:05 2009
@@ -0,0 +1,39 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.its.ant</groupId>
+ <artifactId>plugin-mngt-config-only</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <description>
+ Checks the extraction of plugin configuration when only plugin management
is present.
+ </description>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <target>1.3</target>
+ <source>1.4</source>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <!-- NOTE: It's essential part of this test to not define the
maven-compiler-plugin here! -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ant-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange:
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added:
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/src/main/java/Main.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/src/main/java/Main.java?rev=770974&view=auto
==============================================================================
---
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/src/main/java/Main.java
(added)
+++
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/src/main/java/Main.java
Sat May 2 18:10:05 2009
@@ -0,0 +1,6 @@
+public class Main
+{
+
+ private String test = "it";
+
+}
Propchange:
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/src/main/java/Main.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/src/main/java/Main.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added:
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/verify.bsh
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/verify.bsh?rev=770974&view=auto
==============================================================================
---
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/verify.bsh
(added)
+++
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/verify.bsh
Sat May 2 18:10:05 2009
@@ -0,0 +1,25 @@
+import java.io.*;
+import java.util.*;
+import java.util.regex.*;
+import org.codehaus.plexus.util.*;
+
+File buildFile = new File( basedir, "maven-build.xml" );
+String xml = FileUtils.fileRead( buildFile, "UTF-8" );
+
+Matcher m = Pattern.compile( "<javac\\s+[^>]*?>" ).matcher( xml );
+if ( !m.find() )
+{
+ throw new Exception( "Build script does not contain <javac> task." );
+}
+
+if ( m.group().indexOf( "target=\"1.3\"" ) < 0 )
+{
+ throw new Exception( "<javac> does not define target=1.3" );
+}
+
+if ( m.group().indexOf( "source=\"1.4\"" ) < 0 )
+{
+ throw new Exception( "<javac> does not define source=1.4" );
+}
+
+return true;
Propchange:
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/verify.bsh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config-only/verify.bsh
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/pom.xml?rev=770974&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/pom.xml
(added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/pom.xml Sat
May 2 18:10:05 2009
@@ -0,0 +1,48 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.its.ant</groupId>
+ <artifactId>plugin-mngt-config</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <description>
+ Checks the extraction of plugin configuration when plugin management is
also present.
+ </description>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <!-- "target" checks the general configuration via plugin
management -->
+ <target>1.3</target>
+ <!-- "source" checks that normal plugin configuration is dominant
over plugin management -->
+ <source>9.9</source>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.4</source>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ant-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange:
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added:
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/src/main/java/Main.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/src/main/java/Main.java?rev=770974&view=auto
==============================================================================
---
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/src/main/java/Main.java
(added)
+++
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/src/main/java/Main.java
Sat May 2 18:10:05 2009
@@ -0,0 +1,6 @@
+public class Main
+{
+
+ private String test = "it";
+
+}
Propchange:
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/src/main/java/Main.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/src/main/java/Main.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/verify.bsh
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/verify.bsh?rev=770974&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/verify.bsh
(added)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/verify.bsh
Sat May 2 18:10:05 2009
@@ -0,0 +1,25 @@
+import java.io.*;
+import java.util.*;
+import java.util.regex.*;
+import org.codehaus.plexus.util.*;
+
+File buildFile = new File( basedir, "maven-build.xml" );
+String xml = FileUtils.fileRead( buildFile, "UTF-8" );
+
+Matcher m = Pattern.compile( "<javac\\s+[^>]*?>" ).matcher( xml );
+if ( !m.find() )
+{
+ throw new Exception( "Build script does not contain <javac> task." );
+}
+
+if ( m.group().indexOf( "target=\"1.3\"" ) < 0 )
+{
+ throw new Exception( "<javac> does not define target=1.3" );
+}
+
+if ( m.group().indexOf( "source=\"1.4\"" ) < 0 )
+{
+ throw new Exception( "<javac> does not define source=1.4" );
+}
+
+return true;
Propchange:
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/verify.bsh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-ant-plugin/src/it/plugin-mngt-config/verify.bsh
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified:
maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java?rev=770974&r1=770973&r2=770974&view=diff
==============================================================================
---
maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java
(original)
+++
maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java
Sat May 2 18:10:05 2009
@@ -946,6 +946,13 @@
{
plugins.add( it.next() );
}
+ if ( project.getBuild().getPluginManagement() != null )
+ {
+ for ( Iterator it =
project.getBuild().getPluginManagement().getPlugins().iterator(); it.hasNext();
)
+ {
+ plugins.add( it.next() );
+ }
+ }
for ( Iterator it = plugins.iterator(); it.hasNext(); )
{