mirror of https://github.com/apache/maven.git
o primarily refactoring in part for the preparation making room for mercury and processing events from maven-shared-model
o add plexus component descriptor generation to the bootstrap so we can start removing the hand-written descriptors and start using annotations everywhere git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@720432 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cca34331f3
commit
c418d12814
12
build.xml
12
build.xml
|
@ -38,7 +38,7 @@ TODO:
|
||||||
<property name="it.workdir.version" value="3.0.x"/>
|
<property name="it.workdir.version" value="3.0.x"/>
|
||||||
|
|
||||||
<target name="initTaskDefs">
|
<target name="initTaskDefs">
|
||||||
<xmlproperty file="pom.xml" prefix="pom.xml" />
|
<xmlproperty file="pom.xml" prefix="pom.xml" />
|
||||||
<path id="maven-ant-tasks.classpath" path="maven-ant-tasks-2.1-SNAPSHOT.jar"/>
|
<path id="maven-ant-tasks.classpath" path="maven-ant-tasks-2.1-SNAPSHOT.jar"/>
|
||||||
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath"/>
|
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath"/>
|
||||||
</target>
|
</target>
|
||||||
|
@ -89,20 +89,20 @@ TODO:
|
||||||
<!-- Pull the dependencies for the MetadataGenerator CLI -->
|
<!-- Pull the dependencies for the MetadataGenerator CLI -->
|
||||||
<artifact:dependencies pathId="pmdg.pathid" filesetId="pmdg.fileset" verbose="${verbose}">
|
<artifact:dependencies pathId="pmdg.pathid" filesetId="pmdg.fileset" verbose="${verbose}">
|
||||||
<localRepository path="${maven.repo.local}"/>
|
<localRepository path="${maven.repo.local}"/>
|
||||||
<dependency groupId="org.codehaus.plexus" artifactId="plexus-component-metadata" version="1.0-beta-2-SNAPSHOT"/>
|
<dependency groupId="org.codehaus.plexus" artifactId="plexus-component-metadata" version="1.0-beta-2"/>
|
||||||
</artifact:dependencies>
|
</artifact:dependencies>
|
||||||
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="generate-resources" depends="pull" description="generates plexus component metadata.">
|
<target name="process-classes" depends="pull" description="generates plexus component metadata.">
|
||||||
<mkdir dir="${basedir}/bootstrap/target"/>
|
<mkdir dir="${basedir}/bootstrap/target"/>
|
||||||
<mkdir dir="${basedir}/bootstrap/target/classes"/>
|
<mkdir dir="${basedir}/bootstrap/target/classes"/>
|
||||||
|
|
||||||
<path id="maven.classpath">
|
<path id="maven.classpath">
|
||||||
<pathelement location="bootstrap/target/classes"/>
|
<pathelement location="bootstrap/target/classes"/>
|
||||||
<path refid="sources"/>
|
<path refid="sources"/>
|
||||||
<path refid="pmdg.pathid"/>
|
|
||||||
<path refid="pom.pathid"/>
|
<path refid="pom.pathid"/>
|
||||||
|
<path refid="pmdg.pathid"/>
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
<java fork="fork" classname="org.codehaus.plexus.metadata.PlexusMetadataGeneratorCli" failonerror="true">
|
<java fork="fork" classname="org.codehaus.plexus.metadata.PlexusMetadataGeneratorCli" failonerror="true">
|
||||||
|
@ -166,7 +166,7 @@ TODO:
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
<mkdir dir="bootstrap/target/classes"/>
|
<mkdir dir="bootstrap/target/classes"/>
|
||||||
<javac destdir="bootstrap/target/classes" debug="${debug}">
|
<javac destdir="bootstrap/target/classes" debug="true">
|
||||||
<src refid="sources"/>
|
<src refid="sources"/>
|
||||||
<classpath refid="pom.pathid"/>
|
<classpath refid="pom.pathid"/>
|
||||||
</javac>
|
</javac>
|
||||||
|
@ -183,7 +183,7 @@ TODO:
|
||||||
</path>
|
</path>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="maven-compile" depends="compile-boot" description="compiles Maven using the bootstrap Maven, skipping automated tests">
|
<target name="maven-compile" depends="compile-boot,process-classes" description="compiles Maven using the bootstrap Maven, skipping automated tests">
|
||||||
<java fork="true" classname="org.apache.maven.cli.MavenCli" failonerror="true">
|
<java fork="true" classname="org.apache.maven.cli.MavenCli" failonerror="true">
|
||||||
<classpath refid="maven.classpath"/>
|
<classpath refid="maven.classpath"/>
|
||||||
<arg value="-e"/>
|
<arg value="-e"/>
|
||||||
|
|
|
@ -45,14 +45,6 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-component-metadata</artifactId>
|
<artifactId>plexus-component-metadata</artifactId>
|
||||||
<version>1.0-beta-2-SNAPSHOT</version>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
|
||||||
<artifactId>plexus-container-default</artifactId>
|
|
||||||
<version>1.0-beta-2-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
|
@ -1,32 +1,22 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
|
||||||
or more contributor license agreements. See the NOTICE file
|
file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
|
||||||
distributed with this work for additional information
|
to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||||
regarding copyright ownership. The ASF licenses this file
|
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||||
to you under the Apache License, Version 2.0 (the
|
applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
"License"); you may not use this file except in compliance
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
|
||||||
with the License. You may obtain a copy of the License at
|
governing permissions and limitations under the License.
|
||||||
|
-->
|
||||||
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.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>maven</artifactId>
|
<artifactId>maven</artifactId>
|
||||||
<groupId>org.apache.maven</groupId>
|
<groupId>org.apache.maven</groupId>
|
||||||
<version>3.0-SNAPSHOT</version>
|
<version>3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>maven-core</artifactId>
|
<artifactId>maven-core</artifactId>
|
||||||
<name>Maven Core</name>
|
<name>Maven Core</name>
|
||||||
|
@ -71,7 +61,6 @@ under the License.
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-interactivity-api</artifactId>
|
<artifactId>plexus-interactivity-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-interpolation</artifactId>
|
<artifactId>plexus-interpolation</artifactId>
|
||||||
|
@ -100,9 +89,25 @@ under the License.
|
||||||
<version>1.0-alpha-1</version>
|
<version>1.0-alpha-1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
|
<artifactId>plexus-component-annotations</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.sonatype.plexus</groupId>
|
||||||
|
<artifactId>plexus-plugin-manager</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.shared</groupId>
|
||||||
|
<artifactId>maven-shared-model</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
|
<artifactId>plexus-component-metadata</artifactId>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.modello</groupId>
|
<groupId>org.codehaus.modello</groupId>
|
||||||
<artifactId>modello-maven-plugin</artifactId>
|
<artifactId>modello-maven-plugin</artifactId>
|
||||||
|
|
|
@ -155,14 +155,9 @@ public class DefaultMaven
|
||||||
|
|
||||||
String event = MavenEvents.MAVEN_EXECUTION;
|
String event = MavenEvents.MAVEN_EXECUTION;
|
||||||
|
|
||||||
dispatcher.dispatchStart(
|
dispatcher.dispatchStart( event, request.getBaseDirectory() );
|
||||||
event,
|
|
||||||
request.getBaseDirectory() );
|
|
||||||
|
|
||||||
MavenSession session = createSession(
|
MavenSession session = createSession( request, reactorManager, dispatcher );
|
||||||
request,
|
|
||||||
reactorManager,
|
|
||||||
dispatcher );
|
|
||||||
|
|
||||||
if ( request.getGoals() != null )
|
if ( request.getGoals() != null )
|
||||||
{
|
{
|
||||||
|
@ -205,10 +200,7 @@ public class DefaultMaven
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
lifecycleExecutor.execute(
|
lifecycleExecutor.execute( session, reactorManager, dispatcher );
|
||||||
session,
|
|
||||||
reactorManager,
|
|
||||||
dispatcher );
|
|
||||||
}
|
}
|
||||||
catch ( LifecycleExecutionException e )
|
catch ( LifecycleExecutionException e )
|
||||||
{
|
{
|
||||||
|
@ -391,11 +383,7 @@ public class DefaultMaven
|
||||||
ReactorManager reactorManager,
|
ReactorManager reactorManager,
|
||||||
EventDispatcher dispatcher )
|
EventDispatcher dispatcher )
|
||||||
{
|
{
|
||||||
MavenSession session = new MavenSession(
|
MavenSession session = new MavenSession( container, request, dispatcher, reactorManager );
|
||||||
container,
|
|
||||||
request,
|
|
||||||
dispatcher,
|
|
||||||
reactorManager );
|
|
||||||
|
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,29 @@
|
||||||
package org.apache.maven.execution;
|
package org.apache.maven.execution;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* agreements. See the NOTICE file distributed with this work for additional information regarding
|
||||||
* distributed with this work for additional information
|
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
* "License"); you may not use this file except in compliance with the License. You may obtain a
|
||||||
* to you under the Apache License, Version 2.0 (the
|
* copy of the License at
|
||||||
* "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
|
||||||
*
|
*
|
||||||
* 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
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* or implied. See the License for the specific language governing permissions and limitations under
|
||||||
* software distributed under the License is distributed on an
|
* the License.
|
||||||
* "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 java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.errors.CoreErrorReporter;
|
import org.apache.maven.errors.CoreErrorReporter;
|
||||||
|
import org.apache.maven.listeners.BuildExtensionListener;
|
||||||
import org.apache.maven.monitor.event.EventMonitor;
|
import org.apache.maven.monitor.event.EventMonitor;
|
||||||
import org.apache.maven.profiles.ProfileManager;
|
import org.apache.maven.profiles.ProfileManager;
|
||||||
import org.apache.maven.profiles.activation.ProfileActivationContext;
|
import org.apache.maven.profiles.activation.ProfileActivationContext;
|
||||||
|
@ -28,13 +31,10 @@ import org.apache.maven.project.DefaultProjectBuilderConfiguration;
|
||||||
import org.apache.maven.project.ProjectBuilderConfiguration;
|
import org.apache.maven.project.ProjectBuilderConfiguration;
|
||||||
import org.apache.maven.realm.MavenRealmManager;
|
import org.apache.maven.realm.MavenRealmManager;
|
||||||
import org.apache.maven.settings.Settings;
|
import org.apache.maven.settings.Settings;
|
||||||
|
import org.apache.maven.shared.model.ModelEventListener;
|
||||||
import org.apache.maven.wagon.events.TransferListener;
|
import org.apache.maven.wagon.events.TransferListener;
|
||||||
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
import java.io.File;
|
import org.codehaus.plexus.component.annotations.Requirement;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jason van Zyl
|
* @author Jason van Zyl
|
||||||
|
@ -44,9 +44,9 @@ public class DefaultMavenExecutionRequest
|
||||||
implements MavenExecutionRequest
|
implements MavenExecutionRequest
|
||||||
{
|
{
|
||||||
private ArtifactRepository localRepository;
|
private ArtifactRepository localRepository;
|
||||||
|
|
||||||
private File localRepositoryPath;
|
private File localRepositoryPath;
|
||||||
|
|
||||||
private boolean offline = false;
|
private boolean offline = false;
|
||||||
|
|
||||||
private boolean interactiveMode = true;
|
private boolean interactiveMode = true;
|
||||||
|
@ -115,58 +115,56 @@ public class DefaultMavenExecutionRequest
|
||||||
|
|
||||||
private ProfileManager profileManager;
|
private ProfileManager profileManager;
|
||||||
|
|
||||||
private List remoteRepositories;
|
private List<ArtifactRepository> remoteRepositories;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suppress SNAPSHOT updates.
|
* Suppress SNAPSHOT updates.
|
||||||
|
*
|
||||||
* @issue MNG-2681
|
* @issue MNG-2681
|
||||||
*/
|
*/
|
||||||
private boolean noSnapshotUpdates;
|
private boolean noSnapshotUpdates;
|
||||||
|
|
||||||
private MavenRealmManager realmManager;
|
private MavenRealmManager realmManager;
|
||||||
|
|
||||||
public DefaultMavenExecutionRequest()
|
public static MavenExecutionRequest copy( MavenExecutionRequest original )
|
||||||
{
|
{
|
||||||
// default constructor.
|
DefaultMavenExecutionRequest copy = new DefaultMavenExecutionRequest();
|
||||||
|
copy.setLocalRepository( original.getLocalRepository() );
|
||||||
|
copy.setLocalRepositoryPath( original.getLocalRepositoryPath() );
|
||||||
|
copy.setOffline( original.isOffline() );
|
||||||
|
copy.setInteractiveMode( original.isInteractiveMode() );
|
||||||
|
copy.setProxies( original.getProxies() );
|
||||||
|
copy.setServers( original.getServers() );
|
||||||
|
copy.setMirrors( original.getMirrors() );
|
||||||
|
copy.setProfiles( original.getProfiles() );
|
||||||
|
copy.setPluginGroups( original.getPluginGroups() );
|
||||||
|
copy.setUsePluginUpdateOverride( original.isUsePluginUpdateOverride() );
|
||||||
|
copy.setProjectPresent( original.isProjectPresent() );
|
||||||
|
copy.setUserSettingsFile( original.getUserSettingsFile() );
|
||||||
|
copy.setGlobalSettingsFile( original.getGlobalSettingsFile() );
|
||||||
|
copy.setBaseDirectory( new File( original.getBaseDirectory() ) );
|
||||||
|
copy.setGoals( original.getGoals() );
|
||||||
|
copy.setUseReactor( original.useReactor() );
|
||||||
|
copy.setRecursive( original.isRecursive() );
|
||||||
|
copy.setPom( original.getPom() );
|
||||||
|
copy.setReactorFailureBehavior( original.getReactorFailureBehavior() );
|
||||||
|
copy.setProperties( original.getProperties() );
|
||||||
|
copy.setStartTime( original.getStartTime() );
|
||||||
|
copy.setShowErrors( original.isShowErrors() );
|
||||||
|
copy.setEventMonitors( original.getEventMonitors());
|
||||||
|
copy.setActiveProfiles( original.getActiveProfiles());
|
||||||
|
copy.setInactiveProfiles( original.getInactiveProfiles());
|
||||||
|
copy.setTransferListener( original.getTransferListener());
|
||||||
|
copy.setLoggingLevel( original.getLoggingLevel());
|
||||||
|
copy.setGlobalChecksumPolicy( original.getGlobalChecksumPolicy());
|
||||||
|
copy.setUpdateSnapshots( original.isUpdateSnapshots());
|
||||||
|
copy.setProfileManager( original.getProfileManager() );
|
||||||
|
copy.setRemoteRepositories( original.getRemoteRepositories() );
|
||||||
|
copy.setNoSnapshotUpdates( original.isNoSnapshotUpdates() );
|
||||||
|
copy.setRealmManager( original.getRealmManager() );
|
||||||
|
return original;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DefaultMavenExecutionRequest( MavenExecutionRequest original )
|
|
||||||
{
|
|
||||||
localRepository = original.getLocalRepository();
|
|
||||||
localRepositoryPath = original.getLocalRepositoryPath();
|
|
||||||
offline = original.isOffline();
|
|
||||||
interactiveMode = original.isInteractiveMode();
|
|
||||||
proxies = original.getProxies();
|
|
||||||
servers = original.getServers();
|
|
||||||
mirrors = original.getMirrors();
|
|
||||||
profiles = original.getProfiles();
|
|
||||||
pluginGroups = original.getPluginGroups();
|
|
||||||
usePluginUpdateOverride = original.isUsePluginUpdateOverride();
|
|
||||||
isProjectPresent = original.isProjectPresent();
|
|
||||||
userSettingsFile = original.getUserSettingsFile();
|
|
||||||
globalSettingsFile = original.getGlobalSettingsFile();
|
|
||||||
basedir = new File( original.getBaseDirectory() );
|
|
||||||
goals = original.getGoals();
|
|
||||||
useReactor = original.useReactor();
|
|
||||||
recursive = original.isRecursive();
|
|
||||||
pom = original.getPom();
|
|
||||||
reactorFailureBehavior = original.getReactorFailureBehavior();
|
|
||||||
properties = original.getProperties();
|
|
||||||
startTime = original.getStartTime();
|
|
||||||
showErrors = original.isShowErrors();
|
|
||||||
eventMonitors = original.getEventMonitors();
|
|
||||||
activeProfiles = original.getActiveProfiles();
|
|
||||||
inactiveProfiles = original.getInactiveProfiles();
|
|
||||||
transferListener = original.getTransferListener();
|
|
||||||
loggingLevel = original.getLoggingLevel();
|
|
||||||
globalChecksumPolicy = original.getGlobalChecksumPolicy();
|
|
||||||
updateSnapshots = original.isUpdateSnapshots();
|
|
||||||
profileManager = original.getProfileManager();
|
|
||||||
remoteRepositories = original.getRemoteRepositories();
|
|
||||||
noSnapshotUpdates = original.isNoSnapshotUpdates();
|
|
||||||
realmManager = original.getRealmManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBaseDirectory()
|
public String getBaseDirectory()
|
||||||
{
|
{
|
||||||
if ( basedir == null )
|
if ( basedir == null )
|
||||||
|
@ -233,6 +231,36 @@ public class DefaultMavenExecutionRequest
|
||||||
return eventMonitors;
|
return eventMonitors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBasedir( File basedir )
|
||||||
|
{
|
||||||
|
this.basedir = basedir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEventMonitors( List eventMonitors )
|
||||||
|
{
|
||||||
|
this.eventMonitors = eventMonitors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActiveProfiles( List activeProfiles )
|
||||||
|
{
|
||||||
|
this.activeProfiles = activeProfiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInactiveProfiles( List inactiveProfiles )
|
||||||
|
{
|
||||||
|
this.inactiveProfiles = inactiveProfiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemoteRepositories( List<ArtifactRepository> remoteRepositories )
|
||||||
|
{
|
||||||
|
this.remoteRepositories = remoteRepositories;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProjectBuildingConfiguration( ProjectBuilderConfiguration projectBuildingConfiguration )
|
||||||
|
{
|
||||||
|
this.projectBuildingConfiguration = projectBuildingConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
public List getActiveProfiles()
|
public List getActiveProfiles()
|
||||||
{
|
{
|
||||||
if ( activeProfiles == null )
|
if ( activeProfiles == null )
|
||||||
|
@ -656,7 +684,7 @@ public class DefaultMavenExecutionRequest
|
||||||
{
|
{
|
||||||
if ( remoteRepositories == null )
|
if ( remoteRepositories == null )
|
||||||
{
|
{
|
||||||
remoteRepositories = new ArrayList();
|
remoteRepositories = new ArrayList<ArtifactRepository>();
|
||||||
}
|
}
|
||||||
|
|
||||||
remoteRepositories.add( repository );
|
remoteRepositories.add( repository );
|
||||||
|
@ -664,7 +692,7 @@ public class DefaultMavenExecutionRequest
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getRemoteRepositories()
|
public List<ArtifactRepository> getRemoteRepositories()
|
||||||
{
|
{
|
||||||
return remoteRepositories;
|
return remoteRepositories;
|
||||||
}
|
}
|
||||||
|
@ -730,6 +758,7 @@ public class DefaultMavenExecutionRequest
|
||||||
projectBuildingConfiguration.setGlobalProfileManager( getProfileManager() );
|
projectBuildingConfiguration.setGlobalProfileManager( getProfileManager() );
|
||||||
projectBuildingConfiguration.setUserProperties( getUserProperties() );
|
projectBuildingConfiguration.setUserProperties( getUserProperties() );
|
||||||
projectBuildingConfiguration.setBuildStartTime( getStartTime() );
|
projectBuildingConfiguration.setBuildStartTime( getStartTime() );
|
||||||
|
projectBuildingConfiguration.setRemoteRepositories( getRemoteRepositories() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return projectBuildingConfiguration;
|
return projectBuildingConfiguration;
|
||||||
|
|
|
@ -19,6 +19,11 @@ package org.apache.maven.execution;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
|
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
|
||||||
import org.apache.maven.errors.CoreErrorReporter;
|
import org.apache.maven.errors.CoreErrorReporter;
|
||||||
|
@ -31,11 +36,6 @@ import org.apache.maven.settings.Settings;
|
||||||
import org.apache.maven.wagon.events.TransferListener;
|
import org.apache.maven.wagon.events.TransferListener;
|
||||||
import org.codehaus.plexus.logging.Logger;
|
import org.codehaus.plexus.logging.Logger;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jason van Zyl
|
* @author Jason van Zyl
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
|
|
@ -151,10 +151,7 @@ public class DefaultLifecycleExecutor
|
||||||
throw new NoGoalsSpecifiedException( buffer.toString() );
|
throw new NoGoalsSpecifiedException( buffer.toString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
List taskSegments = segmentTaskListByAggregationNeeds(
|
List taskSegments = segmentTaskListByAggregationNeeds( goals, session, rootProject );
|
||||||
goals,
|
|
||||||
session,
|
|
||||||
rootProject );
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -162,19 +159,10 @@ public class DefaultLifecycleExecutor
|
||||||
}
|
}
|
||||||
catch ( LifecycleException e )
|
catch ( LifecycleException e )
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
throw new LifecycleExecutionException( "Failed to construct one or more initial build plans." + " Reason: " + e.getMessage(), e );
|
||||||
throw new LifecycleExecutionException(
|
|
||||||
"Failed to construct one or more initial build plans."
|
|
||||||
+ " Reason: " + e.getMessage(),
|
|
||||||
e );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
executeTaskSegments(
|
executeTaskSegments( taskSegments, reactorManager, session, rootProject, dispatcher );
|
||||||
taskSegments,
|
|
||||||
reactorManager,
|
|
||||||
session,
|
|
||||||
rootProject,
|
|
||||||
dispatcher );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -210,7 +198,7 @@ public class DefaultLifecycleExecutor
|
||||||
for ( Iterator projectIterator = sortedProjects.iterator(); projectIterator.hasNext(); )
|
for ( Iterator projectIterator = sortedProjects.iterator(); projectIterator.hasNext(); )
|
||||||
{
|
{
|
||||||
MavenProject currentProject = (MavenProject) projectIterator.next();
|
MavenProject currentProject = (MavenProject) projectIterator.next();
|
||||||
|
|
||||||
executeTaskSegmentForProject( segment, currentProject, reactorManager, dispatcher, session );
|
executeTaskSegmentForProject( segment, currentProject, reactorManager, dispatcher, session );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,11 +243,7 @@ public class DefaultLifecycleExecutor
|
||||||
session.setCurrentProject( project );
|
session.setCurrentProject( project );
|
||||||
|
|
||||||
// NEW: Build up the execution plan, including configuration.
|
// NEW: Build up the execution plan, including configuration.
|
||||||
List mojoBindings = getLifecycleBindings(
|
List mojoBindings = getLifecycleBindings( segment.getTasks(), project, session, target );
|
||||||
segment.getTasks(),
|
|
||||||
project,
|
|
||||||
session,
|
|
||||||
target );
|
|
||||||
|
|
||||||
String currentPhase = null;
|
String currentPhase = null;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,166 @@
|
||||||
|
package org.apache.maven.listeners;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
|
import org.apache.maven.execution.MavenSession;
|
||||||
|
import org.apache.maven.project.builder.ArtifactModelContainerFactory;
|
||||||
|
import org.apache.maven.project.builder.ProjectUri;
|
||||||
|
import org.apache.maven.shared.model.ModelContainer;
|
||||||
|
import org.apache.maven.shared.model.ModelContainerFactory;
|
||||||
|
import org.apache.maven.shared.model.ModelEventListener;
|
||||||
|
import org.apache.maven.shared.model.ModelProperty;
|
||||||
|
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||||
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
import org.codehaus.plexus.component.annotations.Configuration;
|
||||||
|
import org.codehaus.plexus.component.annotations.Requirement;
|
||||||
|
import org.codehaus.plexus.component.repository.ComponentDescriptor;
|
||||||
|
import org.sonatype.plexus.plugin.manager.PlexusPluginManager;
|
||||||
|
import org.sonatype.plexus.plugin.manager.PluginMetadata;
|
||||||
|
import org.sonatype.plexus.plugin.manager.PluginResolutionRequest;
|
||||||
|
import org.sonatype.plexus.plugin.manager.PluginResolutionResult;
|
||||||
|
|
||||||
|
// I need access to the local repository
|
||||||
|
// i need the remote repositories
|
||||||
|
// i need filters to keep stuff out of the realm that exists
|
||||||
|
|
||||||
|
@Component(role = MavenModelEventListener.class, hint="extensions", instantiationStrategy="per-lookup" )
|
||||||
|
public class BuildExtensionListener
|
||||||
|
implements MavenModelEventListener
|
||||||
|
{
|
||||||
|
@Configuration(value = "true")
|
||||||
|
private boolean inBuild = true;
|
||||||
|
|
||||||
|
@Requirement
|
||||||
|
PlexusPluginManager pluginManager;
|
||||||
|
|
||||||
|
private List<BuildExtension> buildExtensions = new ArrayList<BuildExtension>();
|
||||||
|
|
||||||
|
public void fire( List<ModelContainer> modelContainers )
|
||||||
|
{
|
||||||
|
if ( !inBuild )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( ModelContainer mc : modelContainers )
|
||||||
|
{
|
||||||
|
if ( hasExtension( mc ) )
|
||||||
|
{
|
||||||
|
buildExtensions.add( new BuildExtension( mc.getProperties() ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getUris()
|
||||||
|
{
|
||||||
|
return Arrays.asList( ProjectUri.Build.Extensions.Extension.xUri );
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<ModelContainerFactory> getModelContainerFactories()
|
||||||
|
{
|
||||||
|
return Arrays.asList( (ModelContainerFactory) new ArtifactModelContainerFactory() );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean hasExtension( ModelContainer container )
|
||||||
|
{
|
||||||
|
for ( ModelProperty mp : container.getProperties() )
|
||||||
|
{
|
||||||
|
if ( mp.getUri().equals( ProjectUri.Build.Extensions.Extension.xUri ) )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class BuildExtension
|
||||||
|
{
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
private String artifactId;
|
||||||
|
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
public BuildExtension( String groupId, String artifactId, String version )
|
||||||
|
{
|
||||||
|
this.groupId = groupId;
|
||||||
|
this.artifactId = artifactId;
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
BuildExtension( List<ModelProperty> modelProperties )
|
||||||
|
{
|
||||||
|
for ( ModelProperty mp : modelProperties )
|
||||||
|
{
|
||||||
|
if ( mp.getUri().equals( ProjectUri.Build.Extensions.Extension.groupId ) )
|
||||||
|
{
|
||||||
|
groupId = mp.getValue();
|
||||||
|
}
|
||||||
|
else if ( mp.getUri().equals( ProjectUri.Build.Extensions.Extension.artifactId ) )
|
||||||
|
{
|
||||||
|
artifactId = mp.getValue();
|
||||||
|
}
|
||||||
|
else if ( mp.getUri().equals( ProjectUri.Build.Extensions.Extension.version ) )
|
||||||
|
{
|
||||||
|
version = mp.getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Processing the information that was collected.
|
||||||
|
|
||||||
|
public void processModelContainers( MavenSession session )
|
||||||
|
{
|
||||||
|
for ( BuildExtension be : buildExtensions )
|
||||||
|
{
|
||||||
|
PluginResolutionRequest request = new PluginResolutionRequest()
|
||||||
|
.setPluginMetadata( new PluginMetadata( be.groupId, be.artifactId, be.version ) )
|
||||||
|
.addLocalRepository( session.getRequest().getLocalRepositoryPath() )
|
||||||
|
.setRemoteRepositories( convertToMercuryRepositories( session.getRequest().getRemoteRepositories() ) );
|
||||||
|
|
||||||
|
PluginResolutionResult result = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
result = pluginManager.resolve( request );
|
||||||
|
}
|
||||||
|
catch ( Exception e )
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
ClassRealm realm = pluginManager.createClassRealm( result.getArtifacts() );
|
||||||
|
|
||||||
|
realm.display();
|
||||||
|
|
||||||
|
List<ComponentDescriptor<?>> components = pluginManager.discoverComponents( realm );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> convertToMercuryRepositories( List<ArtifactRepository> repositories )
|
||||||
|
{
|
||||||
|
List<String> repos = new ArrayList<String>();
|
||||||
|
|
||||||
|
if ( repositories != null )
|
||||||
|
{
|
||||||
|
for ( ArtifactRepository r : repositories )
|
||||||
|
{
|
||||||
|
repos.add( r.getUrl() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// I'm doing this because I am about to rip the artifact clusterfuck out and
|
||||||
|
// replace it with mercury and I don't want to pull in 5 component to make a
|
||||||
|
// remote repository. This will do until alpha-2.
|
||||||
|
repos.add( "http://repo1.maven.org/maven2" );
|
||||||
|
}
|
||||||
|
|
||||||
|
return repos;
|
||||||
|
}
|
||||||
|
}
|
|
@ -315,7 +315,7 @@ public class DefaultPluginManager
|
||||||
{
|
{
|
||||||
getLogger().debug( "Discovering components in realm: " + pluginRealm );
|
getLogger().debug( "Discovering components in realm: " + pluginRealm );
|
||||||
|
|
||||||
container.discoverComponents( pluginRealm, false );
|
container.discoverComponents( pluginRealm );
|
||||||
}
|
}
|
||||||
catch ( PlexusConfigurationException e )
|
catch ( PlexusConfigurationException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,6 +43,8 @@ import org.apache.maven.project.ProjectBuildingException;
|
||||||
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
|
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
|
||||||
import org.apache.maven.realm.RealmManagementException;
|
import org.apache.maven.realm.RealmManagementException;
|
||||||
import org.apache.maven.realm.RealmScanningUtils;
|
import org.apache.maven.realm.RealmScanningUtils;
|
||||||
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
import org.codehaus.plexus.component.annotations.Requirement;
|
||||||
import org.codehaus.plexus.context.Context;
|
import org.codehaus.plexus.context.Context;
|
||||||
import org.codehaus.plexus.context.ContextException;
|
import org.codehaus.plexus.context.ContextException;
|
||||||
import org.codehaus.plexus.logging.LogEnabled;
|
import org.codehaus.plexus.logging.LogEnabled;
|
||||||
|
@ -52,20 +54,26 @@ import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component(role = PluginManagerSupport.class)
|
||||||
public class DefaultPluginManagerSupport
|
public class DefaultPluginManagerSupport
|
||||||
implements PluginManagerSupport, LogEnabled, Contextualizable
|
implements PluginManagerSupport, LogEnabled, Contextualizable
|
||||||
{
|
{
|
||||||
|
@Requirement
|
||||||
private ArtifactResolver artifactResolver;
|
private ArtifactResolver artifactResolver;
|
||||||
|
|
||||||
|
@Requirement
|
||||||
private ArtifactFactory artifactFactory;
|
private ArtifactFactory artifactFactory;
|
||||||
|
|
||||||
|
@Requirement
|
||||||
private MavenProjectBuilder mavenProjectBuilder;
|
private MavenProjectBuilder mavenProjectBuilder;
|
||||||
|
|
||||||
|
@Requirement
|
||||||
private RuntimeInformation runtimeInformation;
|
private RuntimeInformation runtimeInformation;
|
||||||
|
|
||||||
|
@Requirement
|
||||||
private PluginVersionManager pluginVersionManager;
|
private PluginVersionManager pluginVersionManager;
|
||||||
|
|
||||||
|
//@Requirement
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
|
||||||
private Context containerContext;
|
private Context containerContext;
|
||||||
|
@ -90,8 +98,6 @@ public class DefaultPluginManagerSupport
|
||||||
|
|
||||||
List remoteRepositories = new ArrayList();
|
List remoteRepositories = new ArrayList();
|
||||||
|
|
||||||
// remoteRepositories.addAll( project.getPluginArtifactRepositories() );
|
|
||||||
|
|
||||||
remoteRepositories.addAll( project.getRemoteArtifactRepositories() );
|
remoteRepositories.addAll( project.getRemoteArtifactRepositories() );
|
||||||
|
|
||||||
MavenProject pluginProject = null;
|
MavenProject pluginProject = null;
|
||||||
|
|
|
@ -22,7 +22,7 @@ under the License.
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
| These are the artifacts handlers that were previously in maven-artifact and they don't belong there as these
|
| These are the artifacts handlers that were previously in maven-artifact and they don't belong there as these
|
||||||
| are Maven specific artifact handlers. We need to put these into their respective plugins and make this fully dynamic. jvz.
|
| are Maven specific artifact handlers. We need to put these into their respective plugins and make this fully dynamic. jvz.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<component>
|
<component>
|
||||||
|
|
|
@ -472,17 +472,11 @@ public class PluginParameterExpressionEvaluatorTest
|
||||||
model.setVersion( "1" );
|
model.setVersion( "1" );
|
||||||
|
|
||||||
MavenProject project = new MavenProject( model );
|
MavenProject project = new MavenProject( model );
|
||||||
|
ReactorManager rm = new ReactorManager( Collections.singletonList( project ), ReactorManager.FAIL_FAST );
|
||||||
ReactorManager rm = new ReactorManager( Collections.singletonList( project ),
|
MockControl mockMavenExecutionRequest = MockControl.createControl( MavenExecutionRequest.class );
|
||||||
ReactorManager.FAIL_FAST );
|
MavenExecutionRequest req = (MavenExecutionRequest) mockMavenExecutionRequest.getMock();
|
||||||
|
MavenSession session = new MavenSession( getContainer(), req, new DefaultEventDispatcher(), rm );
|
||||||
MockControl reqCtl = MockControl.createControl( MavenExecutionRequest.class );
|
|
||||||
MavenExecutionRequest req = (MavenExecutionRequest) reqCtl.getMock();
|
|
||||||
|
|
||||||
MavenSession session = new MavenSession( getContainer(), req, new DefaultEventDispatcher(),
|
|
||||||
rm );
|
|
||||||
|
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class MavenCli
|
||||||
{
|
{
|
||||||
CLIReportingUtils.showVersion();
|
CLIReportingUtils.showVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
MavenExecutionRequest request = CLIRequestUtils.buildRequest( commandLine, debug, quiet, showErrors );
|
MavenExecutionRequest request = CLIRequestUtils.buildRequest( commandLine, debug, quiet, showErrors );
|
||||||
|
|
||||||
Configuration configuration = buildEmbedderConfiguration( request, commandLine, classWorld );
|
Configuration configuration = buildEmbedderConfiguration( request, commandLine, classWorld );
|
||||||
|
|
|
@ -103,7 +103,7 @@ import org.codehaus.plexus.util.dag.CycleDetectedException;
|
||||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class intended to be used by clients who wish to embed Maven into their applications
|
* Class intended to be used by clients who wish to embed Maven into their applications.
|
||||||
*
|
*
|
||||||
* @author Jason van Zyl
|
* @author Jason van Zyl
|
||||||
*/
|
*/
|
||||||
|
@ -152,7 +152,7 @@ public class MavenEmbedder
|
||||||
private MavenExecutionRequestPopulator populator;
|
private MavenExecutionRequestPopulator populator;
|
||||||
|
|
||||||
private BuildPlanner buildPlanner;
|
private BuildPlanner buildPlanner;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Configuration
|
// Configuration
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
@ -506,7 +506,7 @@ public class MavenEmbedder
|
||||||
boolean allowUnbindableMojos )
|
boolean allowUnbindableMojos )
|
||||||
throws MavenEmbedderException
|
throws MavenEmbedderException
|
||||||
{
|
{
|
||||||
MavenExecutionRequest req = new DefaultMavenExecutionRequest( request );
|
MavenExecutionRequest req = DefaultMavenExecutionRequest.copy( request );
|
||||||
req.setGoals( goals );
|
req.setGoals( goals );
|
||||||
|
|
||||||
EventDispatcher dispatcher = new DefaultEventDispatcher( req.getEventMonitors() );
|
EventDispatcher dispatcher = new DefaultEventDispatcher( req.getEventMonitors() );
|
||||||
|
@ -709,7 +709,7 @@ public class MavenEmbedder
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
container.discoverComponents( childRealm, true );
|
container.discoverComponents( childRealm );
|
||||||
}
|
}
|
||||||
catch ( PlexusConfigurationException e )
|
catch ( PlexusConfigurationException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class DefaultMavenExecutionRequestPopulator
|
||||||
profileManager( request, configuration );
|
profileManager( request, configuration );
|
||||||
|
|
||||||
processSettings( request, configuration );
|
processSettings( request, configuration );
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,28 +21,30 @@ package org.apache.maven.project;
|
||||||
|
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.profiles.ProfileManager;
|
import org.apache.maven.profiles.ProfileManager;
|
||||||
|
import org.apache.maven.shared.model.ModelEventListener;
|
||||||
|
import org.codehaus.plexus.PlexusContainer;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
public class DefaultProjectBuilderConfiguration
|
public class DefaultProjectBuilderConfiguration
|
||||||
implements ProjectBuilderConfiguration
|
implements ProjectBuilderConfiguration
|
||||||
{
|
{
|
||||||
|
|
||||||
private ProfileManager globalProfileManager;
|
private ProfileManager globalProfileManager;
|
||||||
|
|
||||||
private ArtifactRepository localRepository;
|
private ArtifactRepository localRepository;
|
||||||
|
|
||||||
|
private List<ArtifactRepository> remoteRepositories;
|
||||||
|
|
||||||
private Properties userProperties;
|
private Properties userProperties;
|
||||||
|
|
||||||
private Properties executionProperties = System.getProperties();
|
private Properties executionProperties = System.getProperties();
|
||||||
|
|
||||||
private Date buildStartTime;
|
private Date buildStartTime;
|
||||||
|
|
||||||
public DefaultProjectBuilderConfiguration()
|
private List<ModelEventListener> listeners;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProjectBuilderConfiguration setGlobalProfileManager( ProfileManager globalProfileManager )
|
public ProjectBuilderConfiguration setGlobalProfileManager( ProfileManager globalProfileManager )
|
||||||
{
|
{
|
||||||
this.globalProfileManager = globalProfileManager;
|
this.globalProfileManager = globalProfileManager;
|
||||||
|
@ -64,6 +66,17 @@ public class DefaultProjectBuilderConfiguration
|
||||||
{
|
{
|
||||||
return localRepository;
|
return localRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ArtifactRepository> getRemoteRepositories()
|
||||||
|
{
|
||||||
|
return remoteRepositories;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectBuilderConfiguration setRemoteRepositories( List<ArtifactRepository> remoteRepositories )
|
||||||
|
{
|
||||||
|
this.remoteRepositories = remoteRepositories;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public ProjectBuilderConfiguration setUserProperties( Properties userProperties )
|
public ProjectBuilderConfiguration setUserProperties( Properties userProperties )
|
||||||
{
|
{
|
||||||
|
@ -103,4 +116,14 @@ public class DefaultProjectBuilderConfiguration
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ModelEventListener> getModelEventListeners()
|
||||||
|
{
|
||||||
|
return listeners;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectBuilderConfiguration setModelEventListeners( List<ModelEventListener> listeners )
|
||||||
|
{
|
||||||
|
this.listeners = listeners;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,18 @@ package org.apache.maven.project;
|
||||||
|
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.profiles.ProfileManager;
|
import org.apache.maven.profiles.ProfileManager;
|
||||||
|
import org.apache.maven.shared.model.ModelEventListener;
|
||||||
|
import org.codehaus.plexus.PlexusContainer;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
public interface ProjectBuilderConfiguration
|
public interface ProjectBuilderConfiguration
|
||||||
{
|
{
|
||||||
|
|
||||||
ArtifactRepository getLocalRepository();
|
ArtifactRepository getLocalRepository();
|
||||||
|
|
||||||
|
List<ArtifactRepository> getRemoteRepositories();
|
||||||
|
|
||||||
ProfileManager getGlobalProfileManager();
|
ProfileManager getGlobalProfileManager();
|
||||||
|
|
||||||
|
@ -21,12 +25,13 @@ public interface ProjectBuilderConfiguration
|
||||||
|
|
||||||
ProjectBuilderConfiguration setLocalRepository( ArtifactRepository localRepository );
|
ProjectBuilderConfiguration setLocalRepository( ArtifactRepository localRepository );
|
||||||
|
|
||||||
|
ProjectBuilderConfiguration setRemoteRepositories( List<ArtifactRepository> remoteRepositories );
|
||||||
|
|
||||||
ProjectBuilderConfiguration setUserProperties( Properties userProperties );
|
ProjectBuilderConfiguration setUserProperties( Properties userProperties );
|
||||||
|
|
||||||
ProjectBuilderConfiguration setExecutionProperties( Properties executionProperties );
|
ProjectBuilderConfiguration setExecutionProperties( Properties executionProperties );
|
||||||
|
|
||||||
Date getBuildStartTime();
|
Date getBuildStartTime();
|
||||||
|
|
||||||
ProjectBuilderConfiguration setBuildStartTime( Date buildStartTime );
|
ProjectBuilderConfiguration setBuildStartTime( Date buildStartTime );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,21 +19,6 @@ package org.apache.maven.project.builder.impl;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.MavenTools;
|
|
||||||
import org.apache.maven.artifact.Artifact;
|
|
||||||
import org.apache.maven.artifact.InvalidRepositoryException;
|
|
||||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
|
||||||
import org.apache.maven.model.Model;
|
|
||||||
import org.apache.maven.model.Parent;
|
|
||||||
import org.apache.maven.project.MavenProject;
|
|
||||||
import org.apache.maven.project.ProjectBuilderConfiguration;
|
|
||||||
import org.apache.maven.project.builder.*;
|
|
||||||
import org.apache.maven.project.validation.ModelValidationResult;
|
|
||||||
import org.apache.maven.project.validation.ModelValidator;
|
|
||||||
import org.apache.maven.shared.model.*;
|
|
||||||
import org.codehaus.plexus.logging.LogEnabled;
|
|
||||||
import org.codehaus.plexus.logging.Logger;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -43,6 +28,31 @@ import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.maven.MavenTools;
|
||||||
|
import org.apache.maven.artifact.Artifact;
|
||||||
|
import org.apache.maven.artifact.InvalidRepositoryException;
|
||||||
|
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||||
|
import org.apache.maven.model.Model;
|
||||||
|
import org.apache.maven.model.Parent;
|
||||||
|
import org.apache.maven.project.MavenProject;
|
||||||
|
import org.apache.maven.project.ProjectBuilderConfiguration;
|
||||||
|
import org.apache.maven.project.builder.ArtifactModelContainerFactory;
|
||||||
|
import org.apache.maven.project.builder.IdModelContainerFactory;
|
||||||
|
import org.apache.maven.project.builder.PomArtifactResolver;
|
||||||
|
import org.apache.maven.project.builder.PomClassicDomainModel;
|
||||||
|
import org.apache.maven.project.builder.PomClassicDomainModelFactory;
|
||||||
|
import org.apache.maven.project.builder.PomClassicTransformer;
|
||||||
|
import org.apache.maven.project.builder.ProjectBuilder;
|
||||||
|
import org.apache.maven.project.validation.ModelValidationResult;
|
||||||
|
import org.apache.maven.project.validation.ModelValidator;
|
||||||
|
import org.apache.maven.shared.model.DomainModel;
|
||||||
|
import org.apache.maven.shared.model.ImportModel;
|
||||||
|
import org.apache.maven.shared.model.InterpolatorProperty;
|
||||||
|
import org.apache.maven.shared.model.ModelEventListener;
|
||||||
|
import org.apache.maven.shared.model.ModelTransformerContext;
|
||||||
|
import org.codehaus.plexus.logging.LogEnabled;
|
||||||
|
import org.codehaus.plexus.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default implementation of the project builder.
|
* Default implementation of the project builder.
|
||||||
*/
|
*/
|
||||||
|
@ -60,7 +70,9 @@ public final class DefaultProjectBuilder
|
||||||
private ModelValidator validator;
|
private ModelValidator validator;
|
||||||
|
|
||||||
private MavenTools mavenTools;
|
private MavenTools mavenTools;
|
||||||
|
|
||||||
|
List<ModelEventListener> listeners;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor
|
* Default constructor
|
||||||
*/
|
*/
|
||||||
|
@ -160,17 +172,18 @@ public final class DefaultProjectBuilder
|
||||||
{
|
{
|
||||||
domainModels.add( new PomClassicDomainModel( model ) );
|
domainModels.add( new PomClassicDomainModel( model ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
PomClassicTransformer transformer = new PomClassicTransformer( new PomClassicDomainModelFactory() );
|
PomClassicTransformer transformer = new PomClassicTransformer( new PomClassicDomainModelFactory() );
|
||||||
|
|
||||||
ModelTransformerContext ctx = new ModelTransformerContext(
|
ModelTransformerContext ctx = new ModelTransformerContext(
|
||||||
Arrays.asList( new ArtifactModelContainerFactory(), new IdModelContainerFactory() ) );
|
Arrays.asList( new ArtifactModelContainerFactory(), new IdModelContainerFactory() ) );
|
||||||
|
|
||||||
PomClassicDomainModel transformedDomainModel = ( (PomClassicDomainModel) ctx.transform( domainModels,
|
PomClassicDomainModel transformedDomainModel = ( (PomClassicDomainModel) ctx.transform( domainModels,
|
||||||
transformer,
|
transformer,
|
||||||
transformer,
|
transformer,
|
||||||
importModels,
|
importModels,
|
||||||
properties,
|
properties,
|
||||||
null) );
|
listeners ) );
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MavenProject mavenProject = new MavenProject( transformedDomainModel.getModel(), artifactFactory,
|
MavenProject mavenProject = new MavenProject( transformedDomainModel.getModel(), artifactFactory,
|
||||||
|
|
|
@ -267,6 +267,6 @@ under the License.
|
||||||
<role>org.apache.maven.artifact.repository.ArtifactRepositoryFactory</role>
|
<role>org.apache.maven.artifact.repository.ArtifactRepositoryFactory</role>
|
||||||
</requirement>
|
</requirement>
|
||||||
</requirements>
|
</requirements>
|
||||||
</component>
|
</component>
|
||||||
</components>
|
</components>
|
||||||
</component-set>
|
</component-set>
|
||||||
|
|
53
pom.xml
53
pom.xml
|
@ -24,7 +24,7 @@ under the License.
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.maven</groupId>
|
<groupId>org.apache.maven</groupId>
|
||||||
<artifactId>maven-parent</artifactId>
|
<artifactId>maven-parent</artifactId>
|
||||||
<version>10-SNAPSHOT</version>
|
<version>9</version>
|
||||||
<relativePath>../pom/maven/pom.xml</relativePath>
|
<relativePath>../pom/maven/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>org.apache.maven</groupId>
|
<groupId>org.apache.maven</groupId>
|
||||||
|
@ -156,7 +156,7 @@ under the License.
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-component-metadata</artifactId>
|
<artifactId>plexus-component-metadata</artifactId>
|
||||||
<version>1.0-beta-2-SNAPSHOT</version>
|
<version>${plexusVersion}</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
|
@ -245,7 +245,7 @@ under the License.
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.3</version>
|
<version>2.4.2</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
@ -254,15 +254,6 @@ under the License.
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<version>2.4.2</version>
|
|
||||||
<configuration>
|
|
||||||
<forkMode>once</forkMode>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
</build>
|
||||||
<modules>
|
<modules>
|
||||||
<module>maven-core</module>
|
<module>maven-core</module>
|
||||||
|
@ -276,7 +267,7 @@ under the License.
|
||||||
<module>maven-mercury</module>
|
<module>maven-mercury</module>
|
||||||
<module>maven-embedder</module>
|
<module>maven-embedder</module>
|
||||||
<module>maven-toolchain</module>
|
<module>maven-toolchain</module>
|
||||||
<module>maven-compat</module>
|
<module>maven-compat</module>
|
||||||
</modules>
|
</modules>
|
||||||
<properties>
|
<properties>
|
||||||
<artifactVersion>3.0-alpha-2-SNAPSHOT</artifactVersion>
|
<artifactVersion>3.0-alpha-2-SNAPSHOT</artifactVersion>
|
||||||
|
@ -286,7 +277,7 @@ under the License.
|
||||||
<doxiaVersion>1.0-alpha-9</doxiaVersion>
|
<doxiaVersion>1.0-alpha-9</doxiaVersion>
|
||||||
<easyMockVersion>1.2_Java1.3</easyMockVersion>
|
<easyMockVersion>1.2_Java1.3</easyMockVersion>
|
||||||
<junitVersion>3.8.1</junitVersion>
|
<junitVersion>3.8.1</junitVersion>
|
||||||
<plexusVersion>1.0-beta-2-SNAPSHOT</plexusVersion>
|
<plexusVersion>1.0-beta-2</plexusVersion>
|
||||||
<plexusInteractivityVersion>1.0-alpha-6</plexusInteractivityVersion>
|
<plexusInteractivityVersion>1.0-alpha-6</plexusInteractivityVersion>
|
||||||
<plexusInterpolationVersion>1.1</plexusInterpolationVersion>
|
<plexusInterpolationVersion>1.1</plexusInterpolationVersion>
|
||||||
<plexusUtilsVersion>1.5.5</plexusUtilsVersion>
|
<plexusUtilsVersion>1.5.5</plexusUtilsVersion>
|
||||||
|
@ -295,7 +286,6 @@ under the License.
|
||||||
<mercuryVersion>1.0.0-alpha-2-SNAPSHOT</mercuryVersion>
|
<mercuryVersion>1.0.0-alpha-2-SNAPSHOT</mercuryVersion>
|
||||||
<woodstoxVersion>3.2.6</woodstoxVersion>
|
<woodstoxVersion>3.2.6</woodstoxVersion>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<!--start-->
|
<!--start-->
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -367,6 +357,11 @@ under the License.
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--end-->
|
<!--end-->
|
||||||
<!-- Plexus -->
|
<!-- Plexus -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.artifact</groupId>
|
||||||
|
<artifactId>maven-artifact</artifactId>
|
||||||
|
<version>${artifactVersion}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-utils</artifactId>
|
<artifactId>plexus-utils</artifactId>
|
||||||
|
@ -429,11 +424,6 @@ under the License.
|
||||||
<artifactId>wagon-ssh-external</artifactId>
|
<artifactId>wagon-ssh-external</artifactId>
|
||||||
<version>${wagonVersion}</version>
|
<version>${wagonVersion}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.maven.artifact</groupId>
|
|
||||||
<artifactId>maven-artifact</artifactId>
|
|
||||||
<version>${artifactVersion}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven.doxia</groupId>
|
<groupId>org.apache.maven.doxia</groupId>
|
||||||
<artifactId>doxia-sink-api</artifactId>
|
<artifactId>doxia-sink-api</artifactId>
|
||||||
|
@ -469,23 +459,28 @@ under the License.
|
||||||
<groupId>commons-logging</groupId>
|
<groupId>commons-logging</groupId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.mercury</groupId>
|
||||||
|
<artifactId>mercury-artifact</artifactId>
|
||||||
|
<version>${mercuryVersion}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven.mercury</groupId>
|
<groupId>org.apache.maven.mercury</groupId>
|
||||||
<artifactId>mercury-artifact</artifactId>
|
<artifactId>mercury-external</artifactId>
|
||||||
<version>${mercuryVersion}</version>
|
<version>${mercuryVersion}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.maven.mercury</groupId>
|
|
||||||
<artifactId>mercury-external</artifactId>
|
|
||||||
<version>${mercuryVersion}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- Needed for backward compat aspect. -->
|
<!-- Needed for backward compat aspect. -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>aspectj</groupId>
|
<groupId>aspectj</groupId>
|
||||||
<artifactId>aspectjrt</artifactId>
|
<artifactId>aspectjrt</artifactId>
|
||||||
<version>${aspectjVersion}</version>
|
<version>${aspectjVersion}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.sonatype.plexus</groupId>
|
||||||
|
<artifactId>plexus-plugin-manager</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<!--start-->
|
<!--start-->
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
Loading…
Reference in New Issue