mirror of
https://github.com/apache/maven.git
synced 2025-02-08 11:05:37 +00:00
[MNG-4489] [regression] Mirror/proxy/auth does not apply to repositories discovered in POMs of build extensions
o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@889458 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
48b86211ca
commit
ee9a264106
@ -85,6 +85,7 @@ public static Test suite()
|
|||||||
// suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
|
// suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
|
||||||
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
|
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
|
||||||
|
|
||||||
|
suite.addTestSuite( MavenITmng4489MirroringOfExtensionRepoTest.class );
|
||||||
suite.addTestSuite( MavenITmng4488ValidateExternalParenPomLenientTest.class );
|
suite.addTestSuite( MavenITmng4488ValidateExternalParenPomLenientTest.class );
|
||||||
suite.addTestSuite( MavenITmng4482ForcePluginSnapshotUpdateTest.class );
|
suite.addTestSuite( MavenITmng4482ForcePluginSnapshotUpdateTest.class );
|
||||||
suite.addTestSuite( MavenITmng4479ProjectLevelPluginDepUsedForCliConfigTest.class );
|
suite.addTestSuite( MavenITmng4479ProjectLevelPluginDepUsedForCliConfigTest.class );
|
||||||
|
@ -0,0 +1,113 @@
|
|||||||
|
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.Verifier;
|
||||||
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.mortbay.jetty.Server;
|
||||||
|
import org.mortbay.jetty.handler.DefaultHandler;
|
||||||
|
import org.mortbay.jetty.handler.HandlerList;
|
||||||
|
import org.mortbay.jetty.handler.ResourceHandler;
|
||||||
|
import org.mortbay.jetty.security.Constraint;
|
||||||
|
import org.mortbay.jetty.security.ConstraintMapping;
|
||||||
|
import org.mortbay.jetty.security.HashUserRealm;
|
||||||
|
import org.mortbay.jetty.security.SecurityHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4489">MNG-4489</a>.
|
||||||
|
*
|
||||||
|
* @author Benjamin Bentmann
|
||||||
|
*/
|
||||||
|
public class MavenITmng4489MirroringOfExtensionRepoTest
|
||||||
|
extends AbstractMavenIntegrationTestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
public MavenITmng4489MirroringOfExtensionRepoTest()
|
||||||
|
{
|
||||||
|
super( "[2.0.3,3.0-alpha-1),[3.0-alpha-6,)" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that repositories contributed by extension POMs during transitive dependency resolution are subject to
|
||||||
|
* mirror and authentication configuration.
|
||||||
|
*/
|
||||||
|
public void testit()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4489" );
|
||||||
|
|
||||||
|
Constraint constraint = new Constraint();
|
||||||
|
constraint.setName( Constraint.__BASIC_AUTH );
|
||||||
|
constraint.setRoles( new String[] { "user" } );
|
||||||
|
constraint.setAuthenticate( true );
|
||||||
|
|
||||||
|
ConstraintMapping constraintMapping = new ConstraintMapping();
|
||||||
|
constraintMapping.setConstraint( constraint );
|
||||||
|
constraintMapping.setPathSpec( "/*" );
|
||||||
|
|
||||||
|
HashUserRealm userRealm = new HashUserRealm( "TestRealm" );
|
||||||
|
userRealm.put( "testuser", "testtest" );
|
||||||
|
userRealm.addUserToRole( "testuser", "user" );
|
||||||
|
|
||||||
|
SecurityHandler securityHandler = new SecurityHandler();
|
||||||
|
securityHandler.setUserRealm( userRealm );
|
||||||
|
securityHandler.setConstraintMappings( new ConstraintMapping[] { constraintMapping } );
|
||||||
|
|
||||||
|
ResourceHandler repoHandler = new ResourceHandler();
|
||||||
|
repoHandler.setResourceBase( testDir.getAbsolutePath() );
|
||||||
|
|
||||||
|
HandlerList handlerList = new HandlerList();
|
||||||
|
handlerList.addHandler( securityHandler );
|
||||||
|
handlerList.addHandler( repoHandler );
|
||||||
|
handlerList.addHandler( new DefaultHandler() );
|
||||||
|
|
||||||
|
Server server = new Server( 0 );
|
||||||
|
server.setHandler( handlerList );
|
||||||
|
server.start();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||||
|
verifier.setAutoclean( false );
|
||||||
|
verifier.deleteDirectory( "target" );
|
||||||
|
verifier.deleteArtifacts( "org.apache.maven.its.mng4489" );
|
||||||
|
Properties filterProps = verifier.newDefaultFilterProperties();
|
||||||
|
filterProps.setProperty( "@port@", Integer.toString( server.getConnectors()[0].getLocalPort() ) );
|
||||||
|
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps );
|
||||||
|
verifier.getCliOptions().add( "-s" );
|
||||||
|
verifier.getCliOptions().add( "settings.xml" );
|
||||||
|
verifier.executeGoal( "validate" );
|
||||||
|
verifier.verifyErrorFreeLog();
|
||||||
|
verifier.resetStreams();
|
||||||
|
|
||||||
|
verifier.assertArtifactPresent( "org.apache.maven.its.mng4489", "ext-dep", "0.1", "jar" );
|
||||||
|
verifier.assertArtifactPresent( "org.apache.maven.its.mng4489", "ext-dep", "0.1", "pom" );
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
server.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
54
its/core-it-suite/src/test/resources/mng-4489/pom.xml
Normal file
54
its/core-it-suite/src/test/resources/mng-4489/pom.xml
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?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.mng4489</groupId>
|
||||||
|
<artifactId>test</artifactId>
|
||||||
|
<version>0.1</version>
|
||||||
|
|
||||||
|
<name>Maven Integration Test :: MNG-4489</name>
|
||||||
|
<description>
|
||||||
|
Test that repositories contributed by extension POMs during transitive dependency resolution are subject to
|
||||||
|
mirror and authentication configuration.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<!-- the POM of this extension specifies another repo that needs to be mirrored/authed/proxied -->
|
||||||
|
<groupId>org.apache.maven.its.mng4489</groupId>
|
||||||
|
<artifactId>ext</artifactId>
|
||||||
|
<version>0.1</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>validate</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>test</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
Binary file not shown.
@ -0,0 +1,81 @@
|
|||||||
|
<?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.mng4489</groupId>
|
||||||
|
<artifactId>ext</artifactId>
|
||||||
|
<version>0.1</version>
|
||||||
|
<packaging>maven-plugin</packaging>
|
||||||
|
|
||||||
|
<name>Maven Integration Test :: MNG-4489</name>
|
||||||
|
|
||||||
|
<distributionManagement>
|
||||||
|
<repository>
|
||||||
|
<id>maven-core-it</id>
|
||||||
|
<url>file:///${basedir}/repo</url>
|
||||||
|
</repository>
|
||||||
|
</distributionManagement>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-plugin-api</artifactId>
|
||||||
|
<version>2.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<!-- this dependency needs to be resolved from the repo in this POM -->
|
||||||
|
<groupId>org.apache.maven.its.mng4489</groupId>
|
||||||
|
<artifactId>ext-dep</artifactId>
|
||||||
|
<version>0.1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<!-- this repo needs to be mirrored/proxied for the test to work -->
|
||||||
|
<id>maven-core-it-repo-b</id>
|
||||||
|
<url>http://bad.host/null</url>
|
||||||
|
<releases>
|
||||||
|
<checksumPolicy>ignore</checksumPolicy>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>.</directory>
|
||||||
|
<includes>
|
||||||
|
<include>pom.xml</include>
|
||||||
|
<include>src/**</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<metadata>
|
||||||
|
<groupId>org.apache.maven.its.mng4489</groupId>
|
||||||
|
<artifactId>ext</artifactId>
|
||||||
|
<version>0.1</version>
|
||||||
|
<versioning>
|
||||||
|
<latest>0.1</latest>
|
||||||
|
<release>0.1</release>
|
||||||
|
<versions>
|
||||||
|
<version>0.1</version>
|
||||||
|
</versions>
|
||||||
|
<lastUpdated>20091210223136</lastUpdated>
|
||||||
|
</versioning>
|
||||||
|
</metadata>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<metadata>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<name>Maven Integration Test :: MNG-4489</name>
|
||||||
|
<prefix>ext</prefix>
|
||||||
|
<artifactId>ext</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</metadata>
|
Binary file not shown.
@ -0,0 +1,38 @@
|
|||||||
|
<?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.mng4489</groupId>
|
||||||
|
<artifactId>ext-dep</artifactId>
|
||||||
|
<version>0.1</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>Maven Integration Test :: MNG-4489</name>
|
||||||
|
|
||||||
|
<distributionManagement>
|
||||||
|
<repository>
|
||||||
|
<id>maven-core-it</id>
|
||||||
|
<url>file:///${basedir}/repo</url>
|
||||||
|
</repository>
|
||||||
|
</distributionManagement>
|
||||||
|
</project>
|
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<metadata>
|
||||||
|
<groupId>org.apache.maven.its.mng4489</groupId>
|
||||||
|
<artifactId>ext-dep</artifactId>
|
||||||
|
<version>0.1</version>
|
||||||
|
<versioning>
|
||||||
|
<release>0.1</release>
|
||||||
|
<versions>
|
||||||
|
<version>0.1</version>
|
||||||
|
</versions>
|
||||||
|
<lastUpdated>20091210222050</lastUpdated>
|
||||||
|
</versioning>
|
||||||
|
</metadata>
|
@ -0,0 +1,86 @@
|
|||||||
|
<?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>
|
||||||
|
<mirrors>
|
||||||
|
<!-- if the mirror is not applied, Maven would try downloading from the wrong dir -->
|
||||||
|
<mirror>
|
||||||
|
<id>it-mirror</id>
|
||||||
|
<mirrorOf>maven-core-it-repo-b</mirrorOf>
|
||||||
|
<url>http://bad.host/repo-b</url>
|
||||||
|
</mirror>
|
||||||
|
<mirror>
|
||||||
|
<id>central-mirror</id>
|
||||||
|
<mirrorOf>central</mirrorOf>
|
||||||
|
<url>@baseurl@/target/null</url>
|
||||||
|
</mirror>
|
||||||
|
</mirrors>
|
||||||
|
<proxies>
|
||||||
|
<!-- if the proxy is not applied, Maven would try downloading from the wrong host&port -->
|
||||||
|
<proxy>
|
||||||
|
<active>true</active>
|
||||||
|
<protocol>http</protocol>
|
||||||
|
<host>localhost</host>
|
||||||
|
<port>@port@</port>
|
||||||
|
<username>proxyuser</username>
|
||||||
|
<password>proxypass</password>
|
||||||
|
</proxy>
|
||||||
|
</proxies>
|
||||||
|
<servers>
|
||||||
|
<server>
|
||||||
|
<id>it-mirror</id>
|
||||||
|
<username>testuser</username>
|
||||||
|
<password>testtest</password>
|
||||||
|
</server>
|
||||||
|
</servers>
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>maven-core-it-repo</id>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>maven-core-it</id>
|
||||||
|
<url>@baseurl@/repo-a</url>
|
||||||
|
<releases>
|
||||||
|
<checksumPolicy>ignore</checksumPolicy>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>maven-core-it</id>
|
||||||
|
<url>@baseurl@/repo-a</url>
|
||||||
|
<releases>
|
||||||
|
<checksumPolicy>ignore</checksumPolicy>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
<activeProfiles>
|
||||||
|
<activeProfile>maven-core-it-repo</activeProfile>
|
||||||
|
</activeProfiles>
|
||||||
|
</settings>
|
Loading…
x
Reference in New Issue
Block a user