You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/08/14 17:19:53 UTC

svn commit: r804257 - in /maven/components/trunk/maven-core/src/test: java/org/apache/maven/project/ resources-project-builder/plugin-management-for-implicit-plugin/ resources-project-builder/plugin-management-for-implicit-plugin/child/

Author: bentmann
Date: Fri Aug 14 15:19:51 2009
New Revision: 804257

URL: http://svn.apache.org/viewvc?rev=804257&view=rev
Log:
[MNG-3018] pluginManagement configurations are not honoured when plugin is silently included

o Added UT

Added:
    maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/   (with props)
    maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/child/   (with props)
    maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/child/pom.xml   (with props)
    maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/pom.xml   (with props)
Modified:
    maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java
    maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java

Modified: maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java?rev=804257&r1=804256&r2=804257&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java (original)
+++ maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java Fri Aug 14 15:19:51 2009
@@ -21,6 +21,7 @@
 
 import java.util.Collection;
 import java.util.Collections;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
 
@@ -50,9 +51,10 @@
 {
 
     public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
-        throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, CycleDetectedInPluginGraphException, MojoNotFoundException
+        throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+        CycleDetectedInPluginGraphException, MojoNotFoundException
     {
-        return new MavenExecutionPlan( Collections.<MojoExecution>emptyList(), null );
+        return new MavenExecutionPlan( Collections.<MojoExecution> emptyList(), null );
     }
 
     public void execute( MavenSession session )
@@ -73,7 +75,36 @@
 
     public Set<Plugin> getPluginsBoundByDefaultToAllLifecycles( String packaging )
     {
-        return Collections.emptySet();
+        Set<Plugin> plugins;
+
+        // NOTE: The upper-case packaging name is intentional, that's a special hinting mode used for certain tests
+        if ( "JAR".equals( packaging ) )
+        {
+            plugins = new LinkedHashSet<Plugin>();
+
+            plugins.add( newPlugin( "maven-compiler-plugin" ) );
+            plugins.add( newPlugin( "maven-resources-plugin" ) );
+            plugins.add( newPlugin( "maven-surefire-plugin" ) );
+            plugins.add( newPlugin( "maven-jar-plugin" ) );
+            plugins.add( newPlugin( "maven-install-plugin" ) );
+            plugins.add( newPlugin( "maven-deploy-plugin" ) );
+        }
+        else
+        {
+            plugins = Collections.emptySet();
+        }
+
+        return plugins;
+    }
+
+    private Plugin newPlugin( String artifactId )
+    {
+        Plugin plugin = new Plugin();
+
+        plugin.setGroupId( "org.apache.maven.plugins" );
+        plugin.setArtifactId( artifactId );
+
+        return plugin;
     }
 
     public void populateDefaultConfigurationForPlugins( Collection<Plugin> plugins, RepositoryRequest repositoryRequest )

Modified: maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java?rev=804257&r1=804256&r2=804257&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java (original)
+++ maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java Fri Aug 14 15:19:51 2009
@@ -1650,6 +1650,17 @@
         }
     }
 
+    /** MNG-522, MNG-3018 */
+    public void testManagedPluginConfigurationAppliesToImplicitPluginsIntroducedByPackaging()
+        throws Exception
+    {
+        PomTestWrapper pom = buildPom( "plugin-management-for-implicit-plugin/child" );
+        assertEquals( "passed.txt",
+                      pom.getValue( "build/plugins[@artifactId='maven-resources-plugin']/configuration/pathname" ) );
+        assertEquals( "passed.txt",
+                      pom.getValue( "build/plugins[@artifactId='maven-it-plugin-log-file']/configuration/logFile" ) );
+    }
+
     private void assertPathSuffixEquals( String expected, Object actual )
     {
         String a = actual.toString();

Propchange: maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/
------------------------------------------------------------------------------
    bugtraq:label = Enter issue ID:

Propchange: maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/
------------------------------------------------------------------------------
    bugtraq:message = Issue id: %BUGID%

Propchange: maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/
------------------------------------------------------------------------------
    bugtraq:number = false

Propchange: maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/
------------------------------------------------------------------------------
    bugtraq:url = http://jira.codehaus.org/browse/%BUGID%

Propchange: maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/child/
------------------------------------------------------------------------------
    bugtraq:label = Enter issue ID:

Propchange: maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/child/
------------------------------------------------------------------------------
    bugtraq:message = Issue id: %BUGID%

Propchange: maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/child/
------------------------------------------------------------------------------
    bugtraq:number = false

Propchange: maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/child/
------------------------------------------------------------------------------
    bugtraq:url = http://jira.codehaus.org/browse/%BUGID%

Added: maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/child/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/child/pom.xml?rev=804257&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/child/pom.xml (added)
+++ maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/child/pom.xml Fri Aug 14 15:19:51 2009
@@ -0,0 +1,53 @@
+<?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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven.its.mng0522</groupId>
+    <artifactId>parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>child-project</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <!-- NOTE: The upper-case packaging name is intentional and triggers a special mode in the EmptyLifecycleExecutor -->
+  <packaging>JAR</packaging>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-log-file</artifactId>
+        <executions>
+          <execution>
+            <id>test</id>
+            <phase>initialize</phase>
+            <goals>
+              <goal>reset</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/child/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/child/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/pom.xml?rev=804257&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/pom.xml (added)
+++ maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/pom.xml Fri Aug 14 15:19:51 2009
@@ -0,0 +1,61 @@
+<?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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng0522</groupId>
+  <artifactId>parent</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <name>Maven Integration Test :: MNG-522</name>
+  <description>Test for pluginManagement injection of plugin configuration.</description>
+
+  <modules>
+    <module>child</module>
+  </modules>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <!-- this checks handling of a plugin which is implicitly bound to the lifecycle -->
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-resources-plugin</artifactId>
+          <version>0.1-stub-SNAPSHOT</version>
+          <configuration>
+            <pathname>passed.txt</pathname>
+          </configuration>
+        </plugin>
+        <plugin>
+          <!-- this checks handling of a plugin which is explicitly bound to the lifecycle -->
+          <groupId>org.apache.maven.its.plugins</groupId>
+          <artifactId>maven-it-plugin-log-file</artifactId>
+          <version>2.1-SNAPSHOT</version>
+          <configuration>
+            <logFile>passed.txt</logFile>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>

Propchange: maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-core/src/test/resources-project-builder/plugin-management-for-implicit-plugin/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision