mirror of https://github.com/apache/maven.git
o push out the artifact repository creation when it's requested in the project
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@751159 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0f3af9305d
commit
30e6002f40
|
@ -1846,7 +1846,7 @@ public class DefaultPluginManager
|
|||
|
||||
MavenProject pluginProject = buildPluginProject( plugin, localRepository, project.getRemoteArtifactRepositories() );
|
||||
|
||||
Artifact pluginArtifact = repositorySystem.createPluginArtifact( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion() );
|
||||
Artifact pluginArtifact = repositorySystem.createPluginArtifact( plugin );
|
||||
|
||||
checkRequiredMavenVersion( plugin, pluginProject, localRepository, project.getRemoteArtifactRepositories() );
|
||||
|
||||
|
|
|
@ -228,6 +228,8 @@ public class MavenProject
|
|||
this.projectBuilderConfiguration = projectBuilderConfiguration;
|
||||
this.repositorySystem = repositorySystem;
|
||||
originalModel = model;
|
||||
|
||||
/*
|
||||
DistributionManagement dm = model.getDistributionManagement();
|
||||
|
||||
if ( dm != null )
|
||||
|
@ -235,12 +237,8 @@ public class MavenProject
|
|||
ArtifactRepository repo = repositorySystem.buildArtifactRepository( dm.getRepository() );
|
||||
setReleaseArtifactRepository( repo );
|
||||
|
||||
if ( dm.getSnapshotRepository() != null )
|
||||
{
|
||||
repo = repositorySystem.buildArtifactRepository( dm.getSnapshotRepository() );
|
||||
setSnapshotArtifactRepository( repo );
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
setRemoteArtifactRepositories( projectBuilderConfiguration.getRemoteRepositories() );
|
||||
}
|
||||
|
@ -1098,7 +1096,7 @@ public class MavenProject
|
|||
version = p.getVersion();
|
||||
}
|
||||
|
||||
Artifact artifact = repositorySystem.createPluginArtifact( p.getGroupId(), p.getArtifactId(), version );
|
||||
Artifact artifact = repositorySystem.createPluginArtifact( p );
|
||||
|
||||
if ( artifact == null )
|
||||
{
|
||||
|
@ -1152,7 +1150,11 @@ public class MavenProject
|
|||
version = p.getVersion();
|
||||
}
|
||||
|
||||
Artifact artifact = repositorySystem.createPluginArtifact( p.getGroupId(), p.getArtifactId(), version );
|
||||
Plugin pp = new Plugin();
|
||||
pp.setGroupId( p.getGroupId() );
|
||||
pp.setArtifactId( p.getArtifactId() );
|
||||
pp.setVersion( version );
|
||||
Artifact artifact = repositorySystem.createPluginArtifact( pp );
|
||||
|
||||
if ( artifact != null )
|
||||
{
|
||||
|
@ -1915,11 +1917,33 @@ public class MavenProject
|
|||
|
||||
protected ArtifactRepository getReleaseArtifactRepository()
|
||||
{
|
||||
if ( getDistributionManagement().getRepository() != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
setReleaseArtifactRepository( repositorySystem.buildArtifactRepository( getDistributionManagement().getRepository() ) );
|
||||
}
|
||||
catch ( InvalidRepositoryException e )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return releaseArtifactRepository;
|
||||
}
|
||||
|
||||
protected ArtifactRepository getSnapshotArtifactRepository()
|
||||
{
|
||||
if ( getDistributionManagement().getSnapshotRepository() != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
setSnapshotArtifactRepository( repositorySystem.buildArtifactRepository( getDistributionManagement().getSnapshotRepository() ) );
|
||||
}
|
||||
catch ( InvalidRepositoryException e )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return snapshotArtifactRepository;
|
||||
}
|
||||
|
||||
|
@ -2041,6 +2065,7 @@ public class MavenProject
|
|||
setManagedVersionMap( new ManagedVersionMap( project.getManagedVersionMap() ) );
|
||||
}
|
||||
|
||||
/*
|
||||
if ( project.getReleaseArtifactRepository() != null )
|
||||
{
|
||||
setReleaseArtifactRepository( project.getReleaseArtifactRepository() );
|
||||
|
@ -2050,6 +2075,7 @@ public class MavenProject
|
|||
{
|
||||
setSnapshotArtifactRepository( project.getSnapshotArtifactRepository() );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private void addArtifactPath( Artifact a, List<String> list )
|
||||
|
|
|
@ -19,10 +19,7 @@ package org.apache.maven.project;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolver;
|
||||
import org.apache.maven.repository.MavenRepositorySystem;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
|
||||
@Component(role=MavenProjectBuilder.class,hint="test")
|
||||
public class TestProjectBuilder
|
||||
|
|
|
@ -45,6 +45,7 @@ import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException
|
|||
import org.apache.maven.artifact.versioning.VersionRange;
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.Exclusion;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.Repository;
|
||||
import org.apache.maven.model.RepositoryPolicy;
|
||||
import org.apache.maven.wagon.authentication.AuthenticationInfo;
|
||||
|
@ -153,19 +154,19 @@ public class LegacyMavenRepositorySystem
|
|||
return artifactFactory.createParentArtifact( groupId, artifactId, version );
|
||||
}
|
||||
|
||||
public Artifact createPluginArtifact( String groupId, String artifactId, String version )
|
||||
public Artifact createPluginArtifact( Plugin plugin )
|
||||
{
|
||||
VersionRange versionRange;
|
||||
try
|
||||
{
|
||||
versionRange = VersionRange.createFromVersionSpec( version );
|
||||
versionRange = VersionRange.createFromVersionSpec( plugin.getVersion() );
|
||||
}
|
||||
catch ( InvalidVersionSpecificationException e )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return artifactFactory.createPluginArtifact( groupId, artifactId, versionRange );
|
||||
return artifactFactory.createPluginArtifact( plugin.getGroupId(), plugin.getArtifactId(), versionRange );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
|
|||
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
|
||||
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.Repository;
|
||||
import org.apache.maven.wagon.events.TransferListener;
|
||||
|
||||
|
@ -40,15 +41,12 @@ import org.apache.maven.wagon.events.TransferListener;
|
|||
*/
|
||||
public interface MavenRepositorySystem
|
||||
{
|
||||
// Artifact creation: This needs to be reduced to fewer, if not one, method.
|
||||
|
||||
Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type );
|
||||
|
||||
Artifact createProjectArtifact( String groupId, String artifactId, String metaVersionId );
|
||||
|
||||
Artifact createPluginArtifact( String groupId, String artifactId, String version );
|
||||
Artifact createPluginArtifact( Plugin plugin );
|
||||
|
||||
// This is still only used in one place.
|
||||
Artifact createDependencyArtifact( Dependency dependency );
|
||||
|
||||
//REMOVE
|
||||
|
|
Loading…
Reference in New Issue