You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2007/11/02 17:44:06 UTC
svn commit: r591391 [3/3] - in /maven/components/trunk: ./
maven-core/src/main/aspect/org/apache/maven/compat/plugin/
maven-core/src/main/java/org/apache/maven/
maven-core/src/main/java/org/apache/maven/execution/
maven-core/src/main/java/org/apache/ma...
Modified: maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java?rev=591391&r1=591390&r2=591391&view=diff
==============================================================================
--- maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java (original)
+++ maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java Fri Nov 2 09:44:00 2007
@@ -28,6 +28,7 @@
import org.apache.maven.embedder.Configuration;
import org.apache.maven.embedder.MavenEmbedder;
import org.apache.maven.embedder.MavenEmbedderException;
+import org.apache.maven.execution.DefaultMavenRealmManager;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.model.Profile;
import org.apache.maven.model.Repository;
@@ -113,9 +114,27 @@
processSettings( request, configuration );
+ realmManager( request, configuration );
+
return request;
}
+ private void realmManager( MavenExecutionRequest request,
+ Configuration configuration )
+ {
+ if ( request.getRealmManager() == null )
+ {
+ if ( configuration.getRealmManager() == null )
+ {
+ request.setRealmManager( new DefaultMavenRealmManager( container, getLogger() ) );
+ }
+ else
+ {
+ request.setRealmManager( configuration.getRealmManager() );
+ }
+ }
+ }
+
private void processSettings( MavenExecutionRequest request,
Configuration configuration )
{
@@ -125,7 +144,7 @@
List settingsProfiles = settings.getProfiles();
- if ( settingsProfiles != null && !settingsProfiles.isEmpty() )
+ if ( ( settingsProfiles != null ) && !settingsProfiles.isEmpty() )
{
List settingsActiveProfileIds = settings.getActiveProfiles();
@@ -386,7 +405,7 @@
}
// ------------------------------------------------------------------------
- // Snapshot Policy
+ // Snapshot Policy
// ------------------------------------------------------------------------
private void snapshotPolicy( MavenExecutionRequest request,
@@ -575,7 +594,7 @@
}
// ------------------------------------------------------------------------
- // Profile Manager
+ // Profile Manager
// ------------------------------------------------------------------------
private void profileManager( MavenExecutionRequest request,
Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java?rev=591391&r1=591390&r2=591391&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java Fri Nov 2 09:44:00 2007
@@ -83,11 +83,11 @@
public class MavenProject
{
public static final String EMPTY_PROJECT_GROUP_ID = "unknown";
-
+
public static final String EMPTY_PROJECT_ARTIFACT_ID = "empty-project";
-
+
public static final String EMPTY_PROJECT_VERSION = "0";
-
+
private Model model;
private MavenProject parent;
@@ -140,7 +140,7 @@
private Set extensionArtifacts;
private Map extensionArtifactMap;
-
+
private Map managedVersionMap;
private Map projectReferences = new HashMap();
@@ -148,7 +148,7 @@
private Build buildOverlay;
private boolean executionRoot;
-
+
private Map moduleAdjustments;
private Stack previousExecutionProjects = new Stack();
@@ -156,11 +156,11 @@
public MavenProject()
{
Model model = new Model();
-
+
model.setGroupId( EMPTY_PROJECT_GROUP_ID );
model.setArtifactId( EMPTY_PROJECT_ARTIFACT_ID );
model.setVersion( EMPTY_PROJECT_VERSION );
-
+
this.model = model;
}
@@ -174,108 +174,108 @@
// disown the parent
// copy fields
- this.file = project.file;
+ file = project.file;
// don't need a deep copy, they don't get modified or added/removed to/from - but make them unmodifiable to be sure!
if ( project.dependencyArtifacts != null )
{
- this.dependencyArtifacts = Collections.unmodifiableSet( project.dependencyArtifacts );
+ dependencyArtifacts = Collections.unmodifiableSet( project.dependencyArtifacts );
}
-
+
if ( project.artifacts != null )
{
- this.artifacts = Collections.unmodifiableSet( project.artifacts );
+ artifacts = Collections.unmodifiableSet( project.artifacts );
}
-
+
if ( project.pluginArtifacts != null )
{
- this.pluginArtifacts = Collections.unmodifiableSet( project.pluginArtifacts );
+ pluginArtifacts = Collections.unmodifiableSet( project.pluginArtifacts );
}
-
+
if ( project.reportArtifacts != null )
{
- this.reportArtifacts = Collections.unmodifiableSet( project.reportArtifacts );
- }
-
+ reportArtifacts = Collections.unmodifiableSet( project.reportArtifacts );
+ }
+
if ( project.extensionArtifacts != null )
{
- this.extensionArtifacts = Collections.unmodifiableSet( project.extensionArtifacts );
- }
-
- this.parentArtifact = project.parentArtifact;
+ extensionArtifacts = Collections.unmodifiableSet( project.extensionArtifacts );
+ }
+
+ parentArtifact = project.parentArtifact;
if ( project.remoteArtifactRepositories != null )
{
- this.remoteArtifactRepositories = Collections.unmodifiableList( project.remoteArtifactRepositories );
- }
-
+ remoteArtifactRepositories = Collections.unmodifiableList( project.remoteArtifactRepositories );
+ }
+
if ( project.pluginArtifactRepositories != null )
{
- this.pluginArtifactRepositories = Collections.unmodifiableList( project.pluginArtifactRepositories );
- }
-
+ pluginArtifactRepositories = Collections.unmodifiableList( project.pluginArtifactRepositories );
+ }
+
if ( project.collectedProjects != null )
{
- this.collectedProjects = Collections.unmodifiableList( project.collectedProjects );
- }
-
+ collectedProjects = Collections.unmodifiableList( project.collectedProjects );
+ }
+
if ( project.activeProfiles != null )
{
- this.activeProfiles = Collections.unmodifiableList( project.activeProfiles );
- }
-
+ activeProfiles = Collections.unmodifiableList( project.activeProfiles );
+ }
+
if ( project.getAttachedArtifacts() != null )
{
// clone properties modifyable by plugins in a forked lifecycle
- this.attachedArtifacts = new ArrayList( project.getAttachedArtifacts() );
- }
-
+ attachedArtifacts = new ArrayList( project.getAttachedArtifacts() );
+ }
+
if ( project.compileSourceRoots != null )
{
// clone source roots
- this.compileSourceRoots = new ArrayList( project.compileSourceRoots );
- }
-
+ compileSourceRoots = new ArrayList( project.compileSourceRoots );
+ }
+
if ( project.testCompileSourceRoots != null )
{
- this.testCompileSourceRoots = new ArrayList( project.testCompileSourceRoots );
- }
-
+ testCompileSourceRoots = new ArrayList( project.testCompileSourceRoots );
+ }
+
if ( project.scriptSourceRoots != null )
{
- this.scriptSourceRoots = new ArrayList( project.scriptSourceRoots );
- }
-
- this.model = ModelUtils.cloneModel( project.model );
+ scriptSourceRoots = new ArrayList( project.scriptSourceRoots );
+ }
+
+ model = ModelUtils.cloneModel( project.model );
if ( project.originalModel != null )
{
- this.originalModel = ModelUtils.cloneModel( project.originalModel );
+ originalModel = ModelUtils.cloneModel( project.originalModel );
}
- this.executionRoot = project.executionRoot;
+ executionRoot = project.executionRoot;
if ( project.artifact != null )
{
- this.artifact = ArtifactUtils.copyArtifact( project.artifact );
+ artifact = ArtifactUtils.copyArtifact( project.artifact );
}
-
+
if ( project.getManagedVersionMap() != null )
{
setManagedVersionMap( new ManagedVersionMap( project.getManagedVersionMap() ) );
}
-
+
if ( project.releaseArtifactRepository != null )
{
releaseArtifactRepository = project.releaseArtifactRepository;
}
-
+
if ( project.snapshotArtifactRepository != null )
{
snapshotArtifactRepository = project.snapshotArtifactRepository;
}
}
-
+
// TODO: Find a way to use <relativePath/> here...it's tricky, because the moduleProject
// usually doesn't have a file associated with it yet.
public String getModulePathAdjustment( MavenProject moduleProject ) throws IOException
@@ -283,20 +283,20 @@
// FIXME: This is hacky. What if module directory doesn't match artifactid, and parent
// is coming from the repository??
String module = moduleProject.getArtifactId();
-
+
File moduleFile = moduleProject.getFile();
-
+
if ( moduleFile != null )
{
File moduleDir = moduleFile.getCanonicalFile().getParentFile();
-
+
module = moduleDir.getName();
}
-
+
if ( moduleAdjustments == null )
{
moduleAdjustments = new HashMap();
-
+
List modules = getModules();
if ( modules != null )
{
@@ -304,21 +304,21 @@
{
String modulePath = (String) it.next();
String moduleName = modulePath;
-
+
if ( moduleName.endsWith( "/" ) || moduleName.endsWith( "\\" ) )
{
moduleName = moduleName.substring( 0, moduleName.length() - 1 );
}
-
+
int lastSlash = moduleName.lastIndexOf( '/' );
-
+
if ( lastSlash < 0 )
{
lastSlash = moduleName.lastIndexOf( '\\' );
}
-
+
String adjustment = null;
-
+
if ( lastSlash > -1 )
{
moduleName = moduleName.substring( lastSlash + 1 );
@@ -329,7 +329,7 @@
}
}
}
-
+
return (String) moduleAdjustments.get( module );
}
@@ -530,7 +530,7 @@
{
Set artifacts = getArtifacts();
- if ( artifacts == null || artifacts.isEmpty() )
+ if ( ( artifacts == null ) || artifacts.isEmpty() )
{
return Collections.EMPTY_LIST;
}
@@ -568,7 +568,7 @@
list.add( getBuild().getTestOutputDirectory() );
list.add( getBuild().getOutputDirectory() );
-
+
for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
{
Artifact a = (Artifact) i.next();
@@ -623,7 +623,7 @@
{
Set artifacts = getArtifacts();
- if ( artifacts == null || artifacts.isEmpty() )
+ if ( ( artifacts == null ) || artifacts.isEmpty() )
{
return Collections.EMPTY_LIST;
}
@@ -709,7 +709,7 @@
{
Set artifacts = getArtifacts();
- if ( artifacts == null || artifacts.isEmpty() )
+ if ( ( artifacts == null ) || artifacts.isEmpty() )
{
return Collections.EMPTY_LIST;
}
@@ -786,7 +786,7 @@
{
Set artifacts = getArtifacts();
- if ( artifacts == null || artifacts.isEmpty() )
+ if ( ( artifacts == null ) || artifacts.isEmpty() )
{
return Collections.EMPTY_LIST;
}
@@ -842,12 +842,12 @@
public String getGroupId()
{
String groupId = model.getGroupId();
-
- if ( groupId == null && model.getParent() != null )
+
+ if ( ( groupId == null ) && ( model.getParent() != null ) )
{
groupId = model.getParent().getGroupId();
}
-
+
return groupId;
}
@@ -887,12 +887,12 @@
public String getVersion()
{
String version = model.getVersion();
-
- if ( version == null && model.getParent() != null )
+
+ if ( ( version == null ) && ( model.getParent() != null ) )
{
version = model.getParent().getVersion();
}
-
+
return version;
}
@@ -1038,7 +1038,7 @@
public void setBuild( Build build )
{
- this.buildOverlay = new BuildOverlay( build );
+ buildOverlay = new BuildOverlay( build );
model.setBuild( build );
}
@@ -1103,13 +1103,13 @@
this.artifacts = artifacts;
// flush the calculated artifactMap
- this.artifactMap = null;
+ artifactMap = null;
}
/**
* All dependencies that this project has, including transitive ones.
* Contents are lazily populated, so depending on what phases have run dependencies in some scopes won't be included.
- * eg. if only compile phase has run, dependencies with scope test won't be included.
+ * eg. if only compile phase has run, dependencies with scope test won't be included.
* @return {@link Set} < {@link Artifact} >
* @see #getDependencyArtifacts() to get only direct dependencies
*/
@@ -1132,7 +1132,7 @@
{
this.pluginArtifacts = pluginArtifacts;
- this.pluginArtifactMap = null;
+ pluginArtifactMap = null;
}
public Set getPluginArtifacts()
@@ -1154,7 +1154,7 @@
{
this.reportArtifacts = reportArtifacts;
- this.reportArtifactMap = null;
+ reportArtifactMap = null;
}
public Set getReportArtifacts()
@@ -1176,12 +1176,12 @@
{
this.extensionArtifacts = extensionArtifacts;
- this.extensionArtifactMap = null;
+ extensionArtifactMap = null;
}
public Set getExtensionArtifacts()
{
- return this.extensionArtifacts;
+ return extensionArtifacts;
}
public Map getExtensionArtifactMap()
@@ -1249,7 +1249,7 @@
return pluginMgmt;
}
-
+
private Build getModelBuild()
{
Build build = model.getBuild();
@@ -1260,7 +1260,7 @@
model.setBuild( build );
}
-
+
return build;
}
@@ -1277,7 +1277,7 @@
build.flushPluginMap();
}
}
-
+
public void injectPluginManagementInfo( Plugin plugin )
{
PluginManagement pm = getModelBuild().getPluginManagement();
@@ -1288,7 +1288,7 @@
String pluginKey = plugin.getKey();
- if ( pmByKey != null && pmByKey.containsKey( pluginKey ) )
+ if ( ( pmByKey != null ) && pmByKey.containsKey( pluginKey ) )
{
Plugin pmPlugin = (Plugin) pmByKey.get( pluginKey );
@@ -1323,7 +1323,7 @@
public ArtifactRepository getDistributionManagementArtifactRepository()
{
- return getArtifact().isSnapshot() && snapshotArtifactRepository != null ? snapshotArtifactRepository
+ return getArtifact().isSnapshot() && ( snapshotArtifactRepository != null ) ? snapshotArtifactRepository
: releaseArtifactRepository;
}
@@ -1462,7 +1462,7 @@
{
previousExecutionProjects.push( this.executionProject );
}
-
+
this.executionProject = executionProject;
}
@@ -1516,15 +1516,15 @@
{
return originalModel;
}
-
+
public void setManagedVersionMap( Map map )
{
- this.managedVersionMap = map;
+ managedVersionMap = map;
}
-
+
public Map getManagedVersionMap()
{
- return this.managedVersionMap;
+ return managedVersionMap;
}
public boolean equals( Object other )
@@ -1553,7 +1553,7 @@
public List getBuildExtensions()
{
Build build = getBuild();
- if ( build == null || build.getExtensions() == null )
+ if ( ( build == null ) || ( build.getExtensions() == null ) )
{
return Collections.EMPTY_LIST;
}
@@ -1624,17 +1624,17 @@
public Artifact replaceWithActiveArtifact( Artifact pluginArtifact )
{
- if ( getProjectReferences() != null && !getProjectReferences().isEmpty() )
+ if ( ( getProjectReferences() != null ) && !getProjectReferences().isEmpty() )
{
String refId = getProjectReferenceId( pluginArtifact.getGroupId(), pluginArtifact.getArtifactId(), pluginArtifact.getVersion() );
MavenProject ref = (MavenProject) getProjectReferences().get( refId );
- if ( ref != null && ref.getArtifact() != null )
+ if ( ( ref != null ) && ( ref.getArtifact() != null ) )
{
// TODO: if not matching, we should get the correct artifact from that project (attached)
if ( ref.getArtifact().getDependencyConflictId().equals( pluginArtifact.getDependencyConflictId() ) )
{
// if the project artifact doesn't exist, don't use it. We haven't built that far.
- if ( ref.getArtifact().getFile() != null && ref.getArtifact().getFile().exists() )
+ if ( ( ref.getArtifact().getFile() != null ) && ref.getArtifact().getFile().exists() )
{
pluginArtifact = new ActiveProjectArtifact( ref, pluginArtifact );
return pluginArtifact;
@@ -1695,7 +1695,7 @@
( ref.getGroupId().equals( pluginArtifact.getGroupId() ) ) &&
( ref.getArtifact().getType().equals( "ejb" ) ) &&
( pluginArtifact.getType().equals( "ejb-client" ) ) &&
- ( ref.getArtifact().getFile() != null && ref.getArtifact().getFile().exists() ) )
+ ( ( ref.getArtifact().getFile() != null ) && ref.getArtifact().getFile().exists() ) )
{
pluginArtifact = new ActiveProjectArtifact(
ref,
@@ -1706,12 +1706,12 @@
}
return pluginArtifact;
}
-
+
private void addArtifactPath(Artifact a, List list) throws DependencyResolutionRequiredException
{
String refId = getProjectReferenceId( a.getGroupId(), a.getArtifactId(), a.getVersion() );
MavenProject project = (MavenProject) projectReferences.get( refId );
-
+
boolean projectDirFound = false;
if ( project != null )
{
@@ -1740,7 +1740,7 @@
list.add( file.getPath() );
}
}
-
+
public void clearExecutionProject()
{
if ( !previousExecutionProjects.isEmpty() )
@@ -1751,5 +1751,10 @@
{
executionProject = null;
}
+ }
+
+ public Plugin getPlugin( String pluginKey )
+ {
+ return (Plugin) getBuild().getPluginsAsMap().get( pluginKey );
}
}
Modified: maven/components/trunk/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/pom.xml?rev=591391&r1=591390&r2=591391&view=diff
==============================================================================
--- maven/components/trunk/pom.xml (original)
+++ maven/components/trunk/pom.xml Fri Nov 2 09:44:00 2007
@@ -153,7 +153,7 @@
<module>maven-embedder</module>
</modules>
<properties>
- <plexusVersion>1.0-alpha-35</plexusVersion>
+ <plexusVersion>1.0-alpha-36</plexusVersion>
<wagonVersion>1.0-beta-2</wagonVersion>
</properties>
<dependencies>