mirror of
https://github.com/apache/maven.git
synced 2025-02-07 10:38:47 +00:00
o Extended IT to check that offline builds do not fail when required artifacts reside in local repo
(MNG-2883 was originally meant as an addition to MNG-2433) git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@711281 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3162030a3a
commit
23fde60c04
@ -51,22 +51,23 @@
|
||||
public class MavenITmng2883LegacyRepoOfflineTest
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
|
||||
public MavenITmng2883LegacyRepoOfflineTest()
|
||||
{
|
||||
super( "(2.0.4,)" );
|
||||
super( "(2.0.9,2.1.0-M1),(2.1.0-M1,)" );
|
||||
}
|
||||
|
||||
public void testParentUnresolvable()
|
||||
throws Exception
|
||||
{
|
||||
String testName = "parent";
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(),
|
||||
"/mng-2883/"
|
||||
+ testName );
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2883/" + testName );
|
||||
|
||||
Verifier verifier;
|
||||
|
||||
verifier = new Verifier( testDir.getAbsolutePath() );
|
||||
verifier.setAutoclean( false );
|
||||
verifier.deleteDirectory( "target" );
|
||||
|
||||
File settings = writeSettings( testDir );
|
||||
List cliOptions = new ArrayList();
|
||||
@ -93,14 +94,17 @@ public void testParentUnresolvable()
|
||||
cliOptions.add( "-o" );
|
||||
|
||||
verifier.setCliOptions( cliOptions );
|
||||
verifier.setAutoclean( false );
|
||||
|
||||
// re-run in offline mode, should still succeed by using local repo
|
||||
verifier.setLogFileName( "log-parent-b.txt" );
|
||||
verifier.executeGoal( "initialize" );
|
||||
|
||||
// clear out the parent POM if it's in the local repository.
|
||||
verifier.deleteArtifact( "org.apache.maven.its.mng2883", "parent", "1.0-SNAPSHOT", "pom" );
|
||||
|
||||
try
|
||||
{
|
||||
verifier.setLogFileName( "log-parent-b.txt" );
|
||||
verifier.setLogFileName( "log-parent-c.txt" );
|
||||
verifier.executeGoal( "initialize" );
|
||||
|
||||
fail( "Build should fail with unresolvable parent POM." );
|
||||
@ -153,13 +157,13 @@ public void testDependencyUnresolvable()
|
||||
throws Exception
|
||||
{
|
||||
String testName = "dependency";
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(),
|
||||
"/mng-2883/"
|
||||
+ testName );
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2883/" + testName );
|
||||
|
||||
Verifier verifier;
|
||||
|
||||
verifier = new Verifier( testDir.getAbsolutePath() );
|
||||
verifier.setAutoclean( false );
|
||||
verifier.deleteDirectory( "target" );
|
||||
|
||||
List cliOptions = new ArrayList();
|
||||
|
||||
@ -188,13 +192,17 @@ public void testDependencyUnresolvable()
|
||||
|
||||
verifier.setCliOptions( cliOptions );
|
||||
|
||||
// re-run in offline mode, should still succeed by using local repo
|
||||
verifier.setLogFileName( "log-dep-b.txt" );
|
||||
verifier.executeGoal( "compile" );
|
||||
|
||||
// clear out the dependency if it's in the local repository.
|
||||
verifier.deleteArtifact( "org.apache.maven.its.mng2883", "dep", "1.0-SNAPSHOT", "pom" );
|
||||
verifier.deleteArtifact( "org.apache.maven.its.mng2883", "dep", "1.0-SNAPSHOT", "jar" );
|
||||
|
||||
try
|
||||
{
|
||||
verifier.setLogFileName( "log-dep-b.txt" );
|
||||
verifier.setLogFileName( "log-dep-c.txt" );
|
||||
verifier.executeGoal( "compile" );
|
||||
|
||||
fail( "Build should fail with unresolvable dependency artifact." );
|
||||
@ -249,19 +257,16 @@ public void testPluginUnresolvable()
|
||||
throws Exception
|
||||
{
|
||||
String testName = "plugin";
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(),
|
||||
"/mng-2883/"
|
||||
+ testName );
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2883/" + testName );
|
||||
|
||||
Verifier verifier;
|
||||
|
||||
verifier = new Verifier( testDir.getAbsolutePath() );
|
||||
verifier.setAutoclean( false );
|
||||
verifier.deleteDirectory( "target" );
|
||||
|
||||
List cliOptions = new ArrayList();
|
||||
|
||||
// the centerpiece of these tests!
|
||||
cliOptions.add( "-o" );
|
||||
|
||||
File settings = writeSettings( testDir );
|
||||
|
||||
// used to inject the remote repository
|
||||
@ -270,6 +275,18 @@ public void testPluginUnresolvable()
|
||||
|
||||
verifier.setCliOptions( cliOptions );
|
||||
|
||||
verifier.setLogFileName( "log-plugin-a.txt" );
|
||||
verifier.executeGoal( "org.apache.maven.its.mng2883:plugin:1.0-SNAPSHOT:run" );
|
||||
|
||||
// the centerpiece of these tests!
|
||||
cliOptions.add( "-o" );
|
||||
|
||||
verifier.setCliOptions( cliOptions );
|
||||
|
||||
// re-run in offline mode, should still succeed by using local repo
|
||||
verifier.setLogFileName( "log-plugin-b.txt" );
|
||||
verifier.executeGoal( "org.apache.maven.its.mng2883:plugin:1.0-SNAPSHOT:run" );
|
||||
|
||||
// clear out the dependency if it's in the local repository.
|
||||
verifier.deleteArtifact( "org.apache.maven.its.mng2883", "plugin", "1.0-SNAPSHOT", "pom" );
|
||||
verifier.deleteArtifact( "org.apache.maven.its.mng2883", "plugin", "1.0-SNAPSHOT", "jar" );
|
||||
|
@ -1,3 +1,24 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<settings>
|
||||
<profiles>
|
||||
<profile>
|
||||
@ -7,6 +28,11 @@
|
||||
<id>testing-repo</id>
|
||||
<url>file://@TESTDIR@/remote-repository</url>
|
||||
<layout>legacy</layout>
|
||||
<snapshots>
|
||||
<checksumPolicy>ignore</checksumPolicy>
|
||||
<!-- NOTE: Trigger update regardless of timestamps -->
|
||||
<updatePolicy>always</updatePolicy>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
@ -14,6 +40,11 @@
|
||||
<id>testing-repo</id>
|
||||
<url>file://@TESTDIR@/remote-repository</url>
|
||||
<layout>legacy</layout>
|
||||
<snapshots>
|
||||
<checksumPolicy>ignore</checksumPolicy>
|
||||
<!-- NOTE: Trigger update regardless of timestamps -->
|
||||
<updatePolicy>always</updatePolicy>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
@ -21,4 +52,4 @@
|
||||
<activeProfiles>
|
||||
<activeProfile>remote-repository</activeProfile>
|
||||
</activeProfiles>
|
||||
</settings>
|
||||
</settings>
|
||||
|
Loading…
x
Reference in New Issue
Block a user