Author: bentmann Date: Sun Mar 28 15:03:41 2010 New Revision: 928424 URL: http://svn.apache.org/viewvc?rev=928424&view=rev Log: [MNG-1701] Validate that a plugin is not configured twice in the pom
o Added IT Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java (with props) maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-1701/ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-1701/pom.xml (with props) Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java?rev=928424&r1=928423&r2=928424&view=diff ============================================================================== --- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java (original) +++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java Sun Mar 28 15:03:41 2010 @@ -436,6 +436,7 @@ public class IntegrationTestSuite suite.addTestSuite( MavenITmng1908LegacySnapshotUpdateTest.class ); suite.addTestSuite( MavenITmng1830ShowVersionTest.class ); suite.addTestSuite( MavenITmng1703PluginMgmtDepInheritanceTest.class ); + suite.addTestSuite( MavenITmng1701DuplicatePluginTest.class ); suite.addTestSuite( MavenITmng1493NonStandardModulePomNamesTest.class ); suite.addTestSuite( MavenITmng1491ReactorArtifactIdCollisionTest.class ); suite.addTestSuite( MavenITmng1415QuotedSystemPropertiesTest.class ); Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java?rev=928424&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java (added) +++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java Sun Mar 28 15:03:41 2010 @@ -0,0 +1,72 @@ +package org.apache.maven.it; + +/* + * 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 org.apache.maven.it.util.ResourceExtractor; + +import java.io.File; +import java.util.Iterator; +import java.util.List; + +/** + * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-1701">MNG-1701</a>. + * + * @author Benjamin Bentmann + */ +public class MavenITmng1701DuplicatePluginTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng1701DuplicatePluginTest() + { + super( "[3.0-alpha-8,)" ); + } + + /** + * Verify that duplicate plugin declarations cause a warning. + */ + public void testit() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1701" ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + List lines = verifier.loadLines( verifier.getLogFileName(), "UTF-8" ); + boolean foundWarning = false; + for ( Iterator it = lines.iterator(); it.hasNext(); ) + { + String line = (String) it.next(); + + if ( line.startsWith( "[WARNING]" ) && + line.indexOf( "duplicate declaration of plugin org.apache.maven.its.plugins:maven-it-plugin-expression" ) > 0 ) + { + foundWarning = true; + } + } + + assertTrue( "Duplicate plugin warning wasn't generated.", foundWarning ); + } + +} Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-1701/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-1701/pom.xml?rev=928424&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-1701/pom.xml (added) +++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-1701/pom.xml Sun Mar 28 15:03:41 2010 @@ -0,0 +1,49 @@ +<?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.mng1701</groupId> + <artifactId>test</artifactId> + <version>1.0</version> + <packaging>pom</packaging> + + <name>Maven Integration Test :: MNG-1701</name> + <description> + Verify that duplicate plugin declarations cause a warning/error. + </description> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.its.plugins</groupId> + <artifactId>maven-it-plugin-expression</artifactId> + <version>2.1-SNAPSHOT</version> + </plugin> + <plugin> + <groupId>org.apache.maven.its.plugins</groupId> + <artifactId>maven-it-plugin-expression</artifactId> + <version>2.1-SNAPSHOT</version> + </plugin> + </plugins> + </build> +</project> Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-1701/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-1701/pom.xml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom?rev=928424&r1=928423&r2=928424&view=diff ============================================================================== --- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom (original) +++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom Sun Mar 28 15:03:41 2010 @@ -137,6 +137,22 @@ under the License. <!-- unresolvable property in plugin version (MNG-4405) --> <version>${missing.property}</version> </plugin> + <plugin> + <groupId>org.apache.maven.its.mng4405</groupId> + <artifactId>a</artifactId> + <!-- missing plugin version --> + </plugin> + <plugin> + <groupId>org.apache.maven.its.mng1701</groupId> + <artifactId>b</artifactId> + <version>1.0</version> + </plugin> + <plugin> + <!-- duplicate plugin declaration (MNG-1701) --> + <groupId>org.apache.maven.its.mng1701</groupId> + <artifactId>b</artifactId> + <version>1.0</version> + </plugin> </plugins> </build>