mirror of https://github.com/apache/maven.git
[MNG-4528] [regression] mvn deploy ignores proxy settings
o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@910119 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b38e25c739
commit
5af0ae1390
|
@ -89,6 +89,7 @@ public class IntegrationTestSuite
|
|||
suite.addTestSuite( MavenITmng4554PluginPrefixMappingUpdateTest.class );
|
||||
suite.addTestSuite( MavenITmng4544ActiveComponentCollectionThreadSafeTest.class );
|
||||
suite.addTestSuite( MavenITmng4536RequiresNoProjectForkingMojoTest.class );
|
||||
suite.addTestSuite( MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest.class );
|
||||
suite.addTestSuite( MavenITmng4526MavenProjectArtifactsScopeTest.class );
|
||||
suite.addTestSuite( MavenITmng4522FailUponMissingDependencyParentPomTest.class );
|
||||
suite.addTestSuite( MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.class );
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4528">MNG-4528</a>.
|
||||
*
|
||||
* @author Benjamin Bentmann
|
||||
*/
|
||||
public class MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
|
||||
public MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest()
|
||||
{
|
||||
super( "[2.0.5,3.0-alpha-1),[3.0-alpha-7,)" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that wagon providers pulled in via transitive dependencies of Maven core artifacts get excluded from
|
||||
* plugin realms (in favor of potentially newer wagons bundled with the core). This requirement is mostly a
|
||||
* hack to compensate for the historic slip of Maven core artifacts depending on wagon providers. Those old
|
||||
* wagon providers conflict with the usually newer wagons bundled with the core distro and cause grief under
|
||||
* a class loader hierarchy where wagons are loaded from the plugin realm (if available) like in Maven 3.
|
||||
*/
|
||||
public void testit()
|
||||
throws Exception
|
||||
{
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4528" );
|
||||
|
||||
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||
verifier.setAutoclean( false );
|
||||
verifier.deleteDirectory( "target" );
|
||||
verifier.executeGoal( "validate" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
|
||||
Properties props = verifier.loadProperties( "target/wagon.properties" );
|
||||
String version = props.getProperty( "version", "" );
|
||||
assertFalse( "Bad wagon version used: " + version, version.equals( "1.0-alpha-6" ) );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
<?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.mng4528</groupId>
|
||||
<artifactId>test</artifactId>
|
||||
<version>0.1</version>
|
||||
|
||||
<name>Maven Integration Test :: MNG-4528</name>
|
||||
<description>
|
||||
Test that wagon providers pulled in via transitive dependencies of Maven core artifacts get excluded from
|
||||
plugin realms (in favor of potentially newer wagons bundled with the core). This requirement is mostly a
|
||||
hack to compensate for the historic slip of Maven core artifacts depending on wagon providers. Those old
|
||||
wagon providers conflict with the usually newer wagons bundled with the core distro and cause grief under
|
||||
a class loader hierarchy where wagons are loaded from the plugin realm (if available) like in Maven 3.
|
||||
</description>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<artifactId>maven-it-plugin-uses-wagon</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
<configuration>
|
||||
<propertiesFile>target/wagon.properties</propertiesFile>
|
||||
<providerHint>scpexe</providerHint>
|
||||
<providerGroupId>org.apache.maven.wagon</providerGroupId>
|
||||
<providerArtifactId>wagon-ssh-external</providerArtifactId>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>dump-version</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<!--
|
||||
This Maven core artifact has a dependency on wagon-ssh-external:1.0-alpha-6 but this wagon version
|
||||
must not be used by the plugin. In real projects, the constellation
|
||||
maven-core:2.0.6 -> wagon-lightweight-http:1.0-beta-2 is most problematic.
|
||||
-->
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>2.0.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,153 @@
|
|||
package org.apache.maven.plugin.coreit;
|
||||
|
||||
/*
|
||||
* 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.artifact.manager.WagonManager;
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Dumps the version info for a wagon provider to a properties file.
|
||||
*
|
||||
* @goal dump-version
|
||||
* @phase validate
|
||||
*
|
||||
* @author Benjamin Bentmann
|
||||
*/
|
||||
public class DumpVersionMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
|
||||
/**
|
||||
* Project base directory used for manual path alignment.
|
||||
*
|
||||
* @parameter default-value="${basedir}"
|
||||
* @readonly
|
||||
*/
|
||||
private File basedir;
|
||||
|
||||
/**
|
||||
* The Wagon manager used to lookup the wagon of interest.
|
||||
*
|
||||
* @component
|
||||
*/
|
||||
private WagonManager wagonManager;
|
||||
|
||||
/**
|
||||
* The path to the properties file used to dump the auth infos.
|
||||
*
|
||||
* @parameter expression="${wagon.propertiesFile}"
|
||||
*/
|
||||
private File propertiesFile;
|
||||
|
||||
/**
|
||||
* The role hint for the provider of interest.
|
||||
*
|
||||
* @parameter expression="${wagon.providerHint}"
|
||||
*/
|
||||
private String providerHint;
|
||||
|
||||
/**
|
||||
* The group id for the provider of interest.
|
||||
*
|
||||
* @parameter expression="${wagon.providerGroupId}"
|
||||
*/
|
||||
private String providerGroupId;
|
||||
|
||||
/**
|
||||
* The artifact id for the provider of interest.
|
||||
*
|
||||
* @parameter expression="${wagon.providerArtifactId}"
|
||||
*/
|
||||
private String providerArtifactId;
|
||||
|
||||
/**
|
||||
* Runs this mojo.
|
||||
*
|
||||
* @throws MojoExecutionException If the output file could not be created.
|
||||
*/
|
||||
public void execute()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
Properties wagonProperties = new Properties();
|
||||
|
||||
Object wagon;
|
||||
try
|
||||
{
|
||||
wagon = wagonManager.getWagon( providerHint );
|
||||
|
||||
String resource = "/META-INF/maven/" + providerGroupId + "/" + providerArtifactId + "/pom.properties";
|
||||
InputStream is = wagon.getClass().getResourceAsStream( resource );
|
||||
wagonProperties.load( is );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Wagon properties could not be read: " + e.getMessage(), e );
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
getLog().info( "[MAVEN-CORE-IT-LOG] No wagon available for " + providerHint );
|
||||
wagonProperties.setProperty( "missing", "true" );
|
||||
}
|
||||
|
||||
if ( !propertiesFile.isAbsolute() )
|
||||
{
|
||||
propertiesFile = new File( basedir, propertiesFile.getPath() );
|
||||
}
|
||||
|
||||
getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file " + propertiesFile );
|
||||
|
||||
OutputStream out = null;
|
||||
try
|
||||
{
|
||||
propertiesFile.getParentFile().mkdirs();
|
||||
out = new FileOutputStream( propertiesFile );
|
||||
wagonProperties.store( out, "MAVEN-CORE-IT-LOG" );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Output file could not be created: " + propertiesFile, e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
if ( out != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
out.close();
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
// just ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getLog().info( "[MAVEN-CORE-IT-LOG] Created output file " + propertiesFile );
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue