mirror of https://github.com/apache/maven.git
MNG-5387: Add ability to replace an artifact in mid-build
o integration test. git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@1413359 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7f8e038f68
commit
2ae56a0cf3
|
@ -104,7 +104,9 @@ public class IntegrationTestSuite
|
|||
// -------------------------------------------------------------------------------------------------------------
|
||||
// Tests that don't run stable and need to be fixed
|
||||
// -------------------------------------------------------------------------------------------------------------
|
||||
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
|
||||
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
|
||||
|
||||
suite.addTestSuite( MavenITmng5387ArtifactReplacementPlugin.class );
|
||||
suite.addTestSuite( MavenITmng5382Jsr330Plugin.class );
|
||||
suite.addTestSuite( MavenITmng5338FileOptionToDirectory.class );
|
||||
suite.addTestSuite( MavenITmng5280SettingsProfilesRepositoriesOrderTest.class );
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
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.FileUtils;
|
||||
import org.apache.maven.it.util.ResourceExtractor;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class MavenITmng5387ArtifactReplacementPlugin
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
|
||||
private File testDir;
|
||||
|
||||
public MavenITmng5387ArtifactReplacementPlugin()
|
||||
{
|
||||
super( "[3.1,)" );
|
||||
}
|
||||
|
||||
public void setUp()
|
||||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5387" );
|
||||
|
||||
}
|
||||
|
||||
protected void tearDown()
|
||||
throws Exception
|
||||
{
|
||||
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testArtifactReplacementExecution()
|
||||
throws Exception
|
||||
{
|
||||
Verifier v0 = newVerifier( testDir.getAbsolutePath(), "remote" );
|
||||
v0.setAutoclean( false );
|
||||
v0.deleteDirectory( "target" );
|
||||
v0.deleteArtifacts( "org.apache.maven.its.mng5387" );
|
||||
v0.executeGoal( "install" );
|
||||
v0.verifyErrorFreeLog();
|
||||
v0.resetStreams();
|
||||
|
||||
String path = v0.getArtifactPath( "org.apache.maven.its.mng5387", "mng5387-it", "0.0.1-SNAPSHOT", "txt", "c" );
|
||||
String contents = FileUtils.fileRead( new File( path ), "utf-8" );
|
||||
assertTrue( contents.contains( "This is the second file" ) );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
<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.mng5387</groupId>
|
||||
<artifactId>mng5387-it</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Test multiple attachments</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-artifacts-1</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>attach-artifact</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifacts>
|
||||
<artifact>
|
||||
<file>src/stuff/something.txt</file>
|
||||
<type>txt</type>
|
||||
<classifier>c</classifier>
|
||||
</artifact>
|
||||
</artifacts>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>attach-artifacts-2</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>attach-artifact</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifacts>
|
||||
<artifact>
|
||||
<file>src/stuff/somethingelse.txt</file>
|
||||
<type>txt</type>
|
||||
<classifier>c</classifier>
|
||||
</artifact>
|
||||
</artifacts>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1 @@
|
|||
This is the first file.
|
|
@ -0,0 +1 @@
|
|||
This is the second file.
|
Loading…
Reference in New Issue