mirror of
https://github.com/apache/maven.git
synced 2025-02-08 11:05:37 +00:00
o the newly gutted system bootstraps, i think i'm happy about the state of 3.x now :-)
git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@773740 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
096014099e
commit
3504931b37
@ -26,7 +26,6 @@
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.maven.artifact.ArtifactUtils;
|
import org.apache.maven.artifact.ArtifactUtils;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
|
||||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||||
import org.apache.maven.exception.DefaultExceptionHandler;
|
import org.apache.maven.exception.DefaultExceptionHandler;
|
||||||
import org.apache.maven.exception.ExceptionHandler;
|
import org.apache.maven.exception.ExceptionHandler;
|
||||||
@ -78,7 +77,7 @@ public List<String> getLifecyclePhases()
|
|||||||
|
|
||||||
public MavenExecutionResult execute( MavenExecutionRequest request )
|
public MavenExecutionResult execute( MavenExecutionRequest request )
|
||||||
{
|
{
|
||||||
// Need a general way to inject standard properties
|
//TODO: Need a general way to inject standard properties
|
||||||
if ( request.getStartTime() != null )
|
if ( request.getStartTime() != null )
|
||||||
{
|
{
|
||||||
request.getProperties().put( "${build.timestamp}", new SimpleDateFormat( "yyyyMMdd-hhmm" ).format( request.getStartTime() ) );
|
request.getProperties().put( "${build.timestamp}", new SimpleDateFormat( "yyyyMMdd-hhmm" ).format( request.getStartTime() ) );
|
||||||
|
@ -14,22 +14,7 @@
|
|||||||
* @author Jason van Zyl
|
* @author Jason van Zyl
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// maven-compat
|
//TODO: need phase information here to determine whether to hand back the classes/ or archive.
|
||||||
// target/classes
|
|
||||||
// maven-core
|
|
||||||
// target/classes
|
|
||||||
// maven-embedder
|
|
||||||
// target/classes
|
|
||||||
// maven-model
|
|
||||||
// target/classes
|
|
||||||
// maven-model-builder
|
|
||||||
// target/classes
|
|
||||||
// maven-plugin-api
|
|
||||||
// target/classes
|
|
||||||
// maven-repository
|
|
||||||
// target/classes
|
|
||||||
// maven-toolchain
|
|
||||||
// target/classes
|
|
||||||
public class ReactorArtifactRepository
|
public class ReactorArtifactRepository
|
||||||
extends LocalArtifactRepository
|
extends LocalArtifactRepository
|
||||||
{
|
{
|
||||||
@ -49,14 +34,25 @@ public Artifact find( Artifact artifact )
|
|||||||
|
|
||||||
if ( project != null )
|
if ( project != null )
|
||||||
{
|
{
|
||||||
//TODO: determine if we want to pass the artifact produced by the project if it
|
|
||||||
// is present and under what conditions we will do such a thing.
|
|
||||||
|
|
||||||
if ( artifact.getType().equals( "jar" ) )
|
if ( artifact.getType().equals( "jar" ) )
|
||||||
{
|
{
|
||||||
|
File artifactFile = new File( project.getBuild().getDirectory(), project.getArtifactId() + "-" + project.getVersion() + "."+ artifact.getArtifactHandler().getExtension() );
|
||||||
|
|
||||||
File classesDirectory = new File( project.getBuild().getOutputDirectory() );
|
File classesDirectory = new File( project.getBuild().getOutputDirectory() );
|
||||||
|
|
||||||
if ( classesDirectory.exists() )
|
//TODO: This is really completely wrong and should probably be based on the phase that is currently being executed.
|
||||||
|
// If we are running before the packaging phase there is going to be no archive anyway, but if we are running prior to package
|
||||||
|
// we shouldn't even take the archive anyway.
|
||||||
|
|
||||||
|
if ( artifactFile.exists() )
|
||||||
|
{
|
||||||
|
artifact.setFile( artifactFile );
|
||||||
|
|
||||||
|
artifact.setFromAuthoritativeRepository( true );
|
||||||
|
|
||||||
|
artifact.setResolved( true );
|
||||||
|
}
|
||||||
|
else if ( classesDirectory.exists() )
|
||||||
{
|
{
|
||||||
artifact.setFile( classesDirectory );
|
artifact.setFile( classesDirectory );
|
||||||
|
|
||||||
|
@ -36,6 +36,12 @@ public class MojoExecution
|
|||||||
|
|
||||||
private Xpp3Dom configuration;
|
private Xpp3Dom configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The phase may or may not have been bound to a phase but once the plan has been calculated we know what phase
|
||||||
|
* this mojo execution is going to run in.
|
||||||
|
*/
|
||||||
|
private String lifecyclePhase;
|
||||||
|
|
||||||
public MojoExecution( MojoDescriptor mojoDescriptor )
|
public MojoExecution( MojoDescriptor mojoDescriptor )
|
||||||
{
|
{
|
||||||
this.mojoDescriptor = mojoDescriptor;
|
this.mojoDescriptor = mojoDescriptor;
|
||||||
@ -86,4 +92,14 @@ public String identify()
|
|||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLifecyclePhase()
|
||||||
|
{
|
||||||
|
return lifecyclePhase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLifecyclePhase( String lifecyclePhase )
|
||||||
|
{
|
||||||
|
this.lifecyclePhase = lifecyclePhase;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,6 @@
|
|||||||
/**
|
/**
|
||||||
* @author Jason van Zyl
|
* @author Jason van Zyl
|
||||||
*/
|
*/
|
||||||
//TODO: we don't need the repository metadata thing really, we can retrieve files independendently and parse
|
|
||||||
@Component(role = ArtifactMetadataSource.class)
|
@Component(role = ArtifactMetadataSource.class)
|
||||||
public class MavenMetadataSource
|
public class MavenMetadataSource
|
||||||
implements ArtifactMetadataSource
|
implements ArtifactMetadataSource
|
||||||
@ -118,26 +117,6 @@ public ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepo
|
|||||||
return new ResolutionGroup( pomArtifact, artifacts, remoteRepositories );
|
return new ResolutionGroup( pomArtifact, artifacts, remoteRepositories );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
private Set<Artifact> createArtifacts( List<Dependency> dependencies )
|
|
||||||
{
|
|
||||||
Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
|
|
||||||
|
|
||||||
for ( Dependency d : dependencies )
|
|
||||||
{
|
|
||||||
String effectiveScope = getEffectiveScope( d.getScope(), artifact.getScope() );
|
|
||||||
|
|
||||||
if ( effectiveScope != null )
|
|
||||||
{
|
|
||||||
Artifact dependencyArtifact = repositorySystem.createArtifact( d.getGroupId(), d.getArtifactId(), d.getVersion(), effectiveScope, d.getType() );
|
|
||||||
|
|
||||||
artifacts.add( dependencyArtifact );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
private String getEffectiveScope( String originalScope, String inheritedScope )
|
private String getEffectiveScope( String originalScope, String inheritedScope )
|
||||||
{
|
{
|
||||||
String effectiveScope = Artifact.SCOPE_RUNTIME;
|
String effectiveScope = Artifact.SCOPE_RUNTIME;
|
||||||
@ -235,20 +214,28 @@ private List<ArtifactVersion> retrieveAvailableVersionsFromMetadata( Metadata re
|
|||||||
return versions;
|
return versions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// USED BY MAVEN ASSEMBLY PLUGIN
|
// USED BY MAVEN ASSEMBLY PLUGIN
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static Set<Artifact> createArtifacts( ArtifactFactory artifactFactory, List<Dependency> dependencies, String inheritedScope, ArtifactFilter dependencyFilter, MavenProject project )
|
public static Set<Artifact> createArtifacts( ArtifactFactory artifactFactory, List<Dependency> dependencies, String inheritedScope, ArtifactFilter dependencyFilter, MavenProject project )
|
||||||
throws InvalidDependencyVersionException
|
throws InvalidDependencyVersionException
|
||||||
{
|
{
|
||||||
try
|
return createArtifacts( artifactFactory, dependencies, dependencyFilter );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Set<Artifact> createArtifacts( ArtifactFactory factory, List<Dependency> dependencies, ArtifactFilter filter )
|
||||||
{
|
{
|
||||||
return repositorySystem.createArtifacts( artifactFactory, dependencies, inheritedScope, dependencyFilter, project );
|
Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
|
||||||
}
|
|
||||||
catch ( VersionNotFoundException e )
|
for ( Dependency d : dependencies )
|
||||||
{
|
{
|
||||||
throw new InvalidDependencyVersionException( e.getProjectId(), e.getDependency(), e.getPomFile, e.getCauseException() );
|
Artifact dependencyArtifact = factory.createArtifact( d.getGroupId(), d.getArtifactId(), d.getVersion(), d.getScope(), d.getType() );
|
||||||
|
|
||||||
|
if ( filter.include( dependencyArtifact ) )
|
||||||
|
{
|
||||||
|
artifacts.add( dependencyArtifact );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
return artifacts;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user