mirror of
https://github.com/apache/maven.git
synced 2025-02-22 01:45:37 +00:00
[MNG-1701] Validate that a plugin is not configured twice in the pom
o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@928424 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b1880e6671
commit
8bb7612e0d
@ -436,6 +436,7 @@ public static Test suite()
|
||||
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 );
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
}
|
49
its/core-it-suite/src/test/resources/mng-1701/pom.xml
Normal file
49
its/core-it-suite/src/test/resources/mng-1701/pom.xml
Normal file
@ -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>
|
@ -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>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user