mirror of https://github.com/apache/maven.git
PR: MNG-140
split artifact impl from api so that dep resolution can be used independently of wagon only the first step in making maven-artifact more useful as a public api - more changes to be made git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@191634 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d6b4a7adea
commit
26d36d8959
|
@ -10,7 +10,7 @@ rm -rf target
|
|||
|
||||
echo Run with m2...
|
||||
|
||||
time -p m2 jar:jar > /dev/null
|
||||
time -p m2 -B package > /dev/null
|
||||
|
||||
rm -rf target
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>maven-archetype-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0-alpha-1</version>
|
||||
<version>1.0-alpha-2-SNAPSHOT</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>plexus</groupId>
|
||||
|
@ -22,7 +22,13 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>2.0-alpha-2</version>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact-manager</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
|
|
|
@ -16,6 +16,7 @@ package org.apache.maven.archetype;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
|
@ -60,12 +61,12 @@ public class ArchetypeTest
|
|||
"legacy" );
|
||||
|
||||
String mavenRepoLocal = getTestFile( "target/local-repository" ).toURL().toString();
|
||||
ArtifactRepository localRepository = new ArtifactRepository( "local", mavenRepoLocal, layout );
|
||||
ArtifactRepository localRepository = new DefaultArtifactRepository( "local", mavenRepoLocal, layout );
|
||||
|
||||
List remoteRepositories = new ArrayList();
|
||||
|
||||
String mavenRepoRemote = getTestFile( "src/test/repository" ).toURL().toString();
|
||||
ArtifactRepository remoteRepository = new ArtifactRepository( "remote", mavenRepoRemote, layout );
|
||||
ArtifactRepository remoteRepository = new DefaultArtifactRepository( "remote", mavenRepoRemote, layout );
|
||||
|
||||
remoteRepositories.add( remoteRepository );
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
</parent>
|
||||
<artifactId>maven-archiver</artifactId>
|
||||
<name>Maven Archiver</name>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>plexus</groupId>
|
||||
|
|
|
@ -14,16 +14,19 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<artifactId>maven-artifact-manager</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
<!--
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
-->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
|
|
|
@ -17,8 +17,9 @@ package org.apache.maven.artifact.ant;
|
|||
*/
|
||||
|
||||
import org.apache.maven.artifact.manager.WagonManager;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||
|
@ -75,7 +76,7 @@ public abstract class AbstractArtifactTask
|
|||
CustomWagonManager manager = (CustomWagonManager) lookup( WagonManager.ROLE );
|
||||
manager.setLocalRepository( localRepository.getLocation() );
|
||||
|
||||
return new ArtifactRepository( "local", "file://" + localRepository.getLocation(), repositoryLayout );
|
||||
return new DefaultArtifactRepository( "local", "file://" + localRepository.getLocation(), repositoryLayout );
|
||||
}
|
||||
|
||||
protected ArtifactRepository createRemoteArtifactRepository( RemoteRepository repository )
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>maven-artifact-manager</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
<name>MAven Artifact Manager</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
<version>1.0-alpha-4-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-provider-api</artifactId>
|
||||
<version>1.0-alpha-4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-file</artifactId>
|
||||
<version>1.0-alpha-4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.maven.artifact;
|
||||
package org.apache.maven.artifact.manager;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
|
@ -17,9 +17,9 @@ package org.apache.maven.artifact.manager;
|
|||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.ChecksumFailedException;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
|
||||
import org.apache.maven.wagon.ConnectionException;
|
||||
import org.apache.maven.wagon.ResourceDoesNotExistException;
|
||||
import org.apache.maven.wagon.TransferFailedException;
|
||||
|
@ -78,8 +78,8 @@ public class DefaultWagonManager
|
|||
}
|
||||
catch ( ComponentLookupException e )
|
||||
{
|
||||
throw new UnsupportedProtocolException( "Cannot find wagon which supports the requested protocol: "
|
||||
+ protocol, e );
|
||||
throw new UnsupportedProtocolException(
|
||||
"Cannot find wagon which supports the requested protocol: " + protocol, e );
|
||||
}
|
||||
|
||||
return wagon;
|
||||
|
@ -139,7 +139,8 @@ public class DefaultWagonManager
|
|||
|
||||
try
|
||||
{
|
||||
wagon.connect( repository, getAuthenticationInfo( repository.getId() ), getProxy( protocol ) );
|
||||
wagon.connect( new Repository( repository.getId(), repository.getUrl() ),
|
||||
getAuthenticationInfo( repository.getId() ), getProxy( protocol ) );
|
||||
|
||||
wagon.put( source, remotePath );
|
||||
|
||||
|
@ -249,10 +250,10 @@ public class DefaultWagonManager
|
|||
|
||||
Wagon wagon;
|
||||
|
||||
Repository mirror = getMirror( repository.getId() );
|
||||
ArtifactRepository mirror = getMirror( repository.getId() );
|
||||
if ( mirror != null )
|
||||
{
|
||||
repository = repository.createMirror( mirror );
|
||||
repository = mirror;
|
||||
}
|
||||
|
||||
String protocol = repository.getProtocol();
|
||||
|
@ -291,7 +292,8 @@ public class DefaultWagonManager
|
|||
|
||||
try
|
||||
{
|
||||
wagon.connect( repository, getAuthenticationInfo( repository.getId() ), getProxy( protocol ) );
|
||||
wagon.connect( new Repository( repository.getId(), repository.getUrl() ),
|
||||
getAuthenticationInfo( repository.getId() ), getProxy( protocol ) );
|
||||
|
||||
boolean firstRun = true;
|
||||
boolean retry = false;
|
||||
|
@ -333,7 +335,8 @@ public class DefaultWagonManager
|
|||
}
|
||||
else
|
||||
{
|
||||
handleChecksumFailure( repository, sha1TryException.getMessage(), sha1TryException.getCause() );
|
||||
handleChecksumFailure( repository, sha1TryException.getMessage(),
|
||||
sha1TryException.getCause() );
|
||||
}
|
||||
}
|
||||
// if this IS NOT a ChecksumFailedException, it was a problem with transfer/read of the checksum
|
||||
|
@ -357,13 +360,15 @@ public class DefaultWagonManager
|
|||
}
|
||||
else
|
||||
{
|
||||
handleChecksumFailure( repository, md5TryException.getMessage(), md5TryException.getCause() );
|
||||
handleChecksumFailure( repository, md5TryException.getMessage(),
|
||||
md5TryException.getCause() );
|
||||
}
|
||||
}
|
||||
// otherwise, this was a failed transfer, and we don't want to retry.
|
||||
else
|
||||
{
|
||||
handleChecksumFailure( repository, "Error retrieving checksum file for " + destination, md5TryException );
|
||||
handleChecksumFailure( repository, "Error retrieving checksum file for " + destination,
|
||||
md5TryException );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -448,8 +453,8 @@ public class DefaultWagonManager
|
|||
// grab it first, because it's about to change...
|
||||
String actualChecksum = checksumObserver.getActualChecksum();
|
||||
|
||||
File checksumFile = new File( destination + ".sha1" );
|
||||
wagon.get( remotePath + ".sha1", checksumFile );
|
||||
File checksumFile = new File( destination + checksumFileExtension );
|
||||
wagon.get( remotePath + checksumFileExtension, checksumFile );
|
||||
|
||||
String expectedChecksum = FileUtils.fileRead( checksumFile );
|
||||
if ( !expectedChecksum.equals( actualChecksum ) )
|
||||
|
@ -457,13 +462,14 @@ public class DefaultWagonManager
|
|||
// getLogger().warn(
|
||||
// "*** CHECKSUM MISMATCH - currently disabled fail due to bad repository checksums ***" );
|
||||
|
||||
throw new ChecksumFailedException( "Checksum failed on download: local = '" + actualChecksum
|
||||
+ "'; remote = '" + expectedChecksum + "'" );
|
||||
throw new ChecksumFailedException(
|
||||
"Checksum failed on download: local = '" + actualChecksum + "'; remote = '" + expectedChecksum +
|
||||
"'" );
|
||||
}
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new TransferFailedException( "Invalid SHA-1 checksum file", e );
|
||||
throw new TransferFailedException( "Invalid checksum file", e );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -501,9 +507,9 @@ public class DefaultWagonManager
|
|||
return (AuthenticationInfo) authenticationInfoMap.get( id );
|
||||
}
|
||||
|
||||
public Repository getMirror( String mirrorOf )
|
||||
public ArtifactRepository getMirror( String mirrorOf )
|
||||
{
|
||||
return (Repository) mirrors.get( mirrorOf );
|
||||
return (ArtifactRepository) mirrors.get( mirrorOf );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -518,7 +524,8 @@ public class DefaultWagonManager
|
|||
* property format: <code>*.foo.com|localhost</code>.
|
||||
* @todo [BP] would be nice to configure this via plexus in some way
|
||||
*/
|
||||
public void addProxy( String protocol, String host, int port, String username, String password, String nonProxyHosts )
|
||||
public void addProxy( String protocol, String host, int port, String username, String password,
|
||||
String nonProxyHosts )
|
||||
{
|
||||
ProxyInfo proxyInfo = new ProxyInfo();
|
||||
proxyInfo.setHost( host );
|
||||
|
@ -563,7 +570,7 @@ public class DefaultWagonManager
|
|||
|
||||
public void addMirror( String id, String mirrorOf, String url )
|
||||
{
|
||||
Repository mirror = new Repository( id, url );
|
||||
ArtifactRepository mirror = new DefaultArtifactRepository( id, url, null );
|
||||
|
||||
mirrors.put( mirrorOf, mirror );
|
||||
}
|
|
@ -19,13 +19,14 @@ package org.apache.maven.artifact.manager;
|
|||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
import org.apache.maven.wagon.ResourceDoesNotExistException;
|
||||
import org.apache.maven.wagon.TransferFailedException;
|
||||
import org.apache.maven.wagon.UnsupportedProtocolException;
|
||||
import org.apache.maven.wagon.Wagon;
|
||||
import org.apache.maven.wagon.authentication.AuthenticationInfo;
|
||||
import org.apache.maven.wagon.proxy.ProxyInfo;
|
||||
import org.apache.maven.wagon.events.TransferListener;
|
||||
import org.apache.maven.wagon.proxy.ProxyInfo;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
|
@ -16,8 +16,8 @@ package org.apache.maven.artifact.metadata;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
|
@ -0,0 +1,82 @@
|
|||
package org.apache.maven.artifact.repository;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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.Artifact;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
import org.apache.maven.wagon.repository.Repository;
|
||||
|
||||
/**
|
||||
* This class is an abstraction of the location from/to resources can be
|
||||
* transfered.
|
||||
*
|
||||
* @author <a href="michal.maczka@dimatics.com">Michal Maczka </a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class DefaultArtifactRepository
|
||||
extends Repository
|
||||
implements ArtifactRepository
|
||||
{
|
||||
private final String snapshotPolicy;
|
||||
|
||||
private final String checksumPolicy;
|
||||
|
||||
private final ArtifactRepositoryLayout layout;
|
||||
|
||||
public DefaultArtifactRepository( String id, String url, ArtifactRepositoryLayout layout )
|
||||
{
|
||||
this( id, url, layout, SNAPSHOT_POLICY_NEVER, CHECKSUM_POLICY_WARN );
|
||||
}
|
||||
|
||||
public DefaultArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, String snapshotPolicy, String checksumPolicy )
|
||||
{
|
||||
super( id, url );
|
||||
|
||||
this.layout = layout;
|
||||
|
||||
this.snapshotPolicy = snapshotPolicy;
|
||||
|
||||
this.checksumPolicy = checksumPolicy;
|
||||
}
|
||||
|
||||
public String pathOf( Artifact artifact )
|
||||
{
|
||||
return layout.pathOf( artifact );
|
||||
}
|
||||
|
||||
public String pathOfMetadata( ArtifactMetadata artifactMetadata )
|
||||
{
|
||||
return layout.pathOfMetadata( artifactMetadata );
|
||||
}
|
||||
|
||||
public String getSnapshotPolicy()
|
||||
{
|
||||
return snapshotPolicy;
|
||||
}
|
||||
|
||||
public String getChecksumPolicy()
|
||||
{
|
||||
return checksumPolicy;
|
||||
}
|
||||
|
||||
public boolean failOnChecksumMismatch()
|
||||
{
|
||||
return CHECKSUM_POLICY_FAIL.equals( checksumPolicy );
|
||||
}
|
||||
|
||||
}
|
|
@ -17,13 +17,11 @@ package org.apache.maven.artifact.repository;
|
|||
*/
|
||||
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||
|
||||
/**
|
||||
* @author jdcasey
|
||||
*/
|
||||
public class DefaultArtifactRepositoryFactory
|
||||
extends AbstractLogEnabled
|
||||
implements ArtifactRepositoryFactory
|
||||
{
|
||||
// TODO: use settings?
|
||||
|
@ -61,7 +59,7 @@ public class DefaultArtifactRepositoryFactory
|
|||
csumPolicy = ArtifactRepository.CHECKSUM_POLICY_FAIL;
|
||||
}
|
||||
|
||||
repo = new ArtifactRepository( id, url, repositoryLayout, snapPolicy, csumPolicy );
|
||||
repo = new DefaultArtifactRepository( id, url, repositoryLayout, snapPolicy, csumPolicy );
|
||||
|
||||
return repo;
|
||||
}
|
|
@ -32,16 +32,10 @@ import org.codehaus.plexus.logging.Logger;
|
|||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @todo create an AbstractArtifactResolver that does the transitive boilerplate
|
||||
*/
|
||||
public class DefaultArtifactResolver
|
||||
extends AbstractLogEnabled
|
||||
implements ArtifactResolver
|
||||
|
@ -56,6 +50,8 @@ public class DefaultArtifactResolver
|
|||
|
||||
protected ArtifactFactory artifactFactory;
|
||||
|
||||
private ArtifactCollector artifactCollector;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Implementation
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -75,7 +71,8 @@ public class DefaultArtifactResolver
|
|||
// ----------------------------------------------------------------------
|
||||
|
||||
Logger logger = getLogger();
|
||||
logger.debug( "Resolving: " + artifact.getId() + " from:\n" + "{localRepository: " + localRepository + "}\n" +
|
||||
logger.debug(
|
||||
"Resolving: " + artifact.getId() + " from:\n" + "{localRepository: " + localRepository + "}\n" +
|
||||
"{remoteRepositories: " + remoteRepositories + "}" );
|
||||
|
||||
String localPath = localRepository.pathOf( artifact );
|
||||
|
@ -144,7 +141,8 @@ public class DefaultArtifactResolver
|
|||
{
|
||||
ArtifactResolutionResult artifactResolutionResult;
|
||||
|
||||
artifactResolutionResult = collect( artifacts, localRepository, remoteRepositories, source, filter );
|
||||
artifactResolutionResult = artifactCollector.collect( artifacts, localRepository, remoteRepositories, source,
|
||||
filter, artifactFactory );
|
||||
|
||||
for ( Iterator i = artifactResolutionResult.getArtifacts().values().iterator(); i.hasNext(); )
|
||||
{
|
||||
|
@ -170,138 +168,4 @@ public class DefaultArtifactResolver
|
|||
{
|
||||
return resolveTransitively( Collections.singleton( artifact ), remoteRepositories, localRepository, source );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
private ArtifactResolutionResult collect( Set artifacts, ArtifactRepository localRepository,
|
||||
List remoteRepositories, ArtifactMetadataSource source,
|
||||
ArtifactFilter filter )
|
||||
throws ArtifactResolutionException
|
||||
{
|
||||
ArtifactResolutionResult result = new ArtifactResolutionResult();
|
||||
|
||||
Map resolvedArtifacts = new HashMap();
|
||||
|
||||
List queue = new LinkedList();
|
||||
|
||||
queue.add( artifacts );
|
||||
|
||||
while ( !queue.isEmpty() )
|
||||
{
|
||||
Set currentArtifacts = (Set) queue.remove( 0 );
|
||||
|
||||
for ( Iterator i = currentArtifacts.iterator(); i.hasNext(); )
|
||||
{
|
||||
Artifact newArtifact = (Artifact) i.next();
|
||||
|
||||
String id = newArtifact.getDependencyConflictId();
|
||||
|
||||
if ( resolvedArtifacts.containsKey( id ) )
|
||||
{
|
||||
Artifact knownArtifact = (Artifact) resolvedArtifacts.get( id );
|
||||
|
||||
String newVersion = newArtifact.getVersion();
|
||||
|
||||
String knownVersion = knownArtifact.getVersion();
|
||||
|
||||
if ( !newVersion.equals( knownVersion ) )
|
||||
{
|
||||
addConflict( result, knownArtifact, newArtifact );
|
||||
}
|
||||
|
||||
// TODO: scope handler
|
||||
boolean updateScope = false;
|
||||
if ( Artifact.SCOPE_RUNTIME.equals( newArtifact.getScope() ) &&
|
||||
Artifact.SCOPE_TEST.equals( knownArtifact.getScope() ) )
|
||||
{
|
||||
updateScope = true;
|
||||
}
|
||||
|
||||
if ( Artifact.SCOPE_COMPILE.equals( newArtifact.getScope() ) &&
|
||||
!Artifact.SCOPE_COMPILE.equals( knownArtifact.getScope() ) )
|
||||
{
|
||||
updateScope = true;
|
||||
}
|
||||
|
||||
if ( updateScope )
|
||||
{
|
||||
// TODO: Artifact factory?
|
||||
// TODO: [jc] Is this a better way to centralize artifact construction here?
|
||||
|
||||
Artifact artifact = artifactFactory.createArtifact( knownArtifact.getGroupId(),
|
||||
knownArtifact.getArtifactId(),
|
||||
knownVersion, newArtifact.getScope(),
|
||||
knownArtifact.getType() );
|
||||
resolvedArtifacts.put( artifact.getDependencyConflictId(), artifact );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// ----------------------------------------------------------------------
|
||||
// It's the first time we have encountered this artifact
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
if ( filter != null && !filter.include( newArtifact ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
resolvedArtifacts.put( id, newArtifact );
|
||||
|
||||
Set referencedDependencies = null;
|
||||
|
||||
try
|
||||
{
|
||||
referencedDependencies = source.retrieve( newArtifact, localRepository, remoteRepositories );
|
||||
}
|
||||
catch ( ArtifactMetadataRetrievalException e )
|
||||
{
|
||||
throw new TransitiveArtifactResolutionException( e.getMessage(), newArtifact,
|
||||
remoteRepositories, e );
|
||||
}
|
||||
|
||||
// the pom for given dependency exisit we will add it to the
|
||||
// queue
|
||||
queue.add( referencedDependencies );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// the dependencies list is keyed by groupId+artifactId+type
|
||||
// so it must be 'rekeyed' to the complete id:
|
||||
// groupId+artifactId+type+version
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Map artifactResult = result.getArtifacts();
|
||||
|
||||
for ( Iterator it = resolvedArtifacts.values().iterator(); it.hasNext(); )
|
||||
{
|
||||
Artifact artifact = (Artifact) it.next();
|
||||
|
||||
artifactResult.put( artifact.getId(), artifact );
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void addConflict( ArtifactResolutionResult result, Artifact knownArtifact, Artifact newArtifact )
|
||||
{
|
||||
List conflicts;
|
||||
|
||||
conflicts = (List) result.getConflicts().get( newArtifact.getDependencyConflictId() );
|
||||
|
||||
if ( conflicts == null )
|
||||
{
|
||||
conflicts = new LinkedList();
|
||||
|
||||
conflicts.add( knownArtifact );
|
||||
|
||||
result.getConflicts().put( newArtifact.getDependencyConflictId(), conflicts );
|
||||
}
|
||||
|
||||
conflicts.add( newArtifact );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
<component-set>
|
||||
<components>
|
||||
<!--
|
||||
|
|
||||
| WagonManager
|
||||
|
|
||||
-->
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.manager.WagonManager</role>
|
||||
<implementation>org.apache.maven.artifact.manager.DefaultWagonManager</implementation>
|
||||
</component>
|
||||
|
||||
<!--
|
||||
|
|
||||
| Transformations
|
||||
|
|
||||
-->
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
|
||||
<role-hint>snapshot</role-hint>
|
||||
<implementation>org.apache.maven.artifact.transform.SnapshotTransformation</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.manager.WagonManager</role>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
|
||||
<role-hint>release</role-hint>
|
||||
<implementation>org.apache.maven.artifact.transform.ReleaseArtifactTransformation</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.manager.WagonManager</role>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
<!--
|
||||
|
|
||||
| Resolver
|
||||
|
|
||||
-->
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
|
||||
<implementation>org.apache.maven.artifact.resolver.DefaultArtifactResolver</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.manager.WagonManager</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
|
||||
<field-name>artifactTransformations</field-name>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.resolver.ArtifactCollector</role>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
|
||||
<!--
|
||||
|
|
||||
| ArtifactInstaller
|
||||
|
|
||||
-->
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.installer.ArtifactInstaller</role>
|
||||
<implementation>org.apache.maven.artifact.installer.DefaultArtifactInstaller</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
|
||||
<field-name>artifactTransformations</field-name>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
|
||||
<!--
|
||||
|
|
||||
| ArtifactDeployer
|
||||
|
|
||||
-->
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.deployer.ArtifactDeployer</role>
|
||||
<implementation>org.apache.maven.artifact.deployer.DefaultArtifactDeployer</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.manager.WagonManager</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
|
||||
<field-name>artifactTransformations</field-name>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.repository.ArtifactRepositoryFactory</role>
|
||||
<implementation>org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory</implementation>
|
||||
</component>
|
||||
</components>
|
||||
</component-set>
|
|
@ -16,9 +16,10 @@
|
|||
|
||||
package org.apache.maven.artifact;
|
||||
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -55,7 +56,8 @@ public abstract class ArtifactComponentTestCase
|
|||
ArtifactRepositoryLayout repoLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE,
|
||||
"legacy" );
|
||||
|
||||
ArtifactRepository localRepository = new ArtifactRepository( "test", "file://" + f.getPath(), repoLayout );
|
||||
ArtifactRepository localRepository = new DefaultArtifactRepository( "test", "file://" + f.getPath(),
|
||||
repoLayout );
|
||||
|
||||
return localRepository;
|
||||
}
|
||||
|
@ -75,7 +77,8 @@ public abstract class ArtifactComponentTestCase
|
|||
ArtifactRepositoryLayout repoLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE,
|
||||
"legacy" );
|
||||
|
||||
ArtifactRepository localRepository = new ArtifactRepository( "local", "file://" + f.getPath(), repoLayout );
|
||||
ArtifactRepository localRepository = new DefaultArtifactRepository( "local", "file://" + f.getPath(),
|
||||
repoLayout );
|
||||
|
||||
return localRepository;
|
||||
}
|
||||
|
@ -90,7 +93,9 @@ public abstract class ArtifactComponentTestCase
|
|||
ArtifactRepositoryLayout repoLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE,
|
||||
"legacy" );
|
||||
|
||||
ArtifactRepository repository = new ArtifactRepository( "test", "file://" + f.getPath(), repoLayout, ArtifactRepository.SNAPSHOT_POLICY_NEVER, ArtifactRepository.CHECKSUM_POLICY_WARN );
|
||||
ArtifactRepository repository = new DefaultArtifactRepository( "test", "file://" + f.getPath(), repoLayout,
|
||||
ArtifactRepository.SNAPSHOT_POLICY_NEVER,
|
||||
ArtifactRepository.CHECKSUM_POLICY_WARN );
|
||||
|
||||
return repository;
|
||||
}
|
||||
|
@ -101,7 +106,8 @@ public abstract class ArtifactComponentTestCase
|
|||
ArtifactRepositoryLayout repoLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE,
|
||||
"legacy" );
|
||||
|
||||
ArtifactRepository repository = new ArtifactRepository( "test", "http://foo.bar/repository", repoLayout );
|
||||
ArtifactRepository repository = new DefaultArtifactRepository( "test", "http://foo.bar/repository",
|
||||
repoLayout );
|
||||
|
||||
return repository;
|
||||
}
|
||||
|
@ -243,13 +249,15 @@ public abstract class ArtifactComponentTestCase
|
|||
protected Artifact createArtifact( String artifactId, String version, String type )
|
||||
{
|
||||
// TODO: fix handler instantiation
|
||||
return new DefaultArtifact( "org.apache.maven", artifactId, version, null, type, null, new DefaultArtifactHandler( type ) );
|
||||
return new DefaultArtifact( "org.apache.maven", artifactId, version, null, type, null,
|
||||
new DefaultArtifactHandler( type ) );
|
||||
}
|
||||
|
||||
protected Artifact createArtifact( String groupId, String artifactId, String version, String type )
|
||||
{
|
||||
// TODO: fix handler instantiation
|
||||
return new DefaultArtifact( groupId, artifactId, version, Artifact.SCOPE_COMPILE, type, null, new DefaultArtifactHandler( type ) );
|
||||
return new DefaultArtifact( groupId, artifactId, version, Artifact.SCOPE_COMPILE, type, null,
|
||||
new DefaultArtifactHandler( type ) );
|
||||
}
|
||||
|
||||
protected void deleteLocalArtifact( Artifact artifact )
|
|
@ -18,6 +18,11 @@
|
|||
<artifactId>maven-artifact</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact-manager</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-settings</artifactId>
|
||||
|
|
|
@ -17,8 +17,9 @@ package org.apache.maven.artifact.test;
|
|||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
|
||||
import org.apache.maven.settings.Settings;
|
||||
import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
|
@ -62,7 +63,7 @@ public abstract class ArtifactTestCase
|
|||
ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) container.lookup(
|
||||
ArtifactRepositoryLayout.ROLE, "default" );
|
||||
|
||||
localRepository = new ArtifactRepository( "local", "file://" + localRepo, repositoryLayout );
|
||||
localRepository = new DefaultArtifactRepository( "local", "file://" + localRepo, repositoryLayout );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,19 +10,8 @@
|
|||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
<version>1.0-alpha-4-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-provider-api</artifactId>
|
||||
<version>1.0-alpha-4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-file</artifactId>
|
||||
<version>1.0-alpha-4</version>
|
||||
<scope>test</scope>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>1.0-alpha-3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -16,11 +16,10 @@ package org.apache.maven.artifact;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
|
||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
|
|
@ -16,10 +16,10 @@ package org.apache.maven.artifact;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
|
||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
|
|
@ -17,8 +17,8 @@ package org.apache.maven.artifact.metadata;
|
|||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
|
|
@ -18,84 +18,44 @@ package org.apache.maven.artifact.repository;
|
|||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
import org.apache.maven.wagon.repository.Repository;
|
||||
|
||||
/**
|
||||
* This class is an abstraction of the location from/to resources can be
|
||||
* transfered.
|
||||
* TODO: describe
|
||||
*
|
||||
* @author <a href="michal.maczka@dimatics.com">Michal Maczka </a>
|
||||
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class ArtifactRepository
|
||||
extends Repository
|
||||
public interface ArtifactRepository
|
||||
{
|
||||
private final String snapshotPolicy;
|
||||
String SNAPSHOT_POLICY_NEVER = "never";
|
||||
|
||||
private final String checksumPolicy;
|
||||
String SNAPSHOT_POLICY_ALWAYS = "always";
|
||||
|
||||
private final ArtifactRepositoryLayout layout;
|
||||
String SNAPSHOT_POLICY_DAILY = "daily";
|
||||
|
||||
public static final String SNAPSHOT_POLICY_NEVER = "never";
|
||||
String SNAPSHOT_POLICY_INTERVAL = "interval";
|
||||
|
||||
public static final String SNAPSHOT_POLICY_ALWAYS = "always";
|
||||
String CHECKSUM_POLICY_FAIL = "fail";
|
||||
|
||||
public static final String SNAPSHOT_POLICY_DAILY = "daily";
|
||||
String CHECKSUM_POLICY_WARN = "warn";
|
||||
|
||||
public static final String SNAPSHOT_POLICY_INTERVAL = "interval";
|
||||
String CHECKSUM_ALGORITHM_SHA1 = "SHA-1";
|
||||
|
||||
public static final String CHECKSUM_POLICY_FAIL = "fail";
|
||||
String CHECKSUM_ALGORITHM_MD5 = "MD5";
|
||||
|
||||
public static final String CHECKSUM_POLICY_WARN = "warn";
|
||||
String pathOf( Artifact artifact );
|
||||
|
||||
public static final String CHECKSUM_ALGORITHM_SHA1 = "SHA-1";
|
||||
String pathOfMetadata( ArtifactMetadata artifactMetadata );
|
||||
|
||||
public static final String CHECKSUM_ALGORITHM_MD5 = "MD5";
|
||||
String getUrl();
|
||||
|
||||
public ArtifactRepository( String id, String url, ArtifactRepositoryLayout layout )
|
||||
{
|
||||
this( id, url, layout, SNAPSHOT_POLICY_NEVER, CHECKSUM_POLICY_WARN );
|
||||
}
|
||||
|
||||
public ArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, String snapshotPolicy, String checksumPolicy )
|
||||
{
|
||||
super( id, url );
|
||||
|
||||
this.layout = layout;
|
||||
|
||||
this.snapshotPolicy = snapshotPolicy;
|
||||
|
||||
this.checksumPolicy = checksumPolicy;
|
||||
}
|
||||
|
||||
public String pathOf( Artifact artifact )
|
||||
{
|
||||
return layout.pathOf( artifact );
|
||||
}
|
||||
|
||||
public String pathOfMetadata( ArtifactMetadata artifactMetadata )
|
||||
{
|
||||
return layout.pathOfMetadata( artifactMetadata );
|
||||
}
|
||||
|
||||
public String getSnapshotPolicy()
|
||||
{
|
||||
return snapshotPolicy;
|
||||
}
|
||||
|
||||
public String getChecksumPolicy()
|
||||
{
|
||||
return checksumPolicy;
|
||||
}
|
||||
|
||||
public boolean failOnChecksumMismatch()
|
||||
{
|
||||
return CHECKSUM_POLICY_FAIL.equals( checksumPolicy );
|
||||
}
|
||||
|
||||
public ArtifactRepository createMirror( Repository mirror )
|
||||
{
|
||||
return new ArtifactRepository( mirror.getId(), mirror.getUrl(), layout, snapshotPolicy, checksumPolicy );
|
||||
}
|
||||
String getBasedir();
|
||||
|
||||
String getSnapshotPolicy();
|
||||
|
||||
String getProtocol();
|
||||
|
||||
String getId();
|
||||
|
||||
String getChecksumPolicy();
|
||||
}
|
|
@ -19,7 +19,6 @@ package org.apache.maven.artifact.repository.layout;
|
|||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||
import org.apache.maven.artifact.transform.ReleaseArtifactTransformation;
|
||||
|
||||
/**
|
||||
* @author jdcasey
|
||||
|
@ -58,7 +57,7 @@ public class DefaultRepositoryLayout
|
|||
|
||||
path.append( metadata.getGroupId().replace( '.', '/' ) ).append( '/' );
|
||||
path.append( metadata.getArtifactId() ).append( '/' );
|
||||
if ( !metadata.getBaseVersion().equals( ReleaseArtifactTransformation.RELEASE_VERSION ) )
|
||||
if ( !metadata.getBaseVersion().equals( "RELEASE" ) )
|
||||
{
|
||||
path.append( metadata.getBaseVersion() ).append( '/' );
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package org.apache.maven.artifact.resolver;/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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.factory.ArtifactFactory;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* TODO: describe
|
||||
*
|
||||
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public interface ArtifactCollector
|
||||
{
|
||||
ArtifactResolutionResult collect( Set artifacts, ArtifactRepository localRepository, List remoteRepositories,
|
||||
ArtifactMetadataSource source, ArtifactFilter filter,
|
||||
ArtifactFactory artifactFactory )
|
||||
throws ArtifactResolutionException;
|
||||
}
|
|
@ -1,11 +1,5 @@
|
|||
package org.apache.maven.artifact.resolver;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
|
@ -22,6 +16,12 @@ import java.util.List;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||
* @version $Id$
|
||||
|
|
|
@ -0,0 +1,170 @@
|
|||
package org.apache.maven.artifact.resolver;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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.Artifact;
|
||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* TODO: describe
|
||||
*
|
||||
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class DefaultArtifactCollector
|
||||
implements ArtifactCollector
|
||||
{
|
||||
public ArtifactResolutionResult collect( Set artifacts, ArtifactRepository localRepository, List remoteRepositories,
|
||||
ArtifactMetadataSource source, ArtifactFilter filter,
|
||||
ArtifactFactory artifactFactory )
|
||||
throws ArtifactResolutionException
|
||||
{
|
||||
ArtifactResolutionResult result = new ArtifactResolutionResult();
|
||||
|
||||
Map resolvedArtifacts = new HashMap();
|
||||
|
||||
List queue = new LinkedList();
|
||||
|
||||
queue.add( artifacts );
|
||||
|
||||
while ( !queue.isEmpty() )
|
||||
{
|
||||
Set currentArtifacts = (Set) queue.remove( 0 );
|
||||
|
||||
for ( Iterator i = currentArtifacts.iterator(); i.hasNext(); )
|
||||
{
|
||||
Artifact newArtifact = (Artifact) i.next();
|
||||
|
||||
String id = newArtifact.getDependencyConflictId();
|
||||
|
||||
if ( resolvedArtifacts.containsKey( id ) )
|
||||
{
|
||||
Artifact knownArtifact = (Artifact) resolvedArtifacts.get( id );
|
||||
|
||||
String newVersion = newArtifact.getVersion();
|
||||
|
||||
String knownVersion = knownArtifact.getVersion();
|
||||
|
||||
if ( !newVersion.equals( knownVersion ) )
|
||||
{
|
||||
addConflict( result, knownArtifact, newArtifact );
|
||||
}
|
||||
|
||||
// TODO: scope handler
|
||||
boolean updateScope = false;
|
||||
if ( Artifact.SCOPE_RUNTIME.equals( newArtifact.getScope() ) &&
|
||||
Artifact.SCOPE_TEST.equals( knownArtifact.getScope() ) )
|
||||
{
|
||||
updateScope = true;
|
||||
}
|
||||
|
||||
if ( Artifact.SCOPE_COMPILE.equals( newArtifact.getScope() ) &&
|
||||
!Artifact.SCOPE_COMPILE.equals( knownArtifact.getScope() ) )
|
||||
{
|
||||
updateScope = true;
|
||||
}
|
||||
|
||||
if ( updateScope )
|
||||
{
|
||||
// TODO: Artifact factory?
|
||||
// TODO: [jc] Is this a better way to centralize artifact construction here?
|
||||
|
||||
Artifact artifact = artifactFactory.createArtifact(
|
||||
knownArtifact.getGroupId(), knownArtifact.getArtifactId(), knownVersion,
|
||||
newArtifact.getScope(), knownArtifact.getType() );
|
||||
resolvedArtifacts.put( artifact.getDependencyConflictId(), artifact );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// ----------------------------------------------------------------------
|
||||
// It's the first time we have encountered this artifact
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
if ( filter != null && !filter.include( newArtifact ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
resolvedArtifacts.put( id, newArtifact );
|
||||
|
||||
Set referencedDependencies = null;
|
||||
|
||||
try
|
||||
{
|
||||
referencedDependencies = source.retrieve( newArtifact, localRepository, remoteRepositories );
|
||||
}
|
||||
catch ( ArtifactMetadataRetrievalException e )
|
||||
{
|
||||
throw new TransitiveArtifactResolutionException( e.getMessage(), newArtifact,
|
||||
remoteRepositories, e );
|
||||
}
|
||||
|
||||
// the pom for given dependency exisit we will add it to the
|
||||
// queue
|
||||
queue.add( referencedDependencies );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// the dependencies list is keyed by groupId+artifactId+type
|
||||
// so it must be 'rekeyed' to the complete id:
|
||||
// groupId+artifactId+type+version
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Map artifactResult = result.getArtifacts();
|
||||
|
||||
for ( Iterator it = resolvedArtifacts.values().iterator(); it.hasNext(); )
|
||||
{
|
||||
Artifact artifact = (Artifact) it.next();
|
||||
|
||||
artifactResult.put( artifact.getId(), artifact );
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void addConflict( ArtifactResolutionResult result, Artifact knownArtifact, Artifact newArtifact )
|
||||
{
|
||||
List conflicts;
|
||||
|
||||
conflicts = (List) result.getConflicts().get( newArtifact.getDependencyConflictId() );
|
||||
|
||||
if ( conflicts == null )
|
||||
{
|
||||
conflicts = new LinkedList();
|
||||
|
||||
conflicts.add( knownArtifact );
|
||||
|
||||
result.getConflicts().put( newArtifact.getDependencyConflictId(), conflicts );
|
||||
}
|
||||
|
||||
conflicts.add( newArtifact );
|
||||
}
|
||||
}
|
|
@ -1,98 +1,5 @@
|
|||
<component-set>
|
||||
<components>
|
||||
<!--
|
||||
|
|
||||
| WagonManager
|
||||
|
|
||||
-->
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.manager.WagonManager</role>
|
||||
<implementation>org.apache.maven.artifact.manager.DefaultWagonManager</implementation>
|
||||
</component>
|
||||
|
||||
<!--
|
||||
|
|
||||
| Transformations
|
||||
|
|
||||
-->
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
|
||||
<role-hint>snapshot</role-hint>
|
||||
<implementation>org.apache.maven.artifact.transform.SnapshotTransformation</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.manager.WagonManager</role>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
|
||||
<role-hint>release</role-hint>
|
||||
<implementation>org.apache.maven.artifact.transform.ReleaseArtifactTransformation</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.manager.WagonManager</role>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
<!--
|
||||
|
|
||||
| Resolver
|
||||
|
|
||||
-->
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
|
||||
<implementation>org.apache.maven.artifact.resolver.DefaultArtifactResolver</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.manager.WagonManager</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
|
||||
<field-name>artifactTransformations</field-name>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
|
||||
<!--
|
||||
|
|
||||
| ArtifactInstaller
|
||||
|
|
||||
-->
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.installer.ArtifactInstaller</role>
|
||||
<implementation>org.apache.maven.artifact.installer.DefaultArtifactInstaller</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
|
||||
<field-name>artifactTransformations</field-name>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
|
||||
<!--
|
||||
|
|
||||
| ArtifactDeployer
|
||||
|
|
||||
-->
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.deployer.ArtifactDeployer</role>
|
||||
<implementation>org.apache.maven.artifact.deployer.DefaultArtifactDeployer</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.manager.WagonManager</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.transform.ArtifactTransformation</role>
|
||||
<field-name>artifactTransformations</field-name>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout</role>
|
||||
<role-hint>default</role-hint>
|
||||
|
@ -215,5 +122,10 @@
|
|||
<role>org.apache.maven.artifact.repository.ArtifactRepositoryFactory</role>
|
||||
<implementation>org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory</implementation>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.resolver.ArtifactCollector</role>
|
||||
<implementation>org.apache.maven.artifact.resolver.DefaultArtifactCollector</implementation>
|
||||
</component>
|
||||
</components>
|
||||
</component-set>
|
||||
|
|
|
@ -56,6 +56,12 @@
|
|||
<artifactId>maven-artifact</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- TODO: make it runtime by removing new DefaultArtifactRepository and WagonManager -->
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact-manager</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
|
|
|
@ -46,6 +46,7 @@ import org.apache.maven.usability.ErrorDiagnoser;
|
|||
import org.codehaus.plexus.PlexusConstants;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
|
||||
import org.codehaus.plexus.context.Context;
|
||||
import org.codehaus.plexus.context.ContextException;
|
||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||
|
@ -104,6 +105,10 @@ public class DefaultMaven
|
|||
{
|
||||
throw new ReactorException( "Unable to configure Maven for execution", e );
|
||||
}
|
||||
catch ( ComponentLifecycleException e )
|
||||
{
|
||||
throw new ReactorException( "Unable to configure Maven for execution", e );
|
||||
}
|
||||
|
||||
EventDispatcher dispatcher = request.getEventDispatcher();
|
||||
String event = MavenEvents.REACTOR_EXECUTION;
|
||||
|
@ -398,10 +403,12 @@ public class DefaultMaven
|
|||
* the wagons, shouldn't we?
|
||||
*/
|
||||
private void resolveParameters( Settings settings )
|
||||
throws ComponentLookupException
|
||||
throws ComponentLookupException, ComponentLifecycleException
|
||||
{
|
||||
WagonManager wagonManager = (WagonManager) container.lookup( WagonManager.ROLE );
|
||||
|
||||
try
|
||||
{
|
||||
Proxy proxy = settings.getActiveProxy();
|
||||
|
||||
if ( proxy != null )
|
||||
|
@ -425,6 +432,11 @@ public class DefaultMaven
|
|||
wagonManager.addMirror( mirror.getId(), mirror.getMirrorOf(), mirror.getUrl() );
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
container.release( wagonManager );
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Lifecylce Management
|
||||
|
@ -596,7 +608,7 @@ public class DefaultMaven
|
|||
{
|
||||
msg += "1 second";
|
||||
}
|
||||
else if ( min > 0 )
|
||||
else if ( min == 0 )
|
||||
{
|
||||
msg += "< 1 second";
|
||||
}
|
||||
|
|
|
@ -25,8 +25,9 @@ import org.apache.commons.cli.ParseException;
|
|||
import org.apache.commons.cli.PosixParser;
|
||||
import org.apache.maven.Maven;
|
||||
import org.apache.maven.artifact.manager.WagonManager;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
import org.apache.maven.execution.DefaultMavenExecutionRequest;
|
||||
import org.apache.maven.execution.MavenExecutionRequest;
|
||||
|
@ -376,7 +377,7 @@ public class MavenCli
|
|||
ArtifactRepositoryFactory.ROLE );
|
||||
|
||||
String url = "file://" + settings.getLocalRepository();
|
||||
ArtifactRepository localRepository = new ArtifactRepository( "local", url, repositoryLayout );
|
||||
ArtifactRepository localRepository = new DefaultArtifactRepository( "local", url, repositoryLayout );
|
||||
|
||||
boolean snapshotPolicySet = false;
|
||||
if ( commandLine.hasOption( CLIManager.OFFLINE ) )
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.maven.plugin;
|
|||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.DefaultArtifact;
|
||||
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
|
@ -77,7 +78,7 @@ public class PluginParameterExpressionEvaluatorTest
|
|||
ExpressionEvaluator expressionEvaluator = createExpressionEvaluator( createDefaultProject(), null );
|
||||
Object value = expressionEvaluator.evaluate( "${localRepository}" );
|
||||
|
||||
assertEquals( "local", ( (ArtifactRepository) value ).getId() );
|
||||
assertEquals( "local", ( (DefaultArtifactRepository) value ).getId() );
|
||||
}
|
||||
|
||||
public void testTwoExpressions()
|
||||
|
@ -132,7 +133,7 @@ public class PluginParameterExpressionEvaluatorTest
|
|||
ArtifactRepositoryLayout repoLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE,
|
||||
"legacy" );
|
||||
|
||||
ArtifactRepository repo = new ArtifactRepository( "local", "target/repo", repoLayout );
|
||||
ArtifactRepository repo = new DefaultArtifactRepository( "local", "target/repo", repoLayout );
|
||||
|
||||
PlexusContainer container = getContainer();
|
||||
MavenSession session = createSession( project, container, repo );
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
import compile.CompilerConfiguration;
|
||||
import compile.JavacCompiler;
|
||||
import download.ArtifactDownloader;
|
||||
|
@ -35,28 +34,23 @@ import java.util.TreeMap;
|
|||
|
||||
public class MBoot
|
||||
{
|
||||
String[] builds = new String[]{"maven-model", "maven-monitor", "maven-plugin-api",
|
||||
"maven-plugin-descriptor", "maven-artifact", "maven-script/maven-script-marmalade",
|
||||
"maven-script/maven-script-beanshell", "maven-project",
|
||||
"maven-settings", "maven-profile", "maven-plugin-registry",
|
||||
"maven-reporting/maven-reporting-api", "maven-core", "maven-archiver",
|
||||
"maven-plugin-tools/maven-plugin-tools-api",
|
||||
"maven-plugin-tools/maven-plugin-tools-java",
|
||||
"maven-plugin-tools/maven-plugin-tools-beanshell",
|
||||
"maven-plugin-tools/maven-plugin-tools-pluggy",
|
||||
String[] builds = new String[]{"maven-model", "maven-monitor", "maven-plugin-api", "maven-plugin-descriptor",
|
||||
"maven-artifact", "maven-artifact-manager", "maven-artifact-test", "maven-script/maven-script-marmalade",
|
||||
"maven-script/maven-script-beanshell", "maven-project", "maven-settings", "maven-profile",
|
||||
"maven-plugin-registry", "maven-reporting/maven-reporting-api", "maven-core", "maven-archiver",
|
||||
"maven-plugin-tools/maven-plugin-tools-api", "maven-plugin-tools/maven-plugin-tools-java",
|
||||
"maven-plugin-tools/maven-plugin-tools-beanshell", "maven-plugin-tools/maven-plugin-tools-pluggy",
|
||||
"maven-plugin-tools/maven-plugin-tools-marmalade", "maven-core-it-verifier"};
|
||||
|
||||
String[] pluginBuilds = new String[]{"maven-plugins/maven-clean-plugin", "maven-plugins/maven-compiler-plugin",
|
||||
"maven-plugins/maven-install-plugin", "maven-plugins/maven-jar-plugin",
|
||||
"maven-plugins/maven-plugin-plugin", "maven-plugins/maven-resources-plugin",
|
||||
"maven-plugins/maven-surefire-plugin"};
|
||||
"maven-plugins/maven-install-plugin", "maven-plugins/maven-jar-plugin", "maven-plugins/maven-plugin-plugin",
|
||||
"maven-plugins/maven-resources-plugin", "maven-plugins/maven-surefire-plugin"};
|
||||
|
||||
private static final Map MODELLO_TARGET_VERSIONS;
|
||||
|
||||
private static final Map MODELLO_MODEL_FILES;
|
||||
|
||||
static
|
||||
{
|
||||
static {
|
||||
Map targetVersions = new TreeMap();
|
||||
targetVersions.put( "maven-model", "4.0.0" );
|
||||
targetVersions.put( "maven-settings", "1.0.0" );
|
||||
|
@ -182,8 +176,9 @@ public class MBoot
|
|||
|
||||
System.out.println();
|
||||
|
||||
System.out.println( "HOWEVER, since you did not specify a repository path, maven will use: " +
|
||||
repoDir.getAbsolutePath() + " to store artifacts locally." );
|
||||
System.out.println(
|
||||
"HOWEVER, since you did not specify a repository path, maven will use: " + repoDir.getAbsolutePath() +
|
||||
" to store artifacts locally." );
|
||||
}
|
||||
|
||||
File repoLocalFile = new File( mavenRepoLocal );
|
||||
|
@ -220,11 +215,13 @@ public class MBoot
|
|||
{
|
||||
if ( !new File( dist, "bin/m2.conf" ).exists() )
|
||||
{
|
||||
System.err.println( "The directory given to install Maven in already exists, but does not contain a Maven installation" );
|
||||
System.err.println(
|
||||
"The directory given to install Maven in already exists, but does not contain a Maven installation" );
|
||||
System.err.println();
|
||||
System.err.println( "\t" + dist );
|
||||
System.err.println();
|
||||
System.err.println( "If you really mean to install Maven to this location, please delete the directory first" );
|
||||
System.err.println(
|
||||
"If you really mean to install Maven to this location, please delete the directory first" );
|
||||
System.exit( 1 );
|
||||
}
|
||||
}
|
||||
|
@ -435,8 +432,8 @@ public class MBoot
|
|||
{
|
||||
FileUtils.copyFileToDirectory( source, boot );
|
||||
}
|
||||
else if ( d.getArtifactId().equals( "plexus-container-default" )
|
||||
|| d.getArtifactId().equals( "plexus-utils" ) )
|
||||
else if ( d.getArtifactId().equals( "plexus-container-default" ) ||
|
||||
d.getArtifactId().equals( "plexus-utils" ) )
|
||||
{
|
||||
FileUtils.copyFileToDirectory( source, core );
|
||||
}
|
||||
|
@ -589,7 +586,8 @@ public class MBoot
|
|||
}
|
||||
else
|
||||
{
|
||||
compile( reader.getDependencies(), sources, classes, null, null, Dependency.SCOPE_COMPILE, localRepository );
|
||||
compile( reader.getDependencies(), sources, classes, null, null, Dependency.SCOPE_COMPILE,
|
||||
localRepository );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -663,8 +661,8 @@ public class MBoot
|
|||
m.invoke( null, new Object[]{args} );
|
||||
}
|
||||
|
||||
private void generateSources( String model, String mode, String dir, String modelVersion,
|
||||
String packageWithVersion, ClassLoader modelloClassLoader )
|
||||
private void generateSources( String model, String mode, String dir, String modelVersion, String packageWithVersion,
|
||||
ClassLoader modelloClassLoader )
|
||||
throws Exception
|
||||
{
|
||||
Class c = modelloClassLoader.loadClass( "org.codehaus.modello.ModelloCli" );
|
||||
|
@ -856,7 +854,8 @@ public class MBoot
|
|||
}
|
||||
else if ( Dependency.SCOPE_RUNTIME.equals( scope ) )
|
||||
{
|
||||
if ( d.getScope().equals( Dependency.SCOPE_COMPILE ) || d.getScope().equals( Dependency.SCOPE_RUNTIME ) )
|
||||
if ( d.getScope().equals( Dependency.SCOPE_COMPILE ) ||
|
||||
d.getScope().equals( Dependency.SCOPE_RUNTIME ) )
|
||||
{
|
||||
classpath.add( element );
|
||||
}
|
||||
|
@ -1016,8 +1015,8 @@ public class MBoot
|
|||
}
|
||||
else
|
||||
{
|
||||
throw new SAXException( "Invalid profile entry. Missing one or more " +
|
||||
"fields: {localRepository}." );
|
||||
throw new SAXException(
|
||||
"Invalid profile entry. Missing one or more " + "fields: {localRepository}." );
|
||||
}
|
||||
}
|
||||
else if ( "proxy".equals( rawName ) )
|
||||
|
|
|
@ -132,12 +132,7 @@ public class PluginDescriptor
|
|||
|
||||
public String getId()
|
||||
{
|
||||
String id = constructPluginKey( groupId, artifactId, version );
|
||||
if ( groupId == null || artifactId == null || version == null )
|
||||
{
|
||||
throw new IllegalStateException( "Plugin descriptor ID incomplete: " + id + " in " + getSource() );
|
||||
}
|
||||
return id;
|
||||
return constructPluginKey( groupId, artifactId, version );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,6 +15,12 @@
|
|||
<artifactId>maven-project</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact-test</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
|
|
|
@ -1,43 +1,37 @@
|
|||
package org.apache.maven.plugin.eclipse;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004, Codehaus.org
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is furnished to do
|
||||
* so, subject to the following conditions:
|
||||
* Licensed 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
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
* 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.Artifact;
|
||||
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.project.MavenProject;
|
||||
import org.apache.maven.project.MavenProjectBuilder;
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
|
||||
|
@ -75,7 +69,8 @@ public class EclipsePluginTest
|
|||
|
||||
ArtifactRepositoryLayout localRepositoryLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "legacy" );
|
||||
|
||||
ArtifactRepository localRepository = new ArtifactRepository("local", "file://" + repo.getAbsolutePath(), localRepositoryLayout);
|
||||
ArtifactRepository localRepository = new DefaultArtifactRepository( "local", "file://" + repo.getAbsolutePath(),
|
||||
localRepositoryLayout );
|
||||
|
||||
MavenProject project = builder.build( new File( basedir, "project.xml" ), localRepository, Collections.EMPTY_LIST );
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-archiver</artifactId>
|
||||
<version>2.0-alpha-2</version>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-archiver</artifactId>
|
||||
<version>2.0-alpha-2</version>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
|
|
|
@ -33,5 +33,11 @@
|
|||
<artifactId>plexus-utils</artifactId>
|
||||
<version>1.0-alpha-3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact-test</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.apache.maven.profiles.AlwaysOnActivation;
|
|||
public class AlwaysOnProfileActivator
|
||||
implements ProfileActivator
|
||||
{
|
||||
|
||||
public boolean canDetermineActivation( Profile profile )
|
||||
{
|
||||
return profile.getActivation() != null && profile.getActivation() instanceof AlwaysOnActivation;
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.apache.maven.model.Profile;
|
|||
public abstract class DetectedProfileActivator
|
||||
implements ProfileActivator
|
||||
{
|
||||
|
||||
public boolean canDetermineActivation( Profile profile )
|
||||
{
|
||||
return !ProfileActivationUtils.profilesWereExplicitlyGiven() && canDetectActivation( profile );
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.apache.maven.model.Profile;
|
|||
public class ExplicitListingProfileActivator
|
||||
implements ProfileActivator
|
||||
{
|
||||
|
||||
public boolean canDetermineActivation( Profile profile )
|
||||
{
|
||||
return ProfileActivationUtils.profilesWereExplicitlyGiven();
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.codehaus.plexus.util.StringUtils;
|
|||
public class JdkPrefixProfileActivator
|
||||
extends DetectedProfileActivator
|
||||
{
|
||||
|
||||
private static final String JDK_VERSION = System.getProperty( "java.version" );
|
||||
|
||||
public boolean isActive( Profile profile )
|
||||
|
|
|
@ -36,7 +36,6 @@ public class ProfileActivationCalculator
|
|||
extends AbstractLogEnabled
|
||||
implements Contextualizable
|
||||
{
|
||||
|
||||
public static final String ROLE = ProfileActivationCalculator.class.getName();
|
||||
|
||||
private PlexusContainer container;
|
||||
|
@ -59,7 +58,8 @@ public class ProfileActivationCalculator
|
|||
|
||||
Activation activation = profile.getActivation();
|
||||
|
||||
activatorLoop: for ( Iterator activatorIterator = activators.iterator(); activatorIterator.hasNext(); )
|
||||
activatorLoop:
|
||||
for ( Iterator activatorIterator = activators.iterator(); activatorIterator.hasNext(); )
|
||||
{
|
||||
ProfileActivator activator = (ProfileActivator) activatorIterator.next();
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.StringTokenizer;
|
|||
|
||||
public final class ProfileActivationUtils
|
||||
{
|
||||
|
||||
public static final String ACTIVE_PROFILE_IDS = "org.apache.maven.ActiveProfiles";
|
||||
|
||||
private static List profileList;
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.apache.maven.model.Profile;
|
|||
|
||||
public interface ProfileActivator
|
||||
{
|
||||
|
||||
static final String ROLE = ProfileActivator.class.getName();
|
||||
|
||||
boolean canDetermineActivation( Profile profile );
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.codehaus.plexus.util.StringUtils;
|
|||
public class SystemPropertyProfileActivator
|
||||
extends DetectedProfileActivator
|
||||
{
|
||||
|
||||
protected boolean canDetectActivation( Profile profile )
|
||||
{
|
||||
return profile.getActivation() != null && profile.getActivation().getProperty() != null;
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
|
|||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolver;
|
||||
import org.apache.maven.artifact.transform.ReleaseArtifactTransformation;
|
||||
import org.apache.maven.model.Build;
|
||||
import org.apache.maven.model.DistributionManagement;
|
||||
import org.apache.maven.model.Model;
|
||||
|
@ -148,7 +147,8 @@ public class DefaultMavenProjectBuilder
|
|||
return buildFromSourceFile( projectDescriptor, localRepository, externalProfiles );
|
||||
}
|
||||
|
||||
private MavenProject buildFromSourceFile( File projectDescriptor, ArtifactRepository localRepository, List externalProfiles )
|
||||
private MavenProject buildFromSourceFile( File projectDescriptor, ArtifactRepository localRepository,
|
||||
List externalProfiles )
|
||||
throws ProjectBuildingException, ArtifactResolutionException
|
||||
{
|
||||
Model model = readModel( projectDescriptor );
|
||||
|
@ -216,14 +216,17 @@ public class DefaultMavenProjectBuilder
|
|||
return model;
|
||||
}
|
||||
|
||||
private MavenProject build( String pomLocation, Model model, ArtifactRepository localRepository, List externalProfiles )
|
||||
private MavenProject build( String pomLocation, Model model, ArtifactRepository localRepository,
|
||||
List externalProfiles )
|
||||
throws ProjectBuildingException, ArtifactResolutionException
|
||||
{
|
||||
Model superModel = getSuperModel();
|
||||
|
||||
LinkedList lineage = new LinkedList();
|
||||
|
||||
List aggregatedRemoteWagonRepositories = ProjectUtils.buildArtifactRepositories( superModel.getRepositories(), artifactRepositoryFactory, container );
|
||||
List aggregatedRemoteWagonRepositories = ProjectUtils.buildArtifactRepositories( superModel.getRepositories(),
|
||||
artifactRepositoryFactory,
|
||||
container );
|
||||
|
||||
for ( Iterator i = externalProfiles.iterator(); i.hasNext(); )
|
||||
{
|
||||
|
@ -233,7 +236,9 @@ public class DefaultMavenProjectBuilder
|
|||
{
|
||||
Repository mavenRepo = (Repository) repoIterator.next();
|
||||
|
||||
ArtifactRepository artifactRepo = ProjectUtils.buildArtifactRepository( mavenRepo, artifactRepositoryFactory, container );
|
||||
ArtifactRepository artifactRepo = ProjectUtils.buildArtifactRepository( mavenRepo,
|
||||
artifactRepositoryFactory,
|
||||
container );
|
||||
|
||||
if ( !aggregatedRemoteWagonRepositories.contains( artifactRepo ) )
|
||||
{
|
||||
|
@ -264,7 +269,8 @@ public class DefaultMavenProjectBuilder
|
|||
}
|
||||
catch ( ModelInterpolationException e )
|
||||
{
|
||||
throw new ProjectBuildingException( "Error building project from \'" + pomLocation + "\': " + model.getId(), e );
|
||||
throw new ProjectBuildingException( "Error building project from \'" + pomLocation + "\': " + model.getId(),
|
||||
e );
|
||||
}
|
||||
return project;
|
||||
}
|
||||
|
@ -298,7 +304,8 @@ public class DefaultMavenProjectBuilder
|
|||
* the resolved source roots, etc for the parent - that occurs for the parent when it is constructed independently
|
||||
* and projects are not cached or reused
|
||||
*/
|
||||
private MavenProject processProjectLogic( String pomLocation, MavenProject project, List remoteRepositories, List externalProfiles )
|
||||
private MavenProject processProjectLogic( String pomLocation, MavenProject project, List remoteRepositories,
|
||||
List externalProfiles )
|
||||
throws ProjectBuildingException, ModelInterpolationException
|
||||
{
|
||||
Model model = project.getModel();
|
||||
|
@ -341,12 +348,15 @@ public class DefaultMavenProjectBuilder
|
|||
|
||||
project.setActiveProfiles( activeProfiles );
|
||||
|
||||
project.setPluginArtifactRepositories( ProjectUtils.buildArtifactRepositories( model.getPluginRepositories(), artifactRepositoryFactory, container ) );
|
||||
project.setPluginArtifactRepositories(
|
||||
ProjectUtils.buildArtifactRepositories( model.getPluginRepositories(), artifactRepositoryFactory,
|
||||
container ) );
|
||||
|
||||
DistributionManagement dm = model.getDistributionManagement();
|
||||
if ( dm != null )
|
||||
{
|
||||
project.setDistributionManagementArtifactRepository( ProjectUtils.buildArtifactRepository( dm.getRepository(), artifactRepositoryFactory, container ) );
|
||||
project.setDistributionManagementArtifactRepository(
|
||||
ProjectUtils.buildArtifactRepository( dm.getRepository(), artifactRepositoryFactory, container ) );
|
||||
}
|
||||
|
||||
project.setParent( parentProject );
|
||||
|
@ -355,9 +365,7 @@ public class DefaultMavenProjectBuilder
|
|||
{
|
||||
Artifact parentArtifact = artifactFactory.createArtifact( parentProject.getGroupId(),
|
||||
parentProject.getArtifactId(),
|
||||
parentProject.getVersion(),
|
||||
null,
|
||||
"pom", null );
|
||||
parentProject.getVersion(), null, "pom", null );
|
||||
project.setParentArtifact( parentArtifact );
|
||||
}
|
||||
|
||||
|
@ -369,7 +377,9 @@ public class DefaultMavenProjectBuilder
|
|||
|
||||
if ( validationResult.getMessageCount() > 0 )
|
||||
{
|
||||
throw new ProjectBuildingException( "Failed to validate POM for \'" + pomLocation + "\'.\n\n Reason(s):\n" + validationResult.render( " " ) );
|
||||
throw new ProjectBuildingException(
|
||||
"Failed to validate POM for \'" + pomLocation + "\'.\n\n Reason(s):\n" +
|
||||
validationResult.render( " " ) );
|
||||
}
|
||||
|
||||
return project;
|
||||
|
@ -381,7 +391,8 @@ public class DefaultMavenProjectBuilder
|
|||
{
|
||||
if ( !model.getRepositories().isEmpty() )
|
||||
{
|
||||
List respositories = ProjectUtils.buildArtifactRepositories( model.getRepositories(), artifactRepositoryFactory, container );
|
||||
List respositories = ProjectUtils.buildArtifactRepositories( model.getRepositories(),
|
||||
artifactRepositoryFactory, container );
|
||||
aggregatedRemoteWagonRepositories.addAll( respositories );
|
||||
}
|
||||
|
||||
|
@ -447,12 +458,14 @@ public class DefaultMavenProjectBuilder
|
|||
catch ( IOException e )
|
||||
{
|
||||
throw new ProjectBuildingException(
|
||||
"Failed to build model from file '" + file.getAbsolutePath() + "'.\nError: \'" + e.getLocalizedMessage() + "\'", e );
|
||||
"Failed to build model from file '" + file.getAbsolutePath() + "'.\nError: \'" +
|
||||
e.getLocalizedMessage() + "\'", e );
|
||||
}
|
||||
catch ( XmlPullParserException e )
|
||||
{
|
||||
throw new ProjectBuildingException(
|
||||
"Failed to parse model from file '" + file.getAbsolutePath() + "'.\nError: \'" + e.getLocalizedMessage() + "\'", e );
|
||||
"Failed to parse model from file '" + file.getAbsolutePath() + "'.\nError: \'" +
|
||||
e.getLocalizedMessage() + "\'", e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -471,11 +484,15 @@ public class DefaultMavenProjectBuilder
|
|||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new ProjectBuildingException( "Failed build model from URL \'" + url.toExternalForm() + "\'\nError: \'" + e.getLocalizedMessage() + "\'", e );
|
||||
throw new ProjectBuildingException(
|
||||
"Failed build model from URL \'" + url.toExternalForm() + "\'\nError: \'" + e.getLocalizedMessage() +
|
||||
"\'", e );
|
||||
}
|
||||
catch ( XmlPullParserException e )
|
||||
{
|
||||
throw new ProjectBuildingException( "Failed to parse model from URL \'" + url.toExternalForm() + "\'\nError: \'" + e.getLocalizedMessage() + "\'", e );
|
||||
throw new ProjectBuildingException(
|
||||
"Failed to parse model from URL \'" + url.toExternalForm() + "\'\nError: \'" + e.getLocalizedMessage() +
|
||||
"\'", e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -496,7 +513,8 @@ public class DefaultMavenProjectBuilder
|
|||
protected Set createArtifacts( List dependencies )
|
||||
{
|
||||
// TODO: merge with MavenMetadataSource properly
|
||||
return new MavenMetadataSource( artifactResolver, this, artifactFactory ).createArtifacts( dependencies, null, null );
|
||||
return new MavenMetadataSource( artifactResolver, this, artifactFactory ).createArtifacts( dependencies, null,
|
||||
null );
|
||||
}
|
||||
|
||||
protected Set createPluginArtifacts( List plugins )
|
||||
|
@ -510,15 +528,15 @@ public class DefaultMavenProjectBuilder
|
|||
String version;
|
||||
if ( StringUtils.isEmpty( p.getVersion() ) )
|
||||
{
|
||||
version = ReleaseArtifactTransformation.RELEASE_VERSION;
|
||||
version = "RELEASE";
|
||||
}
|
||||
else
|
||||
{
|
||||
version = p.getVersion();
|
||||
}
|
||||
|
||||
Artifact artifact = artifactFactory.createArtifact( p.getGroupId(), p.getArtifactId(), version,
|
||||
null, "maven-plugin", null );
|
||||
Artifact artifact = artifactFactory.createArtifact( p.getGroupId(), p.getArtifactId(), version, null,
|
||||
"maven-plugin", null );
|
||||
if ( artifact != null )
|
||||
{
|
||||
pluginArtifacts.add( artifact );
|
||||
|
@ -545,7 +563,8 @@ public class DefaultMavenProjectBuilder
|
|||
{
|
||||
project.setFile( new File( ".", "pom.xml" ) );
|
||||
|
||||
List remoteRepositories = ProjectUtils.buildArtifactRepositories( superModel.getRepositories(), artifactRepositoryFactory, container );
|
||||
List remoteRepositories = ProjectUtils.buildArtifactRepositories( superModel.getRepositories(),
|
||||
artifactRepositoryFactory, container );
|
||||
|
||||
project = processProjectLogic( "<Super-POM>", project, remoteRepositories, externalProfiles );
|
||||
|
||||
|
|
|
@ -34,12 +34,12 @@ import org.apache.maven.model.MailingList;
|
|||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Organization;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.PluginManagement;
|
||||
import org.apache.maven.model.Reporting;
|
||||
import org.apache.maven.model.Scm;
|
||||
import org.apache.maven.model.PluginExecution;
|
||||
import org.apache.maven.model.PluginManagement;
|
||||
import org.apache.maven.model.ReportPlugin;
|
||||
import org.apache.maven.model.ReportSet;
|
||||
import org.apache.maven.model.Reporting;
|
||||
import org.apache.maven.model.Scm;
|
||||
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
||||
|
@ -1037,7 +1037,8 @@ public class MavenProject
|
|||
this.executionProject = executionProject;
|
||||
}
|
||||
|
||||
public void writeModel( Writer writer ) throws IOException
|
||||
public void writeModel( Writer writer )
|
||||
throws IOException
|
||||
{
|
||||
MavenXpp3Writer pomWriter = new MavenXpp3Writer();
|
||||
|
||||
|
|
|
@ -17,12 +17,12 @@ package org.apache.maven.project;
|
|||
*/
|
||||
|
||||
import org.apache.maven.model.Goal;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.PluginContainer;
|
||||
import org.apache.maven.model.PluginExecution;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.project.inheritance.ModelInheritanceAssembler;
|
||||
import org.apache.maven.project.inheritance.DefaultModelInheritanceAssembler;
|
||||
import org.apache.maven.project.inheritance.ModelInheritanceAssembler;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -29,7 +29,6 @@ import java.util.List;
|
|||
|
||||
public final class ProjectUtils
|
||||
{
|
||||
|
||||
private ProjectUtils()
|
||||
{
|
||||
}
|
||||
|
@ -46,7 +45,8 @@ public final class ProjectUtils
|
|||
{
|
||||
Repository mavenRepo = (Repository) i.next();
|
||||
|
||||
ArtifactRepository artifactRepo = buildArtifactRepository( mavenRepo, artifactRepositoryFactory, container );
|
||||
ArtifactRepository artifactRepo = buildArtifactRepository( mavenRepo, artifactRepositoryFactory,
|
||||
container );
|
||||
|
||||
if ( !repos.contains( artifactRepo ) )
|
||||
{
|
||||
|
@ -71,7 +71,8 @@ public final class ProjectUtils
|
|||
// TODO: make this a map inside the factory instead, so no lookup needed
|
||||
ArtifactRepositoryLayout layout = getRepositoryLayout( repo, container );
|
||||
|
||||
return artifactRepositoryFactory.createArtifactRepository( id, url, layout, snapshotPolicy, checksumPolicy );
|
||||
return artifactRepositoryFactory.createArtifactRepository( id, url, layout, snapshotPolicy,
|
||||
checksumPolicy );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -91,8 +92,9 @@ public final class ProjectUtils
|
|||
}
|
||||
catch ( ComponentLookupException e )
|
||||
{
|
||||
throw new ProjectBuildingException( "Cannot find layout implementation corresponding to: \'" + layout
|
||||
+ "\' for remote repository with id: \'" + mavenRepo.getId() + "\'.", e );
|
||||
throw new ProjectBuildingException(
|
||||
"Cannot find layout implementation corresponding to: \'" + layout +
|
||||
"\' for remote repository with id: \'" + mavenRepo.getId() + "\'.", e );
|
||||
}
|
||||
return repositoryLayout;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.project.artifact;
|
|||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.metadata.AbstractArtifactMetadata;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
|
||||
import org.apache.maven.artifact.manager.WagonManager;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||
|
@ -100,11 +99,6 @@ public class ProjectArtifactMetadata
|
|||
}
|
||||
}
|
||||
|
||||
public void retrieveFromRemoteRepository( ArtifactRepository remoteRepository, WagonManager wagonManager )
|
||||
{
|
||||
// not used - TODO: again indicates bad design?
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "project information for " + artifact.getArtifactId() + " " + artifact.getVersion();
|
||||
|
|
|
@ -229,7 +229,8 @@ public class DefaultModelInheritanceAssembler
|
|||
|
||||
if ( StringUtils.isEmpty( inherited ) || Boolean.valueOf( inherited ).booleanValue() )
|
||||
{
|
||||
ReportPlugin childReportPlugin = (ReportPlugin) childReportersByKey.get( parentReportPlugin.getKey() );
|
||||
ReportPlugin childReportPlugin = (ReportPlugin) childReportersByKey.get(
|
||||
parentReportPlugin.getKey() );
|
||||
|
||||
ReportPlugin mergedReportPlugin = parentReportPlugin;
|
||||
|
||||
|
@ -506,8 +507,8 @@ public class DefaultModelInheritanceAssembler
|
|||
childScm.setConnection( appendPath( parentScm.getConnection(), child.getArtifactId() ) );
|
||||
}
|
||||
|
||||
if ( StringUtils.isEmpty( childScm.getDeveloperConnection() )
|
||||
&& !StringUtils.isEmpty( parentScm.getDeveloperConnection() ) )
|
||||
if ( StringUtils.isEmpty( childScm.getDeveloperConnection() ) &&
|
||||
!StringUtils.isEmpty( parentScm.getDeveloperConnection() ) )
|
||||
{
|
||||
childScm
|
||||
.setDeveloperConnection( appendPath( parentScm.getDeveloperConnection(), child.getArtifactId() ) );
|
||||
|
|
|
@ -33,7 +33,6 @@ import java.util.TreeMap;
|
|||
public class DefaultModelDefaultsInjector
|
||||
implements ModelDefaultsInjector
|
||||
{
|
||||
|
||||
public void injectDefaults( Model model )
|
||||
{
|
||||
injectDependencyDefaults( model.getDependencies(), model.getDependencyManagement() );
|
||||
|
|
|
@ -24,7 +24,6 @@ package org.apache.maven.project.interpolation;
|
|||
public class ModelInterpolationException
|
||||
extends Exception
|
||||
{
|
||||
|
||||
/**
|
||||
* Added: Feb 2, 2005 by jdcasey
|
||||
*/
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.apache.maven.model.Model;
|
|||
*/
|
||||
public interface ModelInterpolator
|
||||
{
|
||||
|
||||
String ROLE = ModelInterpolator.class.getName();
|
||||
|
||||
Model interpolate( Model project )
|
||||
|
|
|
@ -16,9 +16,10 @@ package org.apache.maven.project;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
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.codehaus.plexus.PlexusTestCase;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -84,7 +85,8 @@ public abstract class MavenProjectTestCase
|
|||
ArtifactRepositoryLayout repoLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE,
|
||||
"legacy" );
|
||||
|
||||
ArtifactRepository r = new ArtifactRepository( "local", "file://" + getLocalRepositoryPath().getAbsolutePath(),
|
||||
ArtifactRepository r = new DefaultArtifactRepository( "local",
|
||||
"file://" + getLocalRepositoryPath().getAbsolutePath(),
|
||||
repoLayout );
|
||||
|
||||
return r;
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package org.apache.maven.project;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.PluginExecution;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
|
@ -24,7 +23,6 @@ import junit.framework.TestCase;
|
|||
public class ModelUtilsTest
|
||||
extends TestCase
|
||||
{
|
||||
|
||||
public void testShouldInheritOnePluginWithExecution()
|
||||
{
|
||||
Plugin parent = new Plugin();
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.io.File;
|
|||
public class ProjectBaseDirectoryAlignmentTest
|
||||
extends MavenProjectTestCase
|
||||
{
|
||||
|
||||
private String dir = "src/test/resources/projects/base-directory-alignment/";
|
||||
|
||||
public void testProjectDirectoryBaseDirectoryAlignment()
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.apache.maven.project;
|
|||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||
import org.apache.maven.artifact.factory.DefaultArtifactFactory;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
|
@ -112,7 +111,8 @@ public class ProjectClasspathArtifactResolver
|
|||
ArtifactMetadataSource source, ArtifactFilter filter )
|
||||
throws ArtifactResolutionException
|
||||
{
|
||||
return super.resolveTransitively( artifacts, remoteRepositories, localRepository, new Source( artifactFactory ), filter );
|
||||
return super.resolveTransitively( artifacts, remoteRepositories, localRepository, new Source( artifactFactory ),
|
||||
filter );
|
||||
}
|
||||
|
||||
public ArtifactResolutionResult resolveTransitively( Set artifacts, List remoteRepositories,
|
||||
|
@ -120,7 +120,8 @@ public class ProjectClasspathArtifactResolver
|
|||
ArtifactMetadataSource source )
|
||||
throws ArtifactResolutionException
|
||||
{
|
||||
return super.resolveTransitively( artifacts, remoteRepositories, localRepository, new Source( artifactFactory ) );
|
||||
return super.resolveTransitively( artifacts, remoteRepositories, localRepository,
|
||||
new Source( artifactFactory ) );
|
||||
}
|
||||
|
||||
public ArtifactResolutionResult resolveTransitively( Artifact artifact, List remoteRepositories,
|
||||
|
@ -128,6 +129,7 @@ public class ProjectClasspathArtifactResolver
|
|||
ArtifactMetadataSource source )
|
||||
throws ArtifactResolutionException
|
||||
{
|
||||
return super.resolveTransitively( artifact, remoteRepositories, localRepository, new Source( artifactFactory ) );
|
||||
return super.resolveTransitively( artifact, remoteRepositories, localRepository,
|
||||
new Source( artifactFactory ) );
|
||||
}
|
||||
}
|
|
@ -28,7 +28,6 @@ import java.util.Iterator;
|
|||
public class ProjectClasspathTest
|
||||
extends MavenProjectTestCase
|
||||
{
|
||||
|
||||
private String dir = "projects/scope/";
|
||||
|
||||
public void testProjectClasspath()
|
||||
|
|
|
@ -82,7 +82,8 @@ public class DefaultModelInheritanceAssemblerTest
|
|||
|
||||
assembler.assembleModelInheritance( child, parent );
|
||||
|
||||
assertEquals( "source directory should be from parent", "src/main/java", child.getBuild().getSourceDirectory() );
|
||||
assertEquals( "source directory should be from parent", "src/main/java",
|
||||
child.getBuild().getSourceDirectory() );
|
||||
assertEquals( "unit test source directory should be from parent", "src/test/java",
|
||||
child.getBuild().getTestSourceDirectory() );
|
||||
|
||||
|
@ -395,7 +396,8 @@ public class DefaultModelInheritanceAssemblerTest
|
|||
assertNotNull( "Goal from reference not found in test", testGoal );
|
||||
|
||||
assertEquals( "Goal IDs don't match", referenceGoal.getId(), testGoal.getId() );
|
||||
assertEquals( "Goal configurations don't match", referenceGoal.getConfiguration(), testGoal.getConfiguration() );
|
||||
assertEquals( "Goal configurations don't match", referenceGoal.getConfiguration(),
|
||||
testGoal.getConfiguration() );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -500,7 +502,8 @@ public class DefaultModelInheritanceAssemblerTest
|
|||
|
||||
if ( actualRepository.getId().equals( expectedRepository.getId() ) )
|
||||
{
|
||||
assertEquals( "Repository URLs don't match", expectedRepository.getUrl(), actualRepository.getUrl() );
|
||||
assertEquals( "Repository URLs don't match", expectedRepository.getUrl(),
|
||||
actualRepository.getUrl() );
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ import java.util.List;
|
|||
public class DefaultModelDefaultsInjectorTest
|
||||
extends TestCase
|
||||
{
|
||||
|
||||
public void testShouldConstructWithNoParams()
|
||||
{
|
||||
new DefaultModelDefaultsInjector();
|
||||
|
|
|
@ -35,7 +35,8 @@ public class DefaultModelValidatorTest
|
|||
|
||||
private ModelValidator validator;
|
||||
|
||||
public void testMissingModelVersion() throws Exception
|
||||
public void testMissingModelVersion()
|
||||
throws Exception
|
||||
{
|
||||
ModelValidationResult result = validate( "missing-modelVersion-pom.xml" );
|
||||
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
<requirement>
|
||||
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.resolver.ArtifactCollector</role>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
</components>
|
||||
|
|
Loading…
Reference in New Issue