mirror of https://github.com/apache/maven.git
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.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.artifact.ArtifactUtils;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||
import org.apache.maven.exception.DefaultExceptionHandler;
|
||||
import org.apache.maven.exception.ExceptionHandler;
|
||||
|
@ -78,7 +77,7 @@ public class DefaultMaven
|
|||
|
||||
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 )
|
||||
{
|
||||
request.getProperties().put( "${build.timestamp}", new SimpleDateFormat( "yyyyMMdd-hhmm" ).format( request.getStartTime() ) );
|
||||
|
|
|
@ -14,22 +14,7 @@ import org.apache.maven.project.MavenProject;
|
|||
* @author Jason van Zyl
|
||||
*/
|
||||
|
||||
// maven-compat
|
||||
// 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
|
||||
//TODO: need phase information here to determine whether to hand back the classes/ or archive.
|
||||
public class ReactorArtifactRepository
|
||||
extends LocalArtifactRepository
|
||||
{
|
||||
|
@ -49,14 +34,25 @@ public class ReactorArtifactRepository
|
|||
|
||||
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" ) )
|
||||
{
|
||||
File artifactFile = new File( project.getBuild().getDirectory(), project.getArtifactId() + "-" + project.getVersion() + "."+ artifact.getArtifactHandler().getExtension() );
|
||||
|
||||
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 );
|
||||
|
||||
|
|
|
@ -36,6 +36,12 @@ public class MojoExecution
|
|||
|
||||
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 )
|
||||
{
|
||||
this.mojoDescriptor = mojoDescriptor;
|
||||
|
@ -86,4 +92,14 @@ public class MojoExecution
|
|||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String getLifecyclePhase()
|
||||
{
|
||||
return lifecyclePhase;
|
||||
}
|
||||
|
||||
public void setLifecyclePhase( String lifecyclePhase )
|
||||
{
|
||||
this.lifecyclePhase = lifecyclePhase;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ import org.codehaus.plexus.logging.Logger;
|
|||
/**
|
||||
* @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)
|
||||
public class MavenMetadataSource
|
||||
implements ArtifactMetadataSource
|
||||
|
@ -95,7 +94,7 @@ public class MavenMetadataSource
|
|||
artifacts = new LinkedHashSet<Artifact>();
|
||||
|
||||
for ( Dependency d : project.getDependencies() )
|
||||
{
|
||||
{
|
||||
String effectiveScope = getEffectiveScope( d.getScope(), artifact.getScope() );
|
||||
|
||||
if ( effectiveScope != null )
|
||||
|
@ -118,26 +117,6 @@ public class MavenMetadataSource
|
|||
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 )
|
||||
{
|
||||
String effectiveScope = Artifact.SCOPE_RUNTIME;
|
||||
|
@ -215,13 +194,13 @@ public class MavenMetadataSource
|
|||
private List<ArtifactVersion> retrieveAvailableVersionsFromMetadata( Metadata repoMetadata )
|
||||
{
|
||||
List<ArtifactVersion> versions;
|
||||
|
||||
|
||||
if ( ( repoMetadata != null ) && ( repoMetadata.getVersioning() != null ) )
|
||||
{
|
||||
List<String> metadataVersions = repoMetadata.getVersioning().getVersions();
|
||||
|
||||
|
||||
versions = new ArrayList<ArtifactVersion>( metadataVersions.size() );
|
||||
|
||||
|
||||
for ( String version : metadataVersions )
|
||||
{
|
||||
versions.add( new DefaultArtifactVersion( version ) );
|
||||
|
@ -234,21 +213,29 @@ public class MavenMetadataSource
|
|||
|
||||
return versions;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
// USED BY MAVEN ASSEMBLY PLUGIN
|
||||
@Deprecated
|
||||
public static Set<Artifact> createArtifacts( ArtifactFactory artifactFactory, List<Dependency> dependencies, String inheritedScope, ArtifactFilter dependencyFilter, MavenProject project )
|
||||
throws InvalidDependencyVersionException
|
||||
{
|
||||
try
|
||||
{
|
||||
return repositorySystem.createArtifacts( artifactFactory, dependencies, inheritedScope, dependencyFilter, project );
|
||||
}
|
||||
catch ( VersionNotFoundException e )
|
||||
{
|
||||
throw new InvalidDependencyVersionException( e.getProjectId(), e.getDependency(), e.getPomFile, e.getCauseException() );
|
||||
}
|
||||
}
|
||||
*/
|
||||
{
|
||||
return createArtifacts( artifactFactory, dependencies, dependencyFilter );
|
||||
}
|
||||
|
||||
private static Set<Artifact> createArtifacts( ArtifactFactory factory, List<Dependency> dependencies, ArtifactFilter filter )
|
||||
{
|
||||
Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
|
||||
|
||||
for ( Dependency d : dependencies )
|
||||
{
|
||||
Artifact dependencyArtifact = factory.createArtifact( d.getGroupId(), d.getArtifactId(), d.getVersion(), d.getScope(), d.getType() );
|
||||
|
||||
if ( filter.include( dependencyArtifact ) )
|
||||
{
|
||||
artifacts.add( dependencyArtifact );
|
||||
}
|
||||
}
|
||||
|
||||
return artifacts;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue