o adjusting the internals to deal with root-based resolution

o gross hack to work around someone hardcoding a dummy:dummy root artifact in the surefire plugin



git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@756885 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-03-21 07:28:59 +00:00
parent 7b6c7f6ce3
commit 0bf25e64d8
23 changed files with 333 additions and 353 deletions

View File

@ -209,7 +209,6 @@ END SNIPPET: ant-bootstrap -->
</macrodef> </macrodef>
<modello file="maven-model/src/main/mdo/maven.mdo" version="4.0.0"/> <modello file="maven-model/src/main/mdo/maven.mdo" version="4.0.0"/>
<modello file="maven-lifecycle/src/main/mdo/maven-lifecycle.mdo"/>
<modello file="maven-plugin-api/src/main/mdo/lifecycle.mdo"/> <modello file="maven-plugin-api/src/main/mdo/lifecycle.mdo"/>
<modello file="maven-project/src/main/mdo/profiles.mdo"/> <modello file="maven-project/src/main/mdo/profiles.mdo"/>
<modello file="maven-core/src/main/mdo/settings.mdo"/> <modello file="maven-core/src/main/mdo/settings.mdo"/>

View File

@ -164,7 +164,6 @@ END SNIPPET: ant-bootstrap -->
</macrodef> </macrodef>
<modello file="maven-model/src/main/mdo/maven.mdo" version="4.0.0"/> <modello file="maven-model/src/main/mdo/maven.mdo" version="4.0.0"/>
<modello file="maven-lifecycle/src/main/mdo/maven-lifecycle.mdo"/>
<modello file="maven-plugin-api/src/main/mdo/lifecycle.mdo"/> <modello file="maven-plugin-api/src/main/mdo/lifecycle.mdo"/>
<modello file="maven-project/src/main/mdo/profiles.mdo"/> <modello file="maven-project/src/main/mdo/profiles.mdo"/>
<modello file="maven-core/src/main/mdo/settings.mdo"/> <modello file="maven-core/src/main/mdo/settings.mdo"/>

View File

@ -1,22 +1,18 @@
package org.apache.maven.artifact.manager; package org.apache.maven.artifact.manager;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* or more contributor license agreements. See the NOTICE file * agreements. See the NOTICE file distributed with this work for additional information regarding
* distributed with this work for additional information * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
* regarding copyright ownership. The ASF licenses this file * "License"); you may not use this file except in compliance with the License. You may obtain a
* to you under the Apache License, Version 2.0 (the * copy of the License at
* "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
* *
* 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
* Unless required by applicable law or agreed to in writing, * or implied. See the License for the specific language governing permissions and limitations under
* software distributed under the License is distributed on an * the License.
* "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 java.io.File; import java.io.File;
@ -60,34 +56,34 @@
import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.FileUtils;
@Component(role=WagonManager.class) @Component(role = WagonManager.class)
public class DefaultWagonManager public class DefaultWagonManager
implements WagonManager implements WagonManager
{ {
private static final String[] CHECKSUM_IDS = {"md5", "sha1"}; private static final String[] CHECKSUM_IDS = { "md5", "sha1" };
/** have to match the CHECKSUM_IDS */ /** have to match the CHECKSUM_IDS */
private static final String[] CHECKSUM_ALGORITHMS = {"MD5", "SHA-1"}; private static final String[] CHECKSUM_ALGORITHMS = { "MD5", "SHA-1" };
@Requirement @Requirement
private Logger logger; private Logger logger;
@Requirement @Requirement
private PlexusContainer container; private PlexusContainer container;
// TODO: proxies, authentication and mirrors are via settings, and should come in via an alternate method - perhaps // TODO: proxies, authentication and mirrors are via settings, and should come in via an alternate method - perhaps
// attached to ArtifactRepository before the method is called (so AR would be composed of WR, not inherit it) // attached to ArtifactRepository before the method is called (so AR would be composed of WR, not inherit it)
private Map<String,ProxyInfo> proxies = new HashMap<String,ProxyInfo>(); private Map<String, ProxyInfo> proxies = new HashMap<String, ProxyInfo>();
private static Map<String,AuthenticationInfo> authenticationInfoMap = new HashMap<String,AuthenticationInfo>(); private static Map<String, AuthenticationInfo> authenticationInfoMap = new HashMap<String, AuthenticationInfo>();
private Map<String,RepositoryPermissions> serverPermissionsMap = new HashMap<String,RepositoryPermissions>(); private Map<String, RepositoryPermissions> serverPermissionsMap = new HashMap<String, RepositoryPermissions>();
//used LinkedMap to preserve the order. //used LinkedMap to preserve the order.
private Map<String,ArtifactRepository> mirrors = new LinkedHashMap<String,ArtifactRepository>(); private Map<String, ArtifactRepository> mirrors = new LinkedHashMap<String, ArtifactRepository>();
/** Map( String, XmlPlexusConfiguration ) with the repository id and the wagon configuration */ /** Map( String, XmlPlexusConfiguration ) with the repository id and the wagon configuration */
private Map<String,XmlPlexusConfiguration> serverConfigurationMap = new HashMap<String,XmlPlexusConfiguration>(); private Map<String, XmlPlexusConfiguration> serverConfigurationMap = new HashMap<String, XmlPlexusConfiguration>();
private RepositoryPermissions defaultRepositoryPermissions; private RepositoryPermissions defaultRepositoryPermissions;
@ -96,7 +92,7 @@ public class DefaultWagonManager
@Requirement @Requirement
private ArtifactRepositoryFactory repositoryFactory; private ArtifactRepositoryFactory repositoryFactory;
@Requirement(role=Wagon.class) @Requirement(role = Wagon.class)
private Map wagons; private Map wagons;
//@Requirement //@Requirement
@ -108,12 +104,12 @@ public class DefaultWagonManager
private String httpUserAgent = "Apache-Maven/3.0-alpha-1"; private String httpUserAgent = "Apache-Maven/3.0-alpha-1";
private TransferListener downloadMonitor; private TransferListener downloadMonitor;
public void setDownloadMonitor( TransferListener downloadMonitor ) public void setDownloadMonitor( TransferListener downloadMonitor )
{ {
this.downloadMonitor = downloadMonitor; this.downloadMonitor = downloadMonitor;
} }
// TODO: this leaks the component in the public api - it is never released back to the container // TODO: this leaks the component in the public api - it is never released back to the container
public Wagon getWagon( Repository repository ) public Wagon getWagon( Repository repository )
throws UnsupportedProtocolException, WagonConfigurationException throws UnsupportedProtocolException, WagonConfigurationException
@ -125,7 +121,6 @@ public Wagon getWagon( Repository repository )
throw new UnsupportedProtocolException( "The repository " + repository + " does not specify a protocol" ); throw new UnsupportedProtocolException( "The repository " + repository + " does not specify a protocol" );
} }
Wagon wagon = getWagon( protocol ); Wagon wagon = getWagon( protocol );
configureWagon( wagon, repository.getId(), protocol ); configureWagon( wagon, repository.getId(), protocol );
@ -140,15 +135,13 @@ public Wagon getWagon( String protocol )
{ {
throw new UnsupportedProtocolException( "Unspecified protocol" ); throw new UnsupportedProtocolException( "Unspecified protocol" );
} }
String hint = protocol.toLowerCase( java.util.Locale.ENGLISH ); String hint = protocol.toLowerCase( java.util.Locale.ENGLISH );
Wagon wagon = (Wagon) wagons.get( hint ); Wagon wagon = (Wagon) wagons.get( hint );
if ( wagon == null ) if ( wagon == null )
{ {
throw new UnsupportedProtocolException( throw new UnsupportedProtocolException( "Cannot find wagon which supports the requested protocol: " + protocol );
"Cannot find wagon which supports the requested protocol: " + protocol );
} }
return wagon; return wagon;
@ -159,7 +152,7 @@ public void putArtifact( File source, Artifact artifact, ArtifactRepository depl
{ {
putRemoteFile( deploymentRepository, source, deploymentRepository.pathOf( artifact ), downloadMonitor ); putRemoteFile( deploymentRepository, source, deploymentRepository.pathOf( artifact ), downloadMonitor );
} }
public void putArtifact( File source, Artifact artifact, ArtifactRepository deploymentRepository, TransferListener downloadMonitor ) public void putArtifact( File source, Artifact artifact, ArtifactRepository deploymentRepository, TransferListener downloadMonitor )
throws TransferFailedException throws TransferFailedException
{ {
@ -195,9 +188,9 @@ private void putRemoteFile( ArtifactRepository repository, File source, String r
wagon.addTransferListener( downloadMonitor ); wagon.addTransferListener( downloadMonitor );
} }
Map<String,ChecksumObserver> checksums = new HashMap<String,ChecksumObserver>( 2 ); Map<String, ChecksumObserver> checksums = new HashMap<String, ChecksumObserver>( 2 );
Map<String,String> sums = new HashMap<String,String>( 2 ); Map<String, String> sums = new HashMap<String, String>( 2 );
// TODO: configure these on the repository // TODO: configure these on the repository
for ( int i = 0; i < CHECKSUM_IDS.length; i++ ) for ( int i = 0; i < CHECKSUM_IDS.length; i++ )
@ -211,15 +204,15 @@ private void putRemoteFile( ArtifactRepository repository, File source, String r
{ {
Repository artifactRepository = new Repository( repository.getId(), repository.getUrl() ); Repository artifactRepository = new Repository( repository.getId(), repository.getUrl() );
AuthenticationInfo authenticationInfo = getAuthenticationInfo( repository.getId() ); AuthenticationInfo authenticationInfo = getAuthenticationInfo( repository.getId() );
wagon.connect( artifactRepository, authenticationInfo, new ProxyInfoProvider() wagon.connect( artifactRepository, authenticationInfo, new ProxyInfoProvider()
{ {
public ProxyInfo getProxyInfo( String protocol ) public ProxyInfo getProxyInfo( String protocol )
{ {
return getProxy( protocol ); return getProxy( protocol );
} }
}); } );
wagon.put( source, remotePath ); wagon.put( source, remotePath );
} }
@ -238,19 +231,21 @@ public ProxyInfo getProxyInfo( String protocol )
} }
// Pre-store the checksums as any future puts will overwrite them // Pre-store the checksums as any future puts will overwrite them
for (String extension : checksums.keySet()) { for ( String extension : checksums.keySet() )
ChecksumObserver observer = checksums.get(extension); {
sums.put(extension, observer.getActualChecksum()); ChecksumObserver observer = checksums.get( extension );
sums.put( extension, observer.getActualChecksum() );
} }
// We do this in here so we can checksum the artifact metadata too, otherwise it could be metadata itself // We do this in here so we can checksum the artifact metadata too, otherwise it could be metadata itself
for (String extension : checksums.keySet()) { for ( String extension : checksums.keySet() )
{
// TODO: shouldn't need a file intermediatary - improve wagon to take a stream // TODO: shouldn't need a file intermediatary - improve wagon to take a stream
File temp = File.createTempFile("maven-artifact", null); File temp = File.createTempFile( "maven-artifact", null );
temp.deleteOnExit(); temp.deleteOnExit();
FileUtils.fileWrite(temp.getAbsolutePath(), "UTF-8", sums.get(extension)); FileUtils.fileWrite( temp.getAbsolutePath(), "UTF-8", sums.get( extension ) );
wagon.put(temp, remotePath + "." + extension); wagon.put( temp, remotePath + "." + extension );
} }
} }
catch ( ConnectionException e ) catch ( ConnectionException e )
@ -276,10 +271,12 @@ public ProxyInfo getProxyInfo( String protocol )
finally finally
{ {
// Remove every checksum listener // Remove every checksum listener
for (String aCHECKSUM_IDS : CHECKSUM_IDS) { for ( String aCHECKSUM_IDS : CHECKSUM_IDS )
TransferListener checksumListener = checksums.get(aCHECKSUM_IDS); {
if (checksumListener != null) { TransferListener checksumListener = checksums.get( aCHECKSUM_IDS );
wagon.removeTransferListener(checksumListener); if ( checksumListener != null )
{
wagon.removeTransferListener( checksumListener );
} }
} }
@ -289,8 +286,7 @@ public ProxyInfo getProxyInfo( String protocol )
} }
} }
private ChecksumObserver addChecksumObserver( Wagon wagon, private ChecksumObserver addChecksumObserver( Wagon wagon, String algorithm )
String algorithm )
throws TransferFailedException throws TransferFailedException
{ {
try try
@ -305,38 +301,38 @@ private ChecksumObserver addChecksumObserver( Wagon wagon,
} }
} }
// NOTE: It is not possible that this method throws TransferFailedException under current conditions. // NOTE: It is not possible that this method throws TransferFailedException under current conditions.
// FIXME: Change the throws clause to reflect the fact that we're never throwing TransferFailedException // FIXME: Change the throws clause to reflect the fact that we're never throwing TransferFailedException
public void getArtifact( Artifact artifact, ArtifactRepository remoteRepository, boolean force ) public void getArtifact( Artifact artifact, ArtifactRepository remoteRepository, boolean force )
throws TransferFailedException, ResourceDoesNotExistException throws TransferFailedException, ResourceDoesNotExistException
{ {
getArtifact( artifact, remoteRepository, downloadMonitor, force ); getArtifact( artifact, remoteRepository, downloadMonitor, force );
} }
public void getArtifact( Artifact artifact, ArtifactRepository remoteRepository ) public void getArtifact( Artifact artifact, ArtifactRepository remoteRepository )
throws TransferFailedException, ResourceDoesNotExistException throws TransferFailedException, ResourceDoesNotExistException
{ {
getArtifact( artifact, remoteRepository, downloadMonitor, true ); getArtifact( artifact, remoteRepository, downloadMonitor, true );
} }
public void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepositories, TransferListener downloadMonitor ) public void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepositories, TransferListener downloadMonitor )
throws TransferFailedException, ResourceDoesNotExistException throws TransferFailedException, ResourceDoesNotExistException
{ {
getArtifact( artifact, remoteRepositories, downloadMonitor, true ); getArtifact( artifact, remoteRepositories, downloadMonitor, true );
} }
public void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepositories, TransferListener downloadMonitor, boolean force ) public void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepositories, TransferListener downloadMonitor, boolean force )
throws TransferFailedException, ResourceDoesNotExistException throws TransferFailedException, ResourceDoesNotExistException
{ {
for (ArtifactRepository repository : remoteRepositories) { for ( ArtifactRepository repository : remoteRepositories )
{
try try
{ {
getArtifact( artifact, repository, downloadMonitor, force ); getArtifact( artifact, repository, downloadMonitor, force );
if (artifact.isResolved()) if ( artifact.isResolved() )
{ {
break; break;
} }
} }
catch ( ResourceDoesNotExistException e ) catch ( ResourceDoesNotExistException e )
@ -344,13 +340,11 @@ public void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepos
// This one we will eat when looking through remote repositories // This one we will eat when looking through remote repositories
// because we want to cycle through them all before squawking. // because we want to cycle through them all before squawking.
logger.debug( "Unable to get resource '" + artifact.getId() + "' from repository " + logger.debug( "Unable to get resource '" + artifact.getId() + "' from repository " + repository.getId() + " (" + repository.getUrl() + ")", e );
repository.getId() + " (" + repository.getUrl() + ")", e );
} }
catch ( TransferFailedException e ) catch ( TransferFailedException e )
{ {
logger.debug( "Unable to get resource '" + artifact.getId() + "' from repository " + logger.debug( "Unable to get resource '" + artifact.getId() + "' from repository " + repository.getId() + " (" + repository.getUrl() + ")", e );
repository.getId() + " (" + repository.getUrl() + ")", e );
} }
} }
@ -362,8 +356,7 @@ public void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepos
} }
public void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener downloadMonitor ) public void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener downloadMonitor )
throws TransferFailedException, throws TransferFailedException, ResourceDoesNotExistException
ResourceDoesNotExistException
{ {
getArtifact( artifact, repository, downloadMonitor, true ); getArtifact( artifact, repository, downloadMonitor, true );
} }
@ -396,7 +389,7 @@ else if ( artifact.isSnapshot() && ( force || updateCheckManager.isUpdateRequire
} }
finally finally
{ {
updateCheckManager.touch( artifact, repository ); updateCheckManager.touch( artifact, repository );
} }
logger.debug( " Artifact resolved" ); logger.debug( " Artifact resolved" );
@ -423,7 +416,7 @@ else if ( "pom".equals( artifact.getType() ) && !artifact.getFile().exists() )
{ {
// cache the POM failure // cache the POM failure
updateCheckManager.touch( artifact, repository ); updateCheckManager.touch( artifact, repository );
throw e; throw e;
} }
@ -437,7 +430,7 @@ else if ( "pom".equals( artifact.getType() ) && !artifact.getFile().exists() )
throw new ResourceDoesNotExistException( "Failure was cached in the local repository" ); throw new ResourceDoesNotExistException( "Failure was cached in the local repository" );
} }
} }
// If it's not a snapshot artifact, then we don't care what the force flag says. If it's on the local // If it's not a snapshot artifact, then we don't care what the force flag says. If it's on the local
// system, it's resolved. Releases are presumed to be immutable, so release artifacts are not ever updated. // system, it's resolved. Releases are presumed to be immutable, so release artifacts are not ever updated.
// NOTE: This is NOT the case for metadata files on relese-only repositories. This metadata may contain information // NOTE: This is NOT the case for metadata files on relese-only repositories. This metadata may contain information
@ -457,10 +450,7 @@ else if ( !artifact.isSnapshot() )
} }
} }
public void getArtifactMetadata( ArtifactMetadata metadata, public void getArtifactMetadata( ArtifactMetadata metadata, ArtifactRepository repository, File destination, String checksumPolicy )
ArtifactRepository repository,
File destination,
String checksumPolicy )
throws TransferFailedException, ResourceDoesNotExistException throws TransferFailedException, ResourceDoesNotExistException
{ {
String remotePath = repository.pathOfRemoteRepositoryMetadata( metadata ); String remotePath = repository.pathOfRemoteRepositoryMetadata( metadata );
@ -468,8 +458,7 @@ public void getArtifactMetadata( ArtifactMetadata metadata,
getRemoteFile( repository, destination, remotePath, null, checksumPolicy, true ); getRemoteFile( repository, destination, remotePath, null, checksumPolicy, true );
} }
public void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository repository, public void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository repository, File destination, String checksumPolicy )
File destination, String checksumPolicy )
throws TransferFailedException, ResourceDoesNotExistException throws TransferFailedException, ResourceDoesNotExistException
{ {
String remotePath = repository.pathOfRemoteRepositoryMetadata( metadata ); String remotePath = repository.pathOfRemoteRepositoryMetadata( metadata );
@ -477,12 +466,7 @@ public void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metada
getRemoteFile( repository, destination, remotePath, null, checksumPolicy, true ); getRemoteFile( repository, destination, remotePath, null, checksumPolicy, true );
} }
private void getRemoteFile( ArtifactRepository repository, private void getRemoteFile( ArtifactRepository repository, File destination, String remotePath, TransferListener downloadMonitor, String checksumPolicy, boolean force )
File destination,
String remotePath,
TransferListener downloadMonitor,
String checksumPolicy,
boolean force )
throws TransferFailedException, ResourceDoesNotExistException throws TransferFailedException, ResourceDoesNotExistException
{ {
String protocol = repository.getProtocol(); String protocol = repository.getProtocol();
@ -513,14 +497,13 @@ private void getRemoteFile( ArtifactRepository repository,
try try
{ {
wagon.connect( new Repository( repository.getId(), repository.getUrl() ), wagon.connect( new Repository( repository.getId(), repository.getUrl() ), getAuthenticationInfo( repository.getId() ), new ProxyInfoProvider()
getAuthenticationInfo( repository.getId() ), new ProxyInfoProvider()
{ {
public ProxyInfo getProxyInfo( String protocol ) public ProxyInfo getProxyInfo( String protocol )
{ {
return getProxy( protocol ); return getProxy( protocol );
} }
}); } );
boolean firstRun = true; boolean firstRun = true;
boolean retry = true; boolean retry = true;
@ -631,8 +614,7 @@ public ProxyInfo getProxyInfo( String protocol )
catch ( ResourceDoesNotExistException md5TryException ) catch ( ResourceDoesNotExistException md5TryException )
{ {
// this was a failed transfer, and we don't want to retry. // this was a failed transfer, and we don't want to retry.
handleChecksumFailure( checksumPolicy, "Error retrieving checksum file for " + remotePath, handleChecksumFailure( checksumPolicy, "Error retrieving checksum file for " + remotePath, md5TryException );
md5TryException );
} }
} }
@ -699,16 +681,13 @@ public ProxyInfo getProxyInfo( String protocol )
} }
catch ( IOException e ) catch ( IOException e )
{ {
throw new TransferFailedException( throw new TransferFailedException( "Error copying temporary file to the final destination: " + e.getMessage(), e );
"Error copying temporary file to the final destination: " + e.getMessage(), e );
} }
} }
} }
} }
private void handleChecksumFailure( String checksumPolicy, private void handleChecksumFailure( String checksumPolicy, String message, Throwable cause )
String message,
Throwable cause )
throws ChecksumFailedException throws ChecksumFailedException
{ {
if ( ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL.equals( checksumPolicy ) ) if ( ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL.equals( checksumPolicy ) )
@ -723,12 +702,7 @@ else if ( !ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE.equals( checksumPolic
// otherwise it is ignore // otherwise it is ignore
} }
private void verifyChecksum( ChecksumObserver checksumObserver, private void verifyChecksum( ChecksumObserver checksumObserver, File destination, File tempDestination, String remotePath, String checksumFileExtension, Wagon wagon )
File destination,
File tempDestination,
String remotePath,
String checksumFileExtension,
Wagon wagon )
throws ResourceDoesNotExistException, TransferFailedException, AuthorizationException throws ResourceDoesNotExistException, TransferFailedException, AuthorizationException
{ {
try try
@ -746,8 +720,7 @@ private void verifyChecksum( ChecksumObserver checksumObserver,
expectedChecksum = expectedChecksum.trim(); expectedChecksum = expectedChecksum.trim();
// check for 'ALGO (name) = CHECKSUM' like used by openssl // check for 'ALGO (name) = CHECKSUM' like used by openssl
if ( expectedChecksum.regionMatches( true, 0, "MD", 0, 2 ) if ( expectedChecksum.regionMatches( true, 0, "MD", 0, 2 ) || expectedChecksum.regionMatches( true, 0, "SHA", 0, 3 ) )
|| expectedChecksum.regionMatches( true, 0, "SHA", 0, 3 ) )
{ {
int lastSpacePos = expectedChecksum.lastIndexOf( ' ' ); int lastSpacePos = expectedChecksum.lastIndexOf( ' ' );
expectedChecksum = expectedChecksum.substring( lastSpacePos + 1 ); expectedChecksum = expectedChecksum.substring( lastSpacePos + 1 );
@ -774,8 +747,7 @@ private void verifyChecksum( ChecksumObserver checksumObserver,
} }
else else
{ {
throw new ChecksumFailedException( "Checksum failed on download: local = '" + actualChecksum + throw new ChecksumFailedException( "Checksum failed on download: local = '" + actualChecksum + "'; remote = '" + expectedChecksum + "'" );
"'; remote = '" + expectedChecksum + "'" );
} }
} }
catch ( IOException e ) catch ( IOException e )
@ -784,7 +756,6 @@ private void verifyChecksum( ChecksumObserver checksumObserver,
} }
} }
private void disconnectWagon( Wagon wagon ) private void disconnectWagon( Wagon wagon )
{ {
try try
@ -797,8 +768,7 @@ private void disconnectWagon( Wagon wagon )
} }
} }
private void releaseWagon( String protocol, private void releaseWagon( String protocol, Wagon wagon )
Wagon wagon )
{ {
try try
{ {
@ -810,7 +780,7 @@ private void releaseWagon( String protocol,
logger.debug( "", e ); logger.debug( "", e );
} }
} }
public ProxyInfo getProxy( String protocol ) public ProxyInfo getProxy( String protocol )
{ {
return proxies.get( protocol ); return proxies.get( protocol );
@ -824,7 +794,7 @@ public AuthenticationInfo getAuthenticationInfo( String id )
/** /**
* Checks the URL to see if this repository refers to an external repository * Checks the URL to see if this repository refers to an external repository
* *
* @param originalRepository * @param originalRepository
* @return true if external. * @return true if external.
*/ */
@ -833,7 +803,7 @@ public boolean isExternalRepo( ArtifactRepository originalRepository )
try try
{ {
URL url = new URL( originalRepository.getUrl() ); URL url = new URL( originalRepository.getUrl() );
return !( url.getHost().equals( "localhost" ) || url.getHost().equals( "127.0.0.1" ) || url.getProtocol().equals("file" ) ); return !( url.getHost().equals( "localhost" ) || url.getHost().equals( "127.0.0.1" ) || url.getProtocol().equals( "file" ) );
} }
catch ( MalformedURLException e ) catch ( MalformedURLException e )
{ {
@ -844,22 +814,17 @@ public boolean isExternalRepo( ArtifactRepository originalRepository )
/** /**
* Set the proxy used for a particular protocol. * Set the proxy used for a particular protocol.
* *
* @param protocol the protocol (required) * @param protocol the protocol (required)
* @param host the proxy host name (required) * @param host the proxy host name (required)
* @param port the proxy port (required) * @param port the proxy port (required)
* @param username the username for the proxy, or null if there is none * @param username the username for the proxy, or null if there is none
* @param password the password for the proxy, or null if there is none * @param password the password for the proxy, or null if there is none
* @param nonProxyHosts the set of hosts not to use the proxy for. Follows Java system property format: * @param nonProxyHosts the set of hosts not to use the proxy for. Follows Java system property
* <code>*.foo.com|localhost</code>. * format: <code>*.foo.com|localhost</code>.
* @todo [BP] would be nice to configure this via plexus in some way * @todo [BP] would be nice to configure this via plexus in some way
*/ */
public void addProxy( String protocol, public void addProxy( String protocol, String host, int port, String username, String password, String nonProxyHosts )
String host,
int port,
String username,
String password,
String nonProxyHosts )
{ {
ProxyInfo proxyInfo = new ProxyInfo(); ProxyInfo proxyInfo = new ProxyInfo();
proxyInfo.setHost( host ); proxyInfo.setHost( host );
@ -875,12 +840,7 @@ public void addProxy( String protocol,
// We are leaving this method here so that we can attempt to use the new maven-artifact // We are leaving this method here so that we can attempt to use the new maven-artifact
// library from the 2.0.x code so that we aren't maintaining two lines of code // library from the 2.0.x code so that we aren't maintaining two lines of code
// for the artifact management. // for the artifact management.
public void addAuthenticationInfo( String repositoryId, public void addAuthenticationInfo( String repositoryId, String username, String password, String privateKey, String passphrase )
String username,
String password,
String privateKey,
String passphrase
)
{ {
AuthenticationInfo authInfo = new AuthenticationInfo(); AuthenticationInfo authInfo = new AuthenticationInfo();
authInfo.setUserName( username ); authInfo.setUserName( username );
@ -891,9 +851,7 @@ public void addAuthenticationInfo( String repositoryId,
authenticationInfoMap.put( repositoryId, authInfo ); authenticationInfoMap.put( repositoryId, authInfo );
} }
public void addPermissionInfo( String repositoryId, public void addPermissionInfo( String repositoryId, String filePermissions, String directoryPermissions )
String filePermissions,
String directoryPermissions )
{ {
RepositoryPermissions permissions = new RepositoryPermissions(); RepositoryPermissions permissions = new RepositoryPermissions();
@ -919,10 +877,11 @@ public void addPermissionInfo( String repositoryId,
/** /**
* Applies the server configuration to the wagon * Applies the server configuration to the wagon
* *
* @param wagon the wagon to configure * @param wagon the wagon to configure
* @param repository the repository that has the configuration * @param repository the repository that has the configuration
* @throws WagonConfigurationException wraps any error given during configuration of the wagon instance * @throws WagonConfigurationException wraps any error given during configuration of the wagon
* instance
*/ */
private void configureWagon( Wagon wagon, ArtifactRepository repository ) private void configureWagon( Wagon wagon, ArtifactRepository repository )
throws WagonConfigurationException throws WagonConfigurationException
@ -933,8 +892,8 @@ private void configureWagon( Wagon wagon, ArtifactRepository repository )
private void configureWagon( Wagon wagon, String repositoryId, String protocol ) private void configureWagon( Wagon wagon, String repositoryId, String protocol )
throws WagonConfigurationException throws WagonConfigurationException
{ {
PlexusConfiguration config = (PlexusConfiguration) serverConfigurationMap.get( repositoryId ); PlexusConfiguration config = (PlexusConfiguration) serverConfigurationMap.get( repositoryId );
if ( config != null ) if ( config != null )
{ {
ComponentConfigurator componentConfigurator = null; ComponentConfigurator componentConfigurator = null;
@ -966,7 +925,7 @@ private void configureWagon( Wagon wagon, String repositoryId, String protocol )
} }
} }
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -974,7 +933,7 @@ public void setHttpUserAgent( String userAgent )
{ {
this.httpUserAgent = userAgent; this.httpUserAgent = userAgent;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */

View File

@ -1,22 +1,18 @@
package org.apache.maven.artifact.repository; package org.apache.maven.artifact.repository;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* or more contributor license agreements. See the NOTICE file * agreements. See the NOTICE file distributed with this work for additional information regarding
* distributed with this work for additional information * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
* regarding copyright ownership. The ASF licenses this file * "License"); you may not use this file except in compliance with the License. You may obtain a
* to you under the Apache License, Version 2.0 (the * copy of the License at
* "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
* *
* 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
* Unless required by applicable law or agreed to in writing, * or implied. See the License for the specific language governing permissions and limitations under
* software distributed under the License is distributed on an * the License.
* "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.Artifact; import org.apache.maven.artifact.Artifact;
@ -25,7 +21,7 @@
/** /**
* Specifies the repository used for artifact handling. * Specifies the repository used for artifact handling.
* *
* @author <a href="mailto:brett@apache.org">Brett Porter</a> * @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$ * @version $Id$
*/ */
@ -38,6 +34,7 @@ public interface ArtifactRepository
String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository ); String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository );
String getUrl(); String getUrl();
void setUrl( String url ); void setUrl( String url );
String getBasedir(); String getBasedir();
@ -45,17 +42,21 @@ public interface ArtifactRepository
String getProtocol(); String getProtocol();
String getId(); String getId();
void setId( String id ); void setId( String id );
ArtifactRepositoryPolicy getSnapshots(); ArtifactRepositoryPolicy getSnapshots();
void setSnapshotUpdatePolicy( ArtifactRepositoryPolicy policy ); void setSnapshotUpdatePolicy( ArtifactRepositoryPolicy policy );
ArtifactRepositoryPolicy getReleases(); ArtifactRepositoryPolicy getReleases();
void setReleaseUpdatePolicy( ArtifactRepositoryPolicy policy ); void setReleaseUpdatePolicy( ArtifactRepositoryPolicy policy );
ArtifactRepositoryLayout getLayout(); ArtifactRepositoryLayout getLayout();
void setLayout( ArtifactRepositoryLayout layout ); void setLayout( ArtifactRepositoryLayout layout );
String getKey(); String getKey();
boolean isUniqueVersion(); boolean isUniqueVersion();

View File

@ -347,6 +347,11 @@ public ArtifactResolutionResult resolveWithExceptions( ArtifactResolutionRequest
// //
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
private boolean isDummy( ArtifactResolutionRequest request )
{
return request.getArtifact().getArtifactId().equals( "dummy" ) && request.getArtifact().getGroupId().equals( "dummy" );
}
public ArtifactResolutionResult resolve( ArtifactResolutionRequest request ) public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
{ {
Artifact rootArtifact = request.getArtifact(); Artifact rootArtifact = request.getArtifact();
@ -356,7 +361,15 @@ public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
List<ArtifactRepository> remoteRepositories = request.getRemoteRepostories(); List<ArtifactRepository> remoteRepositories = request.getRemoteRepostories();
ArtifactMetadataSource source = request.getMetadataSource(); ArtifactMetadataSource source = request.getMetadataSource();
List<ResolutionListener> listeners = request.getListeners(); List<ResolutionListener> listeners = request.getListeners();
ArtifactFilter filter = request.getFilter(); ArtifactFilter filter = request.getFilter();
// This is an extreme hack because of the ridiculous APIs we have a root that is disconnected and
// useless. The SureFire plugin passes in a dummy root artifact that is actually used in the production
// plugin ... We have no choice but to put this hack in the core.
if ( isDummy( request ) )
{
request.setResolveRoot( false );
}
if ( source == null ) if ( source == null )
{ {
@ -388,7 +401,7 @@ public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
// This is often an artifact like a POM that is taken from disk and we already have hold of the // This is often an artifact like a POM that is taken from disk and we already have hold of the
// file reference. But this may be a Maven Plugin that we need to resolve from a remote repository // file reference. But this may be a Maven Plugin that we need to resolve from a remote repository
// as well as its dependencies. // as well as its dependencies.
if ( request.isResolveRoot() && rootArtifact.getFile() == null ) if ( request.isResolveRoot() && rootArtifact.getFile() == null )
{ {
try try
@ -406,18 +419,21 @@ public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
return result; return result;
} }
} }
if ( artifacts == null || artifacts.size() == 0 ) if ( artifacts == null || artifacts.size() == 0 )
{ {
result.addArtifact( rootArtifact ); result.addArtifact( rootArtifact );
return result; return result;
} }
// After the collection we will have the artifact object in the result but they will not be resolved yet. // After the collection we will have the artifact object in the result but they will not be resolved yet.
result = artifactCollector.collect( artifacts, rootArtifact, managedVersions, localRepository, remoteRepositories, source, filter, listeners ); result = artifactCollector.collect( artifacts, rootArtifact, managedVersions, localRepository, remoteRepositories, source, filter, listeners );
// Add the root artifact if ( !isDummy( request ) )
result.addArtifact( rootArtifact ); {
// Add the root artifact
result.addArtifact( rootArtifact );
}
// We have metadata retrieval problems, or there are cycles that have been detected // We have metadata retrieval problems, or there are cycles that have been detected
// so we give this back to the calling code and let them deal with this information // so we give this back to the calling code and let them deal with this information
@ -427,7 +443,7 @@ public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
{ {
return result; return result;
} }
if ( result.getArtifacts() != null ) if ( result.getArtifacts() != null )
{ {
for ( Artifact artifact : result.getArtifacts() ) for ( Artifact artifact : result.getArtifacts() )
@ -452,7 +468,7 @@ public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
} }
} }
} }
return result; return result;
} }

View File

@ -159,7 +159,7 @@ public Artifact retrieveRelocatedArtifact( Artifact artifact,
ArtifactResolutionResult result = ArtifactResolutionResult result =
artifactResolver.resolveTransitively( Collections.singleton( g ), projectArtifact, remoteRepositories(), localRepository(), mds ); artifactResolver.resolveTransitively( Collections.singleton( g ), projectArtifact, remoteRepositories(), localRepository(), mds );
assertEquals( 2, result.getArtifacts().size() ); assertEquals( 3, result.getArtifacts().size() );
assertTrue( result.getArtifacts().contains( g ) ); assertTrue( result.getArtifacts().contains( g ) );
@ -234,7 +234,7 @@ public Artifact retrieveRelocatedArtifact( Artifact artifact,
artifactResolver.resolveTransitively( Collections.singleton( i ), projectArtifact, remoteRepositories(), artifactResolver.resolveTransitively( Collections.singleton( i ), projectArtifact, remoteRepositories(),
localRepository(), mds ); localRepository(), mds );
assertEquals( 2, result.getArtifacts().size() ); assertEquals( 3, result.getArtifacts().size() );
assertTrue( result.getArtifacts().contains( i ) ); assertTrue( result.getArtifacts().contains( i ) );

View File

@ -382,11 +382,9 @@ else if ( moduleFile.isDirectory() )
// the session type would be specific to the request i.e. having a project // the session type would be specific to the request i.e. having a project
// or not. // or not.
protected MavenSession createSession( MavenExecutionRequest request, protected MavenSession createSession( MavenExecutionRequest request, ReactorManager reactorManager, EventDispatcher dispatcher )
ReactorManager reactorManager,
EventDispatcher dispatcher )
{ {
MavenSession session = new MavenSession( container, request, dispatcher, reactorManager ); MavenSession session = new MavenSession( container, request, reactorManager, dispatcher );
return session; return session;
} }

View File

@ -73,13 +73,18 @@ public MavenSession( ArtifactRepository localRepository, List<String> pluginGrou
this.pluginGroups = pluginGroups; this.pluginGroups = pluginGroups;
} }
public MavenSession( PlexusContainer container, MavenExecutionRequest request, EventDispatcher eventDispatcher, ReactorManager reactorManager ) public MavenSession( PlexusContainer container, MavenExecutionRequest request, ReactorManager reactorManager )
{ {
this.container = container; this.container = container;
this.request = request; this.request = request;
this.eventDispatcher = eventDispatcher;
this.reactorManager = reactorManager; this.reactorManager = reactorManager;
} }
public MavenSession( PlexusContainer container, MavenExecutionRequest request, ReactorManager reactorManager, EventDispatcher Eventdispatcher )
{
this( container, request, reactorManager );
this.eventDispatcher = Eventdispatcher;
}
public Map getPluginContext( PluginDescriptor pluginDescriptor, MavenProject project ) public Map getPluginContext( PluginDescriptor pluginDescriptor, MavenProject project )
{ {

View File

@ -1225,8 +1225,6 @@ MojoDescriptor getMojoDescriptor( String task, MavenSession session, MavenProjec
String goal; String goal;
Plugin plugin; Plugin plugin;
PluginDescriptor pluginDescriptor = null;
StringTokenizer tok = new StringTokenizer( task, ":" ); StringTokenizer tok = new StringTokenizer( task, ":" );
int numTokens = tok.countTokens(); int numTokens = tok.countTokens();
@ -1245,15 +1243,7 @@ MojoDescriptor getMojoDescriptor( String task, MavenSession session, MavenProjec
// repository. // repository.
plugin = pluginManager.findPluginForPrefix( prefix, project, session ); plugin = pluginManager.findPluginForPrefix( prefix, project, session );
if ( plugin == null )
{
plugin = new Plugin();
plugin.setGroupId( pluginDescriptor.getGroupId() );
plugin.setArtifactId( pluginDescriptor.getArtifactId() );
plugin.setVersion( pluginDescriptor.getVersion() );
}
// Search plugin in the current POM // Search plugin in the current POM
if ( plugin == null ) if ( plugin == null )
{ {
@ -1269,14 +1259,6 @@ MojoDescriptor getMojoDescriptor( String task, MavenSession session, MavenProjec
} }
} }
} }
// Default to o.a.m.plugins and maven-<prefix>-plugin
if ( plugin == null )
{
plugin = new Plugin();
plugin.setGroupId( PluginDescriptor.getDefaultPluginGroupId() );
plugin.setArtifactId( PluginDescriptor.getDefaultPluginArtifactId( prefix ) );
}
} }
else if ( numTokens == 3 || numTokens == 4 ) else if ( numTokens == 3 || numTokens == 4 )
{ {
@ -1298,32 +1280,29 @@ else if ( numTokens == 3 || numTokens == 4 )
} }
if ( plugin.getVersion() == null ) if ( plugin.getVersion() == null )
{ {
for ( Iterator i = project.getBuildPlugins().iterator(); i.hasNext(); ) for ( Iterator i = project.getBuildPlugins().iterator(); i.hasNext(); )
{ {
Plugin buildPlugin = (Plugin) i.next(); Plugin buildPlugin = (Plugin) i.next();
if ( buildPlugin.getKey().equals( plugin.getKey() ) ) if ( buildPlugin.getKey().equals( plugin.getKey() ) )
{ {
plugin = buildPlugin; plugin = buildPlugin;
break; break;
} }
} }
project.injectPluginManagementInfo( plugin ); project.injectPluginManagementInfo( plugin );
}
if ( pluginDescriptor == null )
{
pluginDescriptor = loadPlugin( plugin, project, session );
} }
PluginDescriptor pluginDescriptor = loadPlugin( plugin, project, session );
// this has been simplified from the old code that injected the plugin management stuff, since // this has been simplified from the old code that injected the plugin management stuff, since
// pluginManagement injection is now handled by the project method. // pluginManagement injection is now handled by the project method.
project.addPlugin( plugin ); project.addPlugin( plugin );
MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal ); MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );
return mojoDescriptor; return mojoDescriptor;
} }

View File

@ -165,6 +165,7 @@ public PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Maven
// TODO: this should be possibly outside // TODO: this should be possibly outside
// All version-resolution logic has been moved to DefaultPluginVersionManager. // All version-resolution logic has been moved to DefaultPluginVersionManager.
logger.debug( "Resolving plugin: " + plugin.getKey() + " with version: " + pluginVersion ); logger.debug( "Resolving plugin: " + plugin.getKey() + " with version: " + pluginVersion );
if ( ( pluginVersion == null ) || Artifact.LATEST_VERSION.equals( pluginVersion ) || Artifact.RELEASE_VERSION.equals( pluginVersion ) ) if ( ( pluginVersion == null ) || Artifact.LATEST_VERSION.equals( pluginVersion ) || Artifact.RELEASE_VERSION.equals( pluginVersion ) )
{ {
logger.debug( "Resolving version for plugin: " + plugin.getKey() ); logger.debug( "Resolving version for plugin: " + plugin.getKey() );
@ -173,7 +174,7 @@ public PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Maven
logger.debug( "Resolved to version: " + pluginVersion ); logger.debug( "Resolved to version: " + pluginVersion );
} }
return verifyVersionedPlugin( plugin, project, session ); return verifyVersionedPlugin( plugin, project, session );
} }
@ -309,8 +310,9 @@ else if ( projectPlugin.getVersion() == null || Artifact.RELEASE_VERSION.equals(
+ " Please verify that the plugin JAR " + pluginArtifact.getFile() + " is intact.", project ); + " Please verify that the plugin JAR " + pluginArtifact.getFile() + " is intact.", project );
} }
pluginDescriptor.setPluginArtifact( pluginArtifact ); pluginDescriptor.setPluginArtifact( pluginArtifact );
// Make sure it's just the plugin artifacts
pluginDescriptor.setArtifacts( new ArrayList( pluginArtifacts ) );
pluginDescriptor.setClassRealm( pluginRealm ); pluginDescriptor.setClassRealm( pluginRealm );
pluginRealms.put( pluginKey( plugin ), pluginRealm ); pluginRealms.put( pluginKey( plugin ), pluginRealm );
@ -561,10 +563,9 @@ public void executeMojo( MavenProject project, MojoExecution mojoExecution, Mave
ClassRealm oldLookupRealm = container.getLookupRealm(); ClassRealm oldLookupRealm = container.getLookupRealm();
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
List realmActions = new ArrayList();
try try
{ {
mojo = getConfiguredMojo( session, dom, project, false, mojoExecution, realmActions ); mojo = getConfiguredMojo( session, dom, project, false, mojoExecution );
//dispatcher.dispatchStart( event, goalExecId ); //dispatcher.dispatchStart( event, goalExecId );
@ -630,18 +631,8 @@ public void executeMojo( MavenProject project, MojoExecution mojoExecution, Mave
} }
} }
pluginDescriptor.setClassRealm( null );
pluginDescriptor.setArtifacts( null );
for ( Iterator it = realmActions.iterator(); it.hasNext(); )
{
PluginRealmAction action = (PluginRealmAction) it.next();
action.undo();
}
if ( oldLookupRealm != null ) if ( oldLookupRealm != null )
{ {
//container.setLookupRealm( oldLookupRealm );
container.setLookupRealm( null ); container.setLookupRealm( null );
} }
@ -660,7 +651,7 @@ public MavenReport getReport( MavenProject project, MojoExecution mojoExecution,
dom = Xpp3Dom.mergeXpp3Dom( dom, mojoExecution.getConfiguration() ); dom = Xpp3Dom.mergeXpp3Dom( dom, mojoExecution.getConfiguration() );
} }
return (MavenReport) getConfiguredMojo( session, dom, project, true, mojoExecution, new ArrayList() ); return (MavenReport) getConfiguredMojo( session, dom, project, true, mojoExecution );
} }
public PluginDescriptor verifyReportPlugin( ReportPlugin reportPlugin, MavenProject project, MavenSession session ) public PluginDescriptor verifyReportPlugin( ReportPlugin reportPlugin, MavenProject project, MavenSession session )
@ -685,7 +676,7 @@ public PluginDescriptor verifyReportPlugin( ReportPlugin reportPlugin, MavenProj
return verifyVersionedPlugin( forLookup, project, session ); return verifyVersionedPlugin( forLookup, project, session );
} }
private Mojo getConfiguredMojo( MavenSession session, Xpp3Dom dom, MavenProject project, boolean report, MojoExecution mojoExecution, List realmActions ) private Mojo getConfiguredMojo( MavenSession session, Xpp3Dom dom, MavenProject project, boolean report, MojoExecution mojoExecution )
throws PluginConfigurationException, PluginManagerException throws PluginConfigurationException, PluginManagerException
{ {
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor(); MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
@ -703,7 +694,6 @@ private Mojo getConfiguredMojo( MavenSession session, Xpp3Dom dom, MavenProject
Thread.currentThread().setContextClassLoader( pluginRealm ); Thread.currentThread().setContextClassLoader( pluginRealm );
try try
{ {
System.out.println( pluginDescriptor );
logger.debug( "Looking up mojo " + mojoDescriptor.getRoleHint() + " in realm " + pluginRealm.getId() + " - descRealmId=" + mojoDescriptor.getRealm() ); logger.debug( "Looking up mojo " + mojoDescriptor.getRoleHint() + " in realm " + pluginRealm.getId() + " - descRealmId=" + mojoDescriptor.getRealm() );
Mojo mojo; Mojo mojo;
@ -1429,35 +1419,6 @@ public static void checkPlexusUtils( ResolutionGroup resolutionGroup, ArtifactFa
} }
} }
private static final class PluginRealmAction
{
private final PluginDescriptor pluginDescriptor;
private final ClassRealm realmWithTransientParent;
PluginRealmAction( PluginDescriptor pluginDescriptor )
{
this.pluginDescriptor = pluginDescriptor;
realmWithTransientParent = null;
}
PluginRealmAction( PluginDescriptor pluginDescriptor, ClassRealm realmWithTransientParent )
{
this.pluginDescriptor = pluginDescriptor;
this.realmWithTransientParent = realmWithTransientParent;
}
void undo()
{
pluginDescriptor.setArtifacts( null );
pluginDescriptor.setClassRealm( null );
if ( realmWithTransientParent != null )
{
realmWithTransientParent.setParentRealm( null );
}
}
}
private static String interpolateXmlString( String xml, List<InterpolatorProperty> interpolatorProperties ) private static String interpolateXmlString( String xml, List<InterpolatorProperty> interpolatorProperties )
throws IOException throws IOException
{ {

View File

@ -4,6 +4,7 @@
import java.util.Arrays; import java.util.Arrays;
import java.util.Properties; import java.util.Properties;
import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.execution.DefaultMavenExecutionRequest; import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequest; import org.apache.maven.execution.MavenExecutionRequest;
@ -30,23 +31,22 @@ public class LifecycleExecutorTest
{ {
@Requirement @Requirement
private MavenProjectBuilder projectBuilder; private MavenProjectBuilder projectBuilder;
@Requirement @Requirement
private RepositorySystem repositorySystem; private RepositorySystem repositorySystem;
@Requirement @Requirement
private PluginManager pluginManager; private PluginManager pluginManager;
@Requirement @Requirement
private DefaultLifecycleExecutor lifecycleExecutor; private DefaultLifecycleExecutor lifecycleExecutor;
protected void setUp() protected void setUp()
throws Exception throws Exception
{ {
//!!jvz need these injected into the test cases as this is a pita. projectBuilder = lookup( MavenProjectBuilder.class );
projectBuilder = lookup( MavenProjectBuilder.class ); repositorySystem = lookup( RepositorySystem.class );
repositorySystem = lookup( RepositorySystem.class ); pluginManager = lookup( PluginManager.class );
pluginManager = lookup( PluginManager.class );
lifecycleExecutor = (DefaultLifecycleExecutor) lookup( LifecycleExecutor.class ); lifecycleExecutor = (DefaultLifecycleExecutor) lookup( LifecycleExecutor.class );
} }
@ -54,68 +54,133 @@ public void testLifecyclePhases()
{ {
assertNotNull( lifecycleExecutor.getLifecyclePhases() ); assertNotNull( lifecycleExecutor.getLifecyclePhases() );
} }
public void testMojoExecution() public void testRemoteResourcesPlugin()
throws Exception throws Exception
{ {
// - find the plugin [extension point: any client may wish to do whatever they choose] // - find the plugin [extension point: any client may wish to do whatever they choose]
// - load the plugin into a classloader [extension point: we want to take them from a repository, some may take from disk or whatever] // - load the plugin into a classloader [extension point: we want to take them from a repository, some may take from disk or whatever]
// - configure the plugin [extension point] // - configure the plugin [extension point]
// - execute the plugin // - execute the plugin
// Our test POM and this is actually the Maven POM so not the best idea. // Our test POM and this is actually the Maven POM so not the best idea.
File pom = new File( getBasedir(), "src/test/pom.xml" ); File pom = new File( getBasedir(), "src/test/pom.xml" );
File targetPom = new File( getBasedir(), "target/lifecycle-executor/pom-plugin.xml" ); File targetPom = new File( getBasedir(), "target/lifecycle-executor/pom-plugin.xml" );
FileUtils.copyFile( pom, targetPom ); FileUtils.copyFile( pom, targetPom );
if ( !targetPom.getParentFile().exists() ) if ( !targetPom.getParentFile().exists() )
{ {
targetPom.getParentFile().mkdirs(); targetPom.getParentFile().mkdirs();
} }
ArtifactRepository localRepository = repositorySystem.createLocalRepository( new File( "/Users/jvanzyl/.m2/repository" ) ); ArtifactRepository localRepository = getLocalRepository();
Repository repository = new Repository(); Repository repository = new Repository();
repository.setUrl( "http://repo1.maven.org/maven2" ); repository.setUrl( "http://repo1.maven.org/maven2" );
repository.setId( "central" ); repository.setId( "central" );
ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration() ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration()
.setLocalRepository( localRepository ) .setLocalRepository( localRepository ).setRemoteRepositories( Arrays.asList( repositorySystem.buildArtifactRepository( repository ) ) );
.setRemoteRepositories( Arrays.asList( repositorySystem.buildArtifactRepository( repository ) ) );
MavenProject project = projectBuilder.build( targetPom, configuration );
MavenProject project = projectBuilder.build( targetPom, configuration );
assertEquals( "maven", project.getArtifactId() ); assertEquals( "maven", project.getArtifactId() );
assertEquals( "3.0-SNAPSHOT", project.getVersion() ); assertEquals( "3.0-SNAPSHOT", project.getVersion() );
MavenExecutionRequest request = new DefaultMavenExecutionRequest() MavenExecutionRequest request = new DefaultMavenExecutionRequest().setProjectPresent( true ).setPluginGroups( Arrays.asList( new String[] { "org.apache.maven.plugins" } ) )
.setProjectPresent( true ) .setLocalRepository( localRepository ).setRemoteRepositories( Arrays.asList( repositorySystem.buildArtifactRepository( repository ) ) ).setProperties( new Properties() );
.setPluginGroups( Arrays.asList( new String[]{ "org.apache.maven.plugins"} ) )
.setLocalRepository( localRepository ) MavenSession session = new MavenSession( getContainer(), request, null );
.setRemoteRepositories( Arrays.asList( repositorySystem.buildArtifactRepository( repository ) ) ) //!!jvz This is not really quite right, take a look at how this actually works.
.setProperties( new Properties() );
MavenSession session = new MavenSession( getContainer(), request, null, null );
session.setCurrentProject( project ); session.setCurrentProject( project );
String pluginArtifactId = "remote-resources"; String pluginArtifactId = "remote-resources";
String goal = "process"; String goal = "process";
MojoDescriptor mojoDescriptor = lifecycleExecutor.getMojoDescriptor( pluginArtifactId + ":" + goal, session, project ); MojoDescriptor mojoDescriptor = lifecycleExecutor.getMojoDescriptor( pluginArtifactId + ":" + goal, session, project );
PluginDescriptor pd = mojoDescriptor.getPluginDescriptor(); PluginDescriptor pd = mojoDescriptor.getPluginDescriptor();
assertNotNull( pd ); assertNotNull( pd );
assertEquals( "org.apache.maven.plugins", pd.getGroupId() ); assertEquals( "org.apache.maven.plugins", pd.getGroupId() );
assertEquals( "maven-remote-resources-plugin", pd.getArtifactId() ); assertEquals( "maven-remote-resources-plugin", pd.getArtifactId() );
assertEquals( "1.0", pd.getVersion() ); assertEquals( "1.0", pd.getVersion() );
MojoExecution me = new MojoExecution( mojoDescriptor ); MojoExecution mojoExecution = new MojoExecution( mojoDescriptor );
// Need some xpath action in here. Make sure the mojoExecution configuration is intact // Need some xpath action in here. Make sure the mojoExecution configuration is intact
// Now the magical mojo descriptor is complete and I can execute the mojo. // Now the magical mojo descriptor is complete and I can execute the mojo.
pluginManager.executeMojo( project, me, session ); pluginManager.executeMojo( project, mojoExecution, session );
} }
public void testSurefirePlugin()
throws Exception
{
// - find the plugin [extension point: any client may wish to do whatever they choose]
// - load the plugin into a classloader [extension point: we want to take them from a repository, some may take from disk or whatever]
// - configure the plugin [extension point]
// - execute the plugin
// Our test POM and this is actually the Maven POM so not the best idea.
File pom = new File( getBasedir(), "src/test/pom.xml" );
File targetPom = new File( getBasedir(), "target/lifecycle-executor/pom-plugin.xml" );
FileUtils.copyFile( pom, targetPom );
if ( !targetPom.getParentFile().exists() )
{
targetPom.getParentFile().mkdirs();
}
ArtifactRepository localRepository = getLocalRepository();
Repository repository = new Repository();
repository.setUrl( "http://repo1.maven.org/maven2" );
repository.setId( "central" );
ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration()
.setLocalRepository( localRepository )
.setRemoteRepositories( Arrays.asList( repositorySystem.buildArtifactRepository( repository ) ) );
MavenProject project = projectBuilder.build( targetPom, configuration );
assertEquals( "maven", project.getArtifactId() );
assertEquals( "3.0-SNAPSHOT", project.getVersion() );
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setProjectPresent( true ).setPluginGroups( Arrays.asList( new String[] { "org.apache.maven.plugins" } ) )
.setLocalRepository( localRepository )
.setRemoteRepositories( Arrays.asList( repositorySystem.buildArtifactRepository( repository ) ) )
.setProperties( new Properties() );
MavenSession session = new MavenSession( getContainer(), request, null );
//!!jvz This is not really quite right, take a look at how this actually works.
session.setCurrentProject( project );
String pluginArtifactId = "surefire";
String goal = "test";
MojoDescriptor mojoDescriptor = lifecycleExecutor.getMojoDescriptor( pluginArtifactId + ":" + goal, session, project );
assertNotNull( mojoDescriptor );
PluginDescriptor pd = mojoDescriptor.getPluginDescriptor();
assertNotNull( pd );
assertEquals( "org.apache.maven.plugins", pd.getGroupId() );
assertEquals( "maven-surefire-plugin", pd.getArtifactId() );
assertEquals( "2.4.2", pd.getVersion() );
MojoExecution mojoExecution = new MojoExecution( mojoDescriptor );
// Need some xpath action in here. Make sure the mojoExecution configuration is intact
// Now the magical mojo descriptor is complete and I can execute the mojo.
pluginManager.executeMojo( project, mojoExecution, session );
}
protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration ) protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration )
{ {
containerConfiguration.addComponentDiscoverer( new MavenPluginDiscoverer() ); containerConfiguration.addComponentDiscoverer( new MavenPluginDiscoverer() );
containerConfiguration.addComponentDiscoveryListener( new MavenPluginCollector() ); containerConfiguration.addComponentDiscoveryListener( new MavenPluginCollector() );
} }
//!!jvz The repository system needs to know about the defaults for Maven, it's tied up in the embedder right now.
protected ArtifactRepository getLocalRepository()
throws InvalidRepositoryException
{
return repositorySystem.createLocalRepository( new File( "/Users/jvanzyl/.m2/repository" ) );
}
} }

View File

@ -70,7 +70,7 @@ private MavenSession newMavenSession()
ReactorManager rm = new ReactorManager( Collections.singletonList( project ), ReactorManager.FAIL_FAST ); ReactorManager rm = new ReactorManager( Collections.singletonList( project ), ReactorManager.FAIL_FAST );
MavenExecutionRequest request = new DefaultMavenExecutionRequest(); MavenExecutionRequest request = new DefaultMavenExecutionRequest();
request.setLocalRepositoryPath( new File( System.getProperty( "user.home" ), ".m2/repository" ) ); request.setLocalRepositoryPath( new File( System.getProperty( "user.home" ), ".m2/repository" ) );
MavenSession session = new MavenSession( getContainer(), request, new DefaultEventDispatcher(), rm ); MavenSession session = new MavenSession( getContainer(), request, rm );
return session; return session;
} }

View File

@ -20,33 +20,6 @@
*/ */
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.execution.*;
import org.apache.maven.model.Build;
import org.apache.maven.model.Model;
import org.apache.maven.monitor.event.DefaultEventDispatcher;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.execution.DuplicateProjectException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.path.PathTranslator;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.MutablePlexusContainer;
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.logging.console.ConsoleLogger;
import org.codehaus.plexus.util.dag.CycleDetectedException;
import org.easymock.MockControl;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -55,6 +28,35 @@
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.DuplicateProjectException;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.execution.ReactorManager;
import org.apache.maven.model.Build;
import org.apache.maven.model.Model;
import org.apache.maven.monitor.event.DefaultEventDispatcher;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.path.PathTranslator;
import org.codehaus.plexus.MutablePlexusContainer;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.logging.console.ConsoleLogger;
import org.codehaus.plexus.util.dag.CycleDetectedException;
import org.easymock.MockControl;
/** /**
* @author Jason van Zyl * @author Jason van Zyl
@ -350,7 +352,7 @@ private static MavenSession createSession( PlexusContainer container,
.setBaseDirectory( new File( "" ) ) .setBaseDirectory( new File( "" ) )
.setLocalRepository( repo ); .setLocalRepository( repo );
return new MavenSession( container, request, new DefaultEventDispatcher(), new ReactorManager( Collections.EMPTY_LIST, ReactorManager.FAIL_FAST ) ); return new MavenSession( container, request, null );
} }
public void testLocalRepositoryExtraction() public void testLocalRepositoryExtraction()
@ -470,7 +472,7 @@ private MavenSession newMavenSession()
ReactorManager rm = new ReactorManager( Collections.singletonList( project ), ReactorManager.FAIL_FAST ); ReactorManager rm = new ReactorManager( Collections.singletonList( project ), ReactorManager.FAIL_FAST );
MockControl mockMavenExecutionRequest = MockControl.createControl( MavenExecutionRequest.class ); MockControl mockMavenExecutionRequest = MockControl.createControl( MavenExecutionRequest.class );
MavenExecutionRequest req = (MavenExecutionRequest) mockMavenExecutionRequest.getMock(); MavenExecutionRequest req = (MavenExecutionRequest) mockMavenExecutionRequest.getMock();
MavenSession session = new MavenSession( getContainer(), req, new DefaultEventDispatcher(), rm ); MavenSession session = new MavenSession( getContainer(), req, rm );
return session; return session;
} }

View File

@ -285,7 +285,7 @@ public static Settings readSettings( File file )
protected void verifyPlugin( Plugin plugin, MavenProject project ) protected void verifyPlugin( Plugin plugin, MavenProject project )
throws ComponentLookupException, PluginLoaderException throws ComponentLookupException, PluginLoaderException
{ {
MavenSession session = new MavenSession( container, request, null, null ); MavenSession session = new MavenSession( container, request, null );
pluginManager.loadPlugin( plugin, project, session ); pluginManager.loadPlugin( plugin, project, session );
} }

View File

@ -1318,7 +1318,7 @@ public void addPlugin( Plugin plugin )
} }
} }
//TODO: remove ModelUtils //!!jvz remove ModelUtils
public void injectPluginManagementInfo( Plugin plugin ) public void injectPluginManagementInfo( Plugin plugin )
{ {
PluginManagement pm = getModelBuild().getPluginManagement(); PluginManagement pm = getModelBuild().getPluginManagement();

View File

@ -1,22 +1,18 @@
package org.apache.maven.project; package org.apache.maven.project;
/* /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* or more contributor license agreements. See the NOTICE file * agreements. See the NOTICE file distributed with this work for additional information regarding
* distributed with this work for additional information * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
* regarding copyright ownership. The ASF licenses this file * "License"); you may not use this file except in compliance with the License. You may obtain a
* to you under the Apache License, Version 2.0 (the * copy of the License at
* "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
* *
* 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
* Unless required by applicable law or agreed to in writing, * or implied. See the License for the specific language governing permissions and limitations under
* software distributed under the License is distributed on an * the License.
* "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.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
@ -32,6 +28,7 @@
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.util.Arrays;
import java.util.Properties; import java.util.Properties;
/** /**
@ -96,9 +93,7 @@ protected ArtifactRepository getLocalRepository()
{ {
ArtifactRepositoryLayout repoLayout = lookup( ArtifactRepositoryLayout.class, "legacy" ); ArtifactRepositoryLayout repoLayout = lookup( ArtifactRepositoryLayout.class, "legacy" );
ArtifactRepository r = new DefaultArtifactRepository( "local", ArtifactRepository r = new DefaultArtifactRepository( "local", "file://" + getLocalRepositoryPath().getAbsolutePath(), repoLayout );
"file://" + getLocalRepositoryPath().getAbsolutePath(),
repoLayout );
return r; return r;
} }
@ -110,19 +105,20 @@ protected ArtifactRepository getLocalRepository()
protected MavenProject getProjectWithDependencies( File pom ) protected MavenProject getProjectWithDependencies( File pom )
throws Exception throws Exception
{ {
ProjectBuilderConfiguration pbc = new DefaultProjectBuilderConfiguration(); ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration();
pbc.setLocalRepository( getLocalRepository() ); configuration.setLocalRepository( getLocalRepository() );
configuration.setRemoteRepositories( Arrays.asList( new ArtifactRepository[]{} ) );
try try
{ {
return projectBuilder.buildProjectWithDependencies( pom, pbc).getProject(); return projectBuilder.buildProjectWithDependencies( pom, configuration ).getProject();
} }
catch ( Exception e ) catch ( Exception e )
{ {
if ( e instanceof InvalidProjectModelException ) if ( e instanceof InvalidProjectModelException )
{ {
ModelValidationResult validationResult = ((InvalidProjectModelException)e).getValidationResult(); ModelValidationResult validationResult = ( (InvalidProjectModelException) e ).getValidationResult();
String message = "In: " + pom + "(" + ((ProjectBuildingException) e).getProjectId() + ")\n\n" + validationResult.render( " " ); String message = "In: " + pom + "(" + ( (ProjectBuildingException) e ).getProjectId() + ")\n\n" + validationResult.render( " " );
System.out.println( message ); System.out.println( message );
fail( message ); fail( message );
} }

View File

@ -69,7 +69,7 @@ public void testDependencyManagementOverridesTransitiveDependencyVersion()
Set set = project1.getArtifacts(); Set set = project1.getArtifacts();
assertNotNull("No artifacts", set); assertNotNull("No artifacts", set);
assertTrue("No Artifacts", set.size() > 0); assertTrue("No Artifacts", set.size() > 0);
assertTrue("Set size should be 3, is " + set.size(), set.size() == 3); assertTrue("Set size should be 4, is " + set.size(), set.size() == 4);
Iterator iter = set.iterator(); Iterator iter = set.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {

View File

@ -66,7 +66,7 @@ public void testDependencyManagement()
assertNotNull("No artifacts", set); assertNotNull("No artifacts", set);
assertTrue("No Artifacts", set.size() > 0); assertTrue("No Artifacts", set.size() > 0);
Iterator iter = set.iterator(); Iterator iter = set.iterator();
assertTrue("Set size should be 4, is " + set.size(), set.size() == 4); assertTrue("Set size should be 5, is " + set.size(), set.size() == 5);
while (iter.hasNext()) while (iter.hasNext())
{ {

View File

@ -65,7 +65,7 @@ public void testDependencyManagement()
Set set = project1.getArtifacts(); Set set = project1.getArtifacts();
assertNotNull("No artifacts", set); assertNotNull("No artifacts", set);
assertTrue("No Artifacts", set.size() > 0); assertTrue("No Artifacts", set.size() > 0);
assertTrue("Set size should be 3, is " + set.size(), set.size() == 3); assertTrue("Set size should be 4, is " + set.size(), set.size() == 4 );
Iterator iter = set.iterator(); Iterator iter = set.iterator();

View File

@ -67,7 +67,7 @@ public void testDependencyManagement()
assertNotNull("No artifacts", set); assertNotNull("No artifacts", set);
assertTrue("No Artifacts", set.size() > 0); assertTrue("No Artifacts", set.size() > 0);
Iterator iter = set.iterator(); Iterator iter = set.iterator();
assertTrue("Set size should be 4, is " + set.size(), set.size() == 4); assertTrue("Set size should be 5, is " + set.size(), set.size() == 5);
while (iter.hasNext()) while (iter.hasNext())
{ {

View File

@ -76,7 +76,7 @@ public void testDependencyManagementExclusionsExcludeTransitively()
assertNotNull("No artifacts", map); assertNotNull("No artifacts", map);
assertTrue("No Artifacts", map.size() > 0); assertTrue("No Artifacts", map.size() > 0);
assertTrue("Set size should be 2, is " + map.size(), map.size() == 2); assertTrue("Set size should be 3, is " + map.size(), map.size() == 3);
assertTrue("maven-test:t09-a is not in the project", map.containsKey( "maven-test:t09-a" )); assertTrue("maven-test:t09-a is not in the project", map.containsKey( "maven-test:t09-a" ));
assertTrue("maven-test:t09-b is not in the project", map.containsKey( "maven-test:t09-b" )); assertTrue("maven-test:t09-b is not in the project", map.containsKey( "maven-test:t09-b" ));
@ -110,7 +110,7 @@ public void testDependencyManagementExclusionDoesNotOverrideGloballyForTransitiv
Map map = project2.getArtifactMap(); Map map = project2.getArtifactMap();
assertNotNull( "No artifacts", map ); assertNotNull( "No artifacts", map );
assertTrue( "No Artifacts", map.size() > 0 ); assertTrue( "No Artifacts", map.size() > 0 );
assertTrue( "Set size should be 4, is " + map.size(), map.size() == 4 ); assertTrue( "Set size should be 5, is " + map.size(), map.size() == 5 );
assertTrue( "maven-test:t09-a is not in the project", map.containsKey( "maven-test:t09-a" ) ); assertTrue( "maven-test:t09-a is not in the project", map.containsKey( "maven-test:t09-a" ) );
assertTrue( "maven-test:t09-b is not in the project", map.containsKey( "maven-test:t09-b" ) ); assertTrue( "maven-test:t09-b is not in the project", map.containsKey( "maven-test:t09-b" ) );

View File

@ -71,7 +71,7 @@ public void testDependencyManagementOverridesTransitiveDependencyVersion()
Map map = project1.getArtifactMap(); Map map = project1.getArtifactMap();
assertNotNull("No artifacts", map); assertNotNull("No artifacts", map);
assertTrue("No Artifacts", map.size() > 0); assertTrue("No Artifacts", map.size() > 0);
assertTrue("Set size should be 3, is " + map.size(), map.size() == 3); assertTrue("Set size should be 4, is " + map.size(), map.size() == 4);
Artifact a = (Artifact) map.get("maven-test:t10-a"); Artifact a = (Artifact) map.get("maven-test:t10-a");
Artifact b = (Artifact) map.get("maven-test:t10-b"); Artifact b = (Artifact) map.get("maven-test:t10-b");

View File

@ -67,7 +67,7 @@ under the License.
<mercuryMp3Version>1.0-alpha-1</mercuryMp3Version> <mercuryMp3Version>1.0-alpha-1</mercuryMp3Version>
<securityDispatcherVersion>1.2</securityDispatcherVersion> <securityDispatcherVersion>1.2</securityDispatcherVersion>
<woodstoxVersion>3.2.6</woodstoxVersion> <woodstoxVersion>3.2.6</woodstoxVersion>
<modelloVersion>1.0.1-SNAPSHOT</modelloVersion> <modelloVersion>1.0.1</modelloVersion>
<jxpathVersion>1.3</jxpathVersion> <jxpathVersion>1.3</jxpathVersion>
</properties> </properties>
<issueManagement> <issueManagement>