reintroduced LineLength Checkstyle rule and fixed code...

This commit is contained in:
Hervé Boutemy 2015-03-04 03:17:46 +01:00
parent be3fb20032
commit eecdc9a171
42 changed files with 144 additions and 93 deletions

View File

@ -31,7 +31,7 @@
</scm> </scm>
<properties> <properties>
<checkstyle.violation.ignore>RedundantThrows,NewlineAtEndOfFile,ParameterNumber,MethodLength,FileLength,JavadocType,LineLength,MethodName,MagicNumber,ConstantName,VisibilityModifier,InnerAssignment</checkstyle.violation.ignore> <checkstyle.violation.ignore>RedundantThrows,NewlineAtEndOfFile,ParameterNumber,MethodLength,FileLength,JavadocType,MethodName,MagicNumber,ConstantName,VisibilityModifier,InnerAssignment</checkstyle.violation.ignore>
</properties> </properties>
<dependencies> <dependencies>

View File

@ -49,7 +49,8 @@ public class DefaultArtifactFilterManager
private final Set<String> coreArtifacts; private final Set<String> coreArtifacts;
@Inject @Inject
public DefaultArtifactFilterManager( List<ArtifactFilterManagerDelegate> delegates, CoreExportsProvider coreExports ) public DefaultArtifactFilterManager( List<ArtifactFilterManagerDelegate> delegates,
CoreExportsProvider coreExports )
{ {
this.delegates = delegates; this.delegates = delegates;
this.coreArtifacts = coreExports.get().getExportedArtifacts(); this.coreArtifacts = coreExports.get().getExportedArtifacts();

View File

@ -118,10 +118,8 @@ public class DefaultMaven
} }
else else
{ {
result = addExceptionToResult( new DefaultMavenExecutionResult(), new InternalErrorException( result = addExceptionToResult( new DefaultMavenExecutionResult(),
"Internal error: " new InternalErrorException( "Internal error: " + e, e ) );
+ e,
e ) );
} }
} }
finally finally
@ -371,7 +369,8 @@ public class DefaultMaven
private Collection<AbstractMavenLifecycleParticipant> getLifecycleParticipants( Collection<MavenProject> projects ) private Collection<AbstractMavenLifecycleParticipant> getLifecycleParticipants( Collection<MavenProject> projects )
{ {
Collection<AbstractMavenLifecycleParticipant> lifecycleListeners = new LinkedHashSet<AbstractMavenLifecycleParticipant>(); Collection<AbstractMavenLifecycleParticipant> lifecycleListeners =
new LinkedHashSet<AbstractMavenLifecycleParticipant>();
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
try try

View File

@ -127,7 +127,8 @@ public class DefaultProjectDependenciesResolver
if ( ! exclusions.isEmpty() ) if ( ! exclusions.isEmpty() )
{ {
filter = new AndArtifactFilter( Arrays.asList( new ArtifactFilter[]{ new ExcludesArtifactFilter( exclusions ), scopeFilter } ) ); filter = new AndArtifactFilter( Arrays.asList( new ArtifactFilter[]{
new ExcludesArtifactFilter( exclusions ), scopeFilter } ) );
} }
else else
{ {

View File

@ -30,7 +30,8 @@ import org.apache.maven.project.MavenProject;
@Deprecated @Deprecated
/** /**
* @deprecated As of 3.2.2, and there is no direct replacement. This is an internal class which was not marked as such, but should have been. * @deprecated As of 3.2.2, and there is no direct replacement. This is an internal class which was not marked as such,
* but should have been.
* @author jvanzyl * @author jvanzyl
* *
*/ */
@ -84,10 +85,11 @@ public interface ProjectDependenciesResolver
* @param projects The projects whose dependencies should be resolved, may be {@code null}. * @param projects The projects whose dependencies should be resolved, may be {@code null}.
* @param scopes The dependency scopes that should be resolved, may be {@code null}. * @param scopes The dependency scopes that should be resolved, may be {@code null}.
* @param session The current build session, must not be {@code null}. * @param session The current build session, must not be {@code null}.
* @return The transitive dependencies of the specified projects that match the requested scopes, never {@code null} * @return The transitive dependencies of the specified projects that match the requested scopes, never
* . * {@code null}.
*/ */
Set<Artifact> resolve( Collection<? extends MavenProject> projects, Collection<String> scopes, MavenSession session ) Set<Artifact> resolve( Collection<? extends MavenProject> projects, Collection<String> scopes,
MavenSession session )
throws ArtifactResolutionException, ArtifactNotFoundException; throws ArtifactResolutionException, ArtifactNotFoundException;
} }

View File

@ -28,7 +28,8 @@ import java.lang.annotation.Target;
import com.google.inject.ScopeAnnotation; import com.google.inject.ScopeAnnotation;
/** /**
* Indicates that annotated component should be instantiated before session starts and discarded after session execution completes. * Indicates that annotated component should be instantiated before session starts and discarded after session execution
* completes.
* *
* @author Jason van Zyl * @author Jason van Zyl
* @since 3.2.0 * @since 3.2.0

View File

@ -327,7 +327,8 @@ public class MavenRepositorySystem
// Taken from LegacyRepositorySystem // Taken from LegacyRepositorySystem
// //
public static org.apache.maven.model.Repository fromSettingsRepository( org.apache.maven.settings.Repository settingsRepository ) public static org.apache.maven.model.Repository fromSettingsRepository( org.apache.maven.settings.Repository
settingsRepository )
{ {
org.apache.maven.model.Repository modelRepository = new org.apache.maven.model.Repository(); org.apache.maven.model.Repository modelRepository = new org.apache.maven.model.Repository();
modelRepository.setId( settingsRepository.getId() ); modelRepository.setId( settingsRepository.getId() );
@ -339,7 +340,8 @@ public class MavenRepositorySystem
return modelRepository; return modelRepository;
} }
public static org.apache.maven.model.RepositoryPolicy fromSettingsRepositoryPolicy( org.apache.maven.settings.RepositoryPolicy settingsRepositoryPolicy ) public static org.apache.maven.model.RepositoryPolicy fromSettingsRepositoryPolicy(
org.apache.maven.settings.RepositoryPolicy settingsRepositoryPolicy )
{ {
org.apache.maven.model.RepositoryPolicy modelRepositoryPolicy = new org.apache.maven.model.RepositoryPolicy(); org.apache.maven.model.RepositoryPolicy modelRepositoryPolicy = new org.apache.maven.model.RepositoryPolicy();
if ( settingsRepositoryPolicy != null ) if ( settingsRepositoryPolicy != null )
@ -390,7 +392,8 @@ public class MavenRepositorySystem
} }
} }
public static ArtifactRepositoryPolicy buildArtifactRepositoryPolicy( org.apache.maven.model.RepositoryPolicy policy ) public static ArtifactRepositoryPolicy buildArtifactRepositoryPolicy( org.apache.maven.model.RepositoryPolicy
policy )
{ {
boolean enabled = true; boolean enabled = true;
@ -711,7 +714,8 @@ public class MavenRepositorySystem
try try
{ {
URL url = new URL( originalRepository.getUrl() ); URL url = new URL( originalRepository.getUrl() );
return !( url.getHost().equals( "localhost" ) || url.getHost().equals( "127.0.0.1" ) || url.getProtocol().equals( "file" ) ); return !( url.getHost().equals( "localhost" ) || url.getHost().equals( "127.0.0.1" )
|| url.getProtocol().equals( "file" ) );
} }
catch ( MalformedURLException e ) catch ( MalformedURLException e )
{ {

View File

@ -258,7 +258,8 @@ public class DefaultClassRealmManager
parent = PARENT_CLASSLOADER; parent = PARENT_CLASSLOADER;
} }
return createRealm( getKey( plugin, false ), RealmType.Plugin, parent, parentImports, foreignImports, artifacts ); return createRealm( getKey( plugin, false ), RealmType.Plugin, parent, parentImports, foreignImports,
artifacts );
} }
private static String getKey( Plugin plugin, boolean extension ) private static String getKey( Plugin plugin, boolean extension )

View File

@ -80,7 +80,8 @@ Plugins:
*/ */
//PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, CycleDetectedInPluginGraphException; // PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
// CycleDetectedInPluginGraphException;
@Component( role = ExceptionHandler.class ) @Component( role = ExceptionHandler.class )
public class DefaultExceptionHandler public class DefaultExceptionHandler

View File

@ -186,7 +186,8 @@ public class DefaultMavenExecutionRequest
copy.setGlobalSettingsFile( original.getGlobalSettingsFile() ); copy.setGlobalSettingsFile( original.getGlobalSettingsFile() );
copy.setUserToolchainsFile( original.getUserToolchainsFile() ); copy.setUserToolchainsFile( original.getUserToolchainsFile() );
copy.setGlobalToolchainsFile( original.getGlobalToolchainsFile() ); copy.setGlobalToolchainsFile( original.getGlobalToolchainsFile() );
copy.setBaseDirectory( ( original.getBaseDirectory() != null ) ? new File( original.getBaseDirectory() ) : null ); copy.setBaseDirectory( ( original.getBaseDirectory() != null ) ? new File( original.getBaseDirectory() )
: null );
copy.setGoals( original.getGoals() ); copy.setGoals( original.getGoals() );
copy.setRecursive( original.isRecursive() ); copy.setRecursive( original.isRecursive() );
copy.setPom( original.getPom() ); copy.setPom( original.getPom() );

View File

@ -147,11 +147,11 @@ public class DefaultMavenExecutionRequestPopulator
} }
List<Repository> pluginRepositories = rawProfile.getPluginRepositories(); List<Repository> pluginRepositories = rawProfile.getPluginRepositories();
for ( Repository pluginRepository : pluginRepositories ) for ( Repository pluginRepo : pluginRepositories )
{ {
try try
{ {
request.addPluginArtifactRepository( repositorySystem.buildArtifactRepository( pluginRepository ) ); request.addPluginArtifactRepository( repositorySystem.buildArtifactRepository( pluginRepo ) );
} }
catch ( InvalidRepositoryException e ) catch ( InvalidRepositoryException e )
{ {
@ -260,7 +260,8 @@ public class DefaultMavenExecutionRequestPopulator
// <mirrors> // <mirrors>
// <mirror> // <mirror>
// <id>central</id> // <id>central</id>
// <!-- NOTE: We need to try and use the proper host name/ip as Java generally ignores proxies for "localhost" --> // <!-- NOTE: We need to try and use the proper host name/ip as Java generally ignores proxies for
// "localhost" -->
// <url>http://10.0.1.34:62247/</url> // <url>http://10.0.1.34:62247/</url>
// <mirrorOf>central</mirrorOf> // <mirrorOf>central</mirrorOf>
// </mirror> // </mirror>

View File

@ -302,8 +302,8 @@ public class MavenSession
private final Settings settings; private final Settings settings;
@Deprecated @Deprecated
public MavenSession( PlexusContainer container, RepositorySystemSession repositorySession, MavenExecutionRequest request, public MavenSession( PlexusContainer container, RepositorySystemSession repositorySession,
MavenExecutionResult result ) MavenExecutionRequest request, MavenExecutionResult result )
{ {
this.container = container; this.container = container;
this.request = request; this.request = request;

View File

@ -118,7 +118,8 @@ public class DefaultGraphBuilder
if ( activeProjects.size() != projectDependencyGraph.getSortedProjects().size() ) if ( activeProjects.size() != projectDependencyGraph.getSortedProjects().size() )
{ {
projectDependencyGraph = new FilteredProjectDependencyGraph( projectDependencyGraph, activeProjects ); projectDependencyGraph =
new FilteredProjectDependencyGraph( projectDependencyGraph, activeProjects );
} }
} }
} }
@ -377,11 +378,11 @@ public class DefaultGraphBuilder
return result; return result;
} }
// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// Project collection // Project collection
// //
// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private List<MavenProject> getProjectsForMavenReactor( MavenSession session ) private List<MavenProject> getProjectsForMavenReactor( MavenSession session )
throws ProjectBuildingException throws ProjectBuildingException

View File

@ -170,7 +170,8 @@ public class DefaultLifecycleExecutor
public List<MavenProject> executeForkedExecutions( MojoExecution mojoExecution, MavenSession session ) public List<MavenProject> executeForkedExecutions( MojoExecution mojoExecution, MavenSession session )
throws LifecycleExecutionException throws LifecycleExecutionException
{ {
return mojoExecutor.executeForkedExecutions( mojoExecution, session, new ProjectIndex( session.getProjects() ) ); return mojoExecutor.executeForkedExecutions( mojoExecution, session,
new ProjectIndex( session.getProjects() ) );
} }
} }

View File

@ -23,8 +23,8 @@ import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
/** /**
* A MojoExecutionConfigurator is responsible for creating the configuration for Mojo based on configuration for a Mojo in the MavenProject * A MojoExecutionConfigurator is responsible for creating the configuration for Mojo based on configuration for a Mojo
* and the default configuration for the Mojo from the containing plugin's plugin.xml descriptor. * in the MavenProject and the default configuration for the Mojo from the containing plugin's plugin.xml descriptor.
* *
* @provisional * @provisional
* @author Jason van Zyl * @author Jason van Zyl

View File

@ -168,14 +168,15 @@ public class DefaultLifecycleExecutionPlanCalculator
{ {
mojoDescriptor = mojoDescriptor =
pluginManager.getMojoDescriptor( mojoExecution.getPlugin(), mojoExecution.getGoal(), pluginManager.getMojoDescriptor( mojoExecution.getPlugin(), mojoExecution.getGoal(),
project.getRemotePluginRepositories(), session.getRepositorySession() ); project.getRemotePluginRepositories(),
session.getRepositorySession() );
mojoExecution.setMojoDescriptor( mojoDescriptor ); mojoExecution.setMojoDescriptor( mojoDescriptor );
} }
mojoExecutionConfigurator( mojoExecution ).configure( project, mojoExecutionConfigurator( mojoExecution ).configure( project,
mojoExecution, mojoExecution,
MojoExecution.Source.CLI.equals( mojoExecution.getSource() ) ); MojoExecution.Source.CLI.equals( mojoExecution.getSource() ) );
finalizeMojoConfiguration( mojoExecution ); finalizeMojoConfiguration( mojoExecution );
@ -204,7 +205,8 @@ public class DefaultLifecycleExecutionPlanCalculator
MojoDescriptor mojoDescriptor = mojoDescriptorCreator.getMojoDescriptor( pluginGoal, session, project ); MojoDescriptor mojoDescriptor = mojoDescriptorCreator.getMojoDescriptor( pluginGoal, session, project );
MojoExecution mojoExecution = new MojoExecution( mojoDescriptor, executionId, MojoExecution.Source.CLI ); MojoExecution mojoExecution = new MojoExecution( mojoDescriptor, executionId,
MojoExecution.Source.CLI );
mojoExecutions.add( mojoExecution ); mojoExecutions.add( mojoExecution );
} }
@ -298,7 +300,8 @@ public class DefaultLifecycleExecutionPlanCalculator
Xpp3Dom parameterDefaults = defaultConfiguration.getChild( parameter.getName() ); Xpp3Dom parameterDefaults = defaultConfiguration.getChild( parameter.getName() );
parameterConfiguration = Xpp3Dom.mergeXpp3Dom( parameterConfiguration, parameterDefaults, Boolean.TRUE ); parameterConfiguration = Xpp3Dom.mergeXpp3Dom( parameterConfiguration, parameterDefaults,
Boolean.TRUE );
if ( parameterConfiguration != null ) if ( parameterConfiguration != null )
{ {
@ -369,7 +372,8 @@ public class DefaultLifecycleExecutionPlanCalculator
} }
else else
{ {
forkedExecutions = calculateForkedGoal( mojoExecution, session, forkedProject, alreadyForkedExecutions ); forkedExecutions = calculateForkedGoal( mojoExecution, session, forkedProject,
alreadyForkedExecutions );
} }
mojoExecution.setForkedExecutions( BuilderCommon.getKey( forkedProject ), forkedExecutions ); mojoExecution.setForkedExecutions( BuilderCommon.getKey( forkedProject ), forkedExecutions );
@ -389,7 +393,8 @@ public class DefaultLifecycleExecutionPlanCalculator
String forkedPhase = mojoDescriptor.getExecutePhase(); String forkedPhase = mojoDescriptor.getExecutePhase();
Map<String, List<MojoExecution>> lifecycleMappings = calculateLifecycleMappings( session, project, forkedPhase ); Map<String, List<MojoExecution>> lifecycleMappings = calculateLifecycleMappings( session, project,
forkedPhase );
for ( List<MojoExecution> forkedExecutions : lifecycleMappings.values() ) for ( List<MojoExecution> forkedExecutions : lifecycleMappings.values() )
{ {

View File

@ -203,7 +203,8 @@ public class LifecycleDependencyResolver
* plugins that require dependency resolution although they usually run in phases of the build where project * plugins that require dependency resolution although they usually run in phases of the build where project
* artifacts haven't been assembled yet. The prime example of this is "mvn release:prepare". * artifacts haven't been assembled yet. The prime example of this is "mvn release:prepare".
*/ */
if ( aggregating && areAllDependenciesInReactor( session.getProjects(), result.getUnresolvedDependencies() ) ) if ( aggregating && areAllDependenciesInReactor( session.getProjects(),
result.getUnresolvedDependencies() ) )
{ {
logger.warn( "The following dependencies could not be resolved at this point of the build" logger.warn( "The following dependencies could not be resolved at this point of the build"
+ " but seem to be part of the reactor:" ); + " but seem to be part of the reactor:" );
@ -232,7 +233,8 @@ public class LifecycleDependencyResolver
return artifacts; return artifacts;
} }
private boolean areAllDependenciesInReactor( Collection<MavenProject> projects, Collection<Dependency> dependencies ) private boolean areAllDependenciesInReactor( Collection<MavenProject> projects,
Collection<Dependency> dependencies )
{ {
Set<String> projectKeys = getReactorProjectKeys( projects ); Set<String> projectKeys = getReactorProjectKeys( projects );

View File

@ -120,7 +120,8 @@ public class LifecycleModuleBuilder
projectExecutionListener.afterProjectExecutionSuccess( new ProjectExecutionEvent( session, currentProject, projectExecutionListener.afterProjectExecutionSuccess( new ProjectExecutionEvent( session, currentProject,
mojoExecutions ) ); mojoExecutions ) );
reactorContext.getResult().addBuildSummary( new BuildSuccess( currentProject, buildEndTime - buildStartTime ) ); reactorContext.getResult().addBuildSummary( new BuildSuccess( currentProject,
buildEndTime - buildStartTime ) );
eventCatapult.fire( ExecutionEvent.Type.ProjectSucceeded, session, null ); eventCatapult.fire( ExecutionEvent.Type.ProjectSucceeded, session, null );
} }

View File

@ -114,14 +114,16 @@ public class LifecycleStarter
Builder builder = builders.get( builderId ); Builder builder = builders.get( builderId );
if ( builder == null ) if ( builder == null )
{ {
throw new BuilderNotFoundException( String.format( "The builder requested using id = %s cannot be found", builderId ) ); throw new BuilderNotFoundException( String.format( "The builder requested using id = %s cannot be"
+ " found", builderId ) );
} }
int degreeOfConcurrency = session.getRequest().getDegreeOfConcurrency(); int degreeOfConcurrency = session.getRequest().getDegreeOfConcurrency();
if ( degreeOfConcurrency >= 2 ) if ( degreeOfConcurrency >= 2 )
{ {
logger.info( "" ); logger.info( "" );
logger.info( String.format( "Using the %s implementation with a thread count of %d", builder.getClass().getSimpleName(), degreeOfConcurrency ) ); logger.info( String.format( "Using the %s implementation with a thread count of %d",
builder.getClass().getSimpleName(), degreeOfConcurrency ) );
} }
builder.build( session, reactorContext, projectBuilds, taskSegments, reactorBuildStatus ); builder.build( session, reactorContext, projectBuilds, taskSegments, reactorBuildStatus );

View File

@ -29,13 +29,11 @@ import org.apache.maven.lifecycle.internal.ReactorContext;
import org.apache.maven.lifecycle.internal.TaskSegment; import org.apache.maven.lifecycle.internal.TaskSegment;
/** /**
* * A {@link Builder} encapsulates a strategy for building a set of Maven projects. The default strategy in Maven builds
* A {@link Builder} encapsulates a strategy for building a set of Maven projects. The default strategy in Maven builds the * the the projects serially, but a {@link Builder} can employ any type of concurrency model to build the projects.
* the projects serially, but a {@link Builder} can employ any type of concurrency model to build the projects.
* *
* @author jvanzyl * @author jvanzyl
* @provisional * @provisional
*
*/ */
public interface Builder public interface Builder
{ {

View File

@ -188,8 +188,8 @@ public class BuilderCommon
} }
} }
// Todo: I'm really wondering where this method belongs; smells like it should be on MavenProject, but for some reason // Todo: I'm really wondering where this method belongs; smells like it should be on MavenProject, but for some
// it isn't ? This localization is kind-of a code smell. // reason it isn't ? This localization is kind-of a code smell.
public static String getKey( MavenProject project ) public static String getKey( MavenProject project )
{ {

View File

@ -75,8 +75,10 @@ public class DefaultBuildPluginManager
* @throws PluginResolutionException The plugin could be found but could not be resolved. * @throws PluginResolutionException The plugin could be found but could not be resolved.
* @throws InvalidPluginDescriptorException * @throws InvalidPluginDescriptorException
*/ */
public PluginDescriptor loadPlugin( Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session ) public PluginDescriptor loadPlugin( Plugin plugin, List<RemoteRepository> repositories,
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException RepositorySystemSession session )
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
InvalidPluginDescriptorException
{ {
return mavenPluginManager.getPluginDescriptor( plugin, repositories, session ); return mavenPluginManager.getPluginDescriptor( plugin, repositories, session );
} }

View File

@ -50,7 +50,8 @@ public interface MavenPluginManager
* @param session The repository session to use for resolving the plugin's main artifact, must not be {@code null}. * @param session The repository session to use for resolving the plugin's main artifact, must not be {@code null}.
* @return The plugin descriptor, never {@code null}. * @return The plugin descriptor, never {@code null}.
*/ */
PluginDescriptor getPluginDescriptor( Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session ) PluginDescriptor getPluginDescriptor( Plugin plugin, List<RemoteRepository> repositories,
RepositorySystemSession session )
throws PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException; throws PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException;
/** /**

View File

@ -42,7 +42,8 @@ public class PluginContainerException
private ClassRealm pluginRealm; private ClassRealm pluginRealm;
public PluginContainerException( MojoDescriptor mojoDescriptor, ClassRealm pluginRealm, String message, Throwable e ) public PluginContainerException( MojoDescriptor mojoDescriptor, ClassRealm pluginRealm, String message,
Throwable e )
{ {
super( mojoDescriptor, message, e ); super( mojoDescriptor, message, e );

View File

@ -35,7 +35,8 @@ public class PluginExecutionException
this.mojoExecution = mojoExecution; this.mojoExecution = mojoExecution;
} }
public PluginExecutionException( MojoExecution mojoExecution, MavenProject project, String message, Throwable cause ) public PluginExecutionException( MojoExecution mojoExecution, MavenProject project, String message,
Throwable cause )
{ {
super( mojoExecution.getMojoDescriptor(), project, message, cause ); super( mojoExecution.getMojoDescriptor(), project, message, cause );
this.mojoExecution = mojoExecution; this.mojoExecution = mojoExecution;

View File

@ -38,20 +38,28 @@ import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
* <tr><th>expression</th> <th></th> <th>evaluation result</th></tr> * <tr><th>expression</th> <th></th> <th>evaluation result</th></tr>
* <tr><td><code>session</code></td> <td></td> <td>the actual {@link MavenSession}</td></tr> * <tr><td><code>session</code></td> <td></td> <td>the actual {@link MavenSession}</td></tr>
* <tr><td><code>session.*</code></td> <td>(since Maven 3)</td><td></td></tr> * <tr><td><code>session.*</code></td> <td>(since Maven 3)</td><td></td></tr>
* <tr><td><code>localRepository</code></td> <td></td> <td>{@link MavenSession#getLocalRepository()}</td></tr> * <tr><td><code>localRepository</code></td> <td></td>
* <td>{@link MavenSession#getLocalRepository()}</td></tr>
* <tr><td><code>reactorProjects</code></td> <td></td> <td>{@link MavenSession#getProjects()}</td></tr> * <tr><td><code>reactorProjects</code></td> <td></td> <td>{@link MavenSession#getProjects()}</td></tr>
* <tr><td><code>repositorySystemSession</code></td><td> (since Maven 3)</td><td>{@link MavenSession#getRepositorySession()}</td></tr> * <tr><td><code>repositorySystemSession</code></td><td> (since Maven 3)</td>
* <tr><td><code>project</code></td> <td></td> <td>{@link MavenSession#getCurrentProject()}</td></tr> * <td>{@link MavenSession#getRepositorySession()}</td></tr>
* <tr><td><code>project</code></td> <td></td>
* <td>{@link MavenSession#getCurrentProject()}</td></tr>
* <tr><td><code>project.*</code></td> <td></td> <td></td></tr> * <tr><td><code>project.*</code></td> <td></td> <td></td></tr>
* <tr><td><code>pom.*</code></td> <td>(since Maven 3)</td><td>same as <code>project.*</code></td></tr> * <tr><td><code>pom.*</code></td> <td>(since Maven 3)</td><td>same as <code>project.*</code></td></tr>
* <tr><td><code>executedProject</code></td> <td></td> <td>{@link MavenProject#getExecutionProject()}</td></tr> * <tr><td><code>executedProject</code></td> <td></td>
* <td>{@link MavenProject#getExecutionProject()}</td></tr>
* <tr><td><code>settings</code></td> <td></td> <td>{@link MavenSession#getSettings()}</td></tr> * <tr><td><code>settings</code></td> <td></td> <td>{@link MavenSession#getSettings()}</td></tr>
* <tr><td><code>settings.*</code></td> <td></td> <td></td></tr> * <tr><td><code>settings.*</code></td> <td></td> <td></td></tr>
* <tr><td><code>basedir</code></td> <td></td> <td>{@link MavenSession#getExecutionRootDirectory()} or <code>System.getProperty( "user.dir" )</code> if null</td></tr> * <tr><td><code>basedir</code></td> <td></td>
* <td>{@link MavenSession#getExecutionRootDirectory()} or
* <code>System.getProperty( "user.dir" )</code> if null</td></tr>
* <tr><td><code>mojoExecution</code></td> <td></td> <td>the actual {@link MojoExecution}</td></tr> * <tr><td><code>mojoExecution</code></td> <td></td> <td>the actual {@link MojoExecution}</td></tr>
* <tr><td><code>mojo</code></td> <td>(since Maven 3)</td><td>same as <code>mojoExecution</code></td></tr> * <tr><td><code>mojo</code></td> <td>(since Maven 3)</td><td>same as <code>mojoExecution</code></td></tr>
* <tr><td><code>mojo.*</code></td> <td>(since Maven 3)</td><td></td></tr> * <tr><td><code>mojo.*</code></td> <td>(since Maven 3)</td><td></td></tr>
* <tr><td><code>plugin</code></td> <td>(since Maven 3)</td><td>{@link MojoExecution#getMojoDescriptor()}.{@link MojoDescriptor#getPluginDescriptor() getPluginDescriptor()}</td></tr> * <tr><td><code>plugin</code></td> <td>(since Maven 3)</td>
* <td>{@link MojoExecution#getMojoDescriptor()}.{@link MojoDescriptor#getPluginDescriptor()
* getPluginDescriptor()}</td></tr>
* <tr><td><code>plugin.*</code></td> <td></td> <td></td></tr> * <tr><td><code>plugin.*</code></td> <td></td> <td></td></tr>
* <tr><td><code>*</code></td> <td></td> <td>system properties</td></tr> * <tr><td><code>*</code></td> <td></td> <td>system properties</td></tr>
* <tr><td><code>*</code></td> <td></td> <td>project properties</td></tr> * <tr><td><code>*</code></td> <td></td> <td>project properties</td></tr>

View File

@ -38,7 +38,8 @@ public class DefaultLegacySupport
implements LegacySupport implements LegacySupport
{ {
private static final ThreadLocal<AtomicReference<MavenSession>> SESSION = new InheritableThreadLocal<AtomicReference<MavenSession>>(); private static final ThreadLocal<AtomicReference<MavenSession>> SESSION =
new InheritableThreadLocal<AtomicReference<MavenSession>>();
public void setSession( MavenSession session ) public void setSession( MavenSession session )
{ {

View File

@ -878,7 +878,8 @@ public class DefaultMavenPluginManager
extensionRecord = extensionRealmCache.get( extensionKey ); extensionRecord = extensionRealmCache.get( extensionKey );
if ( extensionRecord == null ) if ( extensionRecord == null )
{ {
ClassRealm extensionRealm = classRealmManager.createExtensionRealm( plugin, toAetherArtifacts( artifacts ) ); ClassRealm extensionRealm = classRealmManager.createExtensionRealm( plugin,
toAetherArtifacts( artifacts ) );
// TODO figure out how to use the same PluginDescriptor when running mojos // TODO figure out how to use the same PluginDescriptor when running mojos

View File

@ -154,7 +154,8 @@ public class DefaultPluginDependenciesResolver
DependencyFilter resolutionFilter = DependencyFilter resolutionFilter =
new ExclusionsDependencyFilter( artifactFilterManager.getCoreArtifactExcludes() ); new ExclusionsDependencyFilter( artifactFilterManager.getCoreArtifactExcludes() );
resolutionFilter = AndDependencyFilter.newInstance( resolutionFilter, dependencyFilter ); resolutionFilter = AndDependencyFilter.newInstance( resolutionFilter, dependencyFilter );
return resolveInternal( plugin, pluginArtifact, resolutionFilter, new PlexusUtilsInjector(), repositories, session ); return resolveInternal( plugin, pluginArtifact, resolutionFilter, new PlexusUtilsInjector(), repositories,
session );
} }
private DependencyNode resolveInternal( Plugin plugin, Artifact pluginArtifact, DependencyFilter dependencyFilter, private DependencyNode resolveInternal( Plugin plugin, Artifact pluginArtifact, DependencyFilter dependencyFilter,

View File

@ -84,7 +84,8 @@ public class DefaultPluginVersionRequest
* @param session The repository session to use, must not be {@code null}. * @param session The repository session to use, must not be {@code null}.
* @param repositories The plugin repositories to query, may be {@code null}. * @param repositories The plugin repositories to query, may be {@code null}.
*/ */
public DefaultPluginVersionRequest( Plugin plugin, RepositorySystemSession session, List<RemoteRepository> repositories ) public DefaultPluginVersionRequest( Plugin plugin, RepositorySystemSession session,
List<RemoteRepository> repositories )
{ {
setGroupId( plugin.getGroupId() ); setGroupId( plugin.getGroupId() );
setArtifactId( plugin.getArtifactId() ); setArtifactId( plugin.getArtifactId() );

View File

@ -40,7 +40,8 @@ public class DefaultMavenProjectHelper
@Requirement @Requirement
private ArtifactHandlerManager artifactHandlerManager; private ArtifactHandlerManager artifactHandlerManager;
public void attachArtifact( MavenProject project, String artifactType, String artifactClassifier, File artifactFile ) public void attachArtifact( MavenProject project, String artifactType, String artifactClassifier,
File artifactFile )
{ {
String type = artifactType; String type = artifactType;

View File

@ -399,7 +399,8 @@ public class DefaultProjectBuilder
Map<String, MavenProject> projectIndex = new HashMap<String, MavenProject>( 256 ); Map<String, MavenProject> projectIndex = new HashMap<String, MavenProject>( 256 );
boolean noErrors = boolean noErrors =
build( results, interimResults, projectIndex, pomFiles, new LinkedHashSet<File>(), true, recursive, config ); build( results, interimResults, projectIndex, pomFiles, new LinkedHashSet<File>(), true, recursive,
config );
populateReactorModelPool( modelPool, interimResults ); populateReactorModelPool( modelPool, interimResults );
@ -635,7 +636,8 @@ public class DefaultProjectBuilder
} }
catch ( ModelBuildingException e ) catch ( ModelBuildingException e )
{ {
results.add( new DefaultProjectBuildingResult( e.getModelId(), interimResult.pomFile, e.getProblems() ) ); results.add( new DefaultProjectBuildingResult( e.getModelId(), interimResult.pomFile,
e.getProblems() ) );
noErrors = false; noErrors = false;
} }
@ -826,17 +828,19 @@ public class DefaultProjectBuilder
project.setManagedVersionMap( map ); project.setManagedVersionMap( map );
// release artifact repository // release artifact repository
if ( project.getDistributionManagement() != null && project.getDistributionManagement().getRepository() != null ) if ( project.getDistributionManagement() != null
&& project.getDistributionManagement().getRepository() != null )
{ {
try try
{ {
DeploymentRepository r = project.getDistributionManagement().getRepository(); DeploymentRepository r = project.getDistributionManagement().getRepository();
if ( !StringUtils.isEmpty( r.getId() ) && !StringUtils.isEmpty( r.getUrl() ) ) if ( !StringUtils.isEmpty( r.getId() ) && !StringUtils.isEmpty( r.getUrl() ) )
{ {
ArtifactRepository repo = ArtifactRepository repo = repositorySystem.buildArtifactRepository( r );
repositorySystem.buildArtifactRepository( project.getDistributionManagement().getRepository() ); repositorySystem.injectProxy( projectBuildingRequest.getRepositorySession(),
repositorySystem.injectProxy( projectBuildingRequest.getRepositorySession(), Arrays.asList( repo ) ); Arrays.asList( repo ) );
repositorySystem.injectAuthentication( projectBuildingRequest.getRepositorySession(), Arrays.asList( repo ) ); repositorySystem.injectAuthentication( projectBuildingRequest.getRepositorySession(),
Arrays.asList( repo ) );
project.setReleaseArtifactRepository( repo ); project.setReleaseArtifactRepository( repo );
} }
} }
@ -856,10 +860,11 @@ public class DefaultProjectBuilder
DeploymentRepository r = project.getDistributionManagement().getSnapshotRepository(); DeploymentRepository r = project.getDistributionManagement().getSnapshotRepository();
if ( !StringUtils.isEmpty( r.getId() ) && !StringUtils.isEmpty( r.getUrl() ) ) if ( !StringUtils.isEmpty( r.getId() ) && !StringUtils.isEmpty( r.getUrl() ) )
{ {
ArtifactRepository repo = ArtifactRepository repo = repositorySystem.buildArtifactRepository( r );
repositorySystem.buildArtifactRepository( project.getDistributionManagement().getSnapshotRepository() ); repositorySystem.injectProxy( projectBuildingRequest.getRepositorySession(),
repositorySystem.injectProxy( projectBuildingRequest.getRepositorySession(), Arrays.asList( repo ) ); Arrays.asList( repo ) );
repositorySystem.injectAuthentication( projectBuildingRequest.getRepositorySession(), Arrays.asList( repo ) ); repositorySystem.injectAuthentication( projectBuildingRequest.getRepositorySession(),
Arrays.asList( repo ) );
project.setSnapshotArtifactRepository( repo ); project.setSnapshotArtifactRepository( repo );
} }
} }

View File

@ -1249,7 +1249,7 @@ public class MavenProject
if ( project.getPluginArtifactRepositories() != null ) if ( project.getPluginArtifactRepositories() != null )
{ {
setPluginArtifactRepositories( ( Collections.unmodifiableList( project.getPluginArtifactRepositories() ) ) ); setPluginArtifactRepositories( Collections.unmodifiableList( project.getPluginArtifactRepositories() ) );
} }
if ( project.getActiveProfiles() != null ) if ( project.getActiveProfiles() != null )
@ -1458,17 +1458,17 @@ public class MavenProject
lifecyclePhases.add( lifecyclePhase ); lifecyclePhases.add( lifecyclePhase );
} }
// -------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// //
// //
// D E P R E C A T E D // D E P R E C A T E D
// //
// //
// -------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// //
// Everything below will be removed for Maven 4.0.0 // Everything below will be removed for Maven 4.0.0
// //
// -------------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
private ProjectBuildingRequest projectBuilderConfiguration; private ProjectBuildingRequest projectBuilderConfiguration;
@ -1531,7 +1531,8 @@ public class MavenProject
} }
@Deprecated @Deprecated
public Set<Artifact> createArtifacts( ArtifactFactory artifactFactory, String inheritedScope, ArtifactFilter filter ) public Set<Artifact> createArtifacts( ArtifactFactory artifactFactory, String inheritedScope,
ArtifactFilter filter )
throws InvalidDependencyVersionException throws InvalidDependencyVersionException
{ {
return MavenMetadataSource.createArtifacts( artifactFactory, getDependencies(), inheritedScope, filter, this ); return MavenMetadataSource.createArtifacts( artifactFactory, getDependencies(), inheritedScope, filter, this );

View File

@ -70,6 +70,7 @@ public interface MavenProjectHelper
* @param includes include patterns. * @param includes include patterns.
* @param excludes exclude patterns. * @param excludes exclude patterns.
*/ */
void addTestResource( MavenProject project, String resourceDirectory, List<String> includes, List<String> excludes ); void addTestResource( MavenProject project, String resourceDirectory, List<String> includes,
List<String> excludes );
} }

View File

@ -84,7 +84,8 @@ public class ProjectModelResolver
public ProjectModelResolver( RepositorySystemSession session, RequestTrace trace, RepositorySystem resolver, public ProjectModelResolver( RepositorySystemSession session, RequestTrace trace, RepositorySystem resolver,
RemoteRepositoryManager remoteRepositoryManager, List<RemoteRepository> repositories, RemoteRepositoryManager remoteRepositoryManager, List<RemoteRepository> repositories,
ProjectBuildingRequest.RepositoryMerging repositoryMerging, ReactorModelPool modelPool ) ProjectBuildingRequest.RepositoryMerging repositoryMerging,
ReactorModelPool modelPool )
{ {
this.session = session; this.session = session;
this.trace = trace; this.trace = trace;

View File

@ -445,7 +445,7 @@ public class MavenMetadataSource
public List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, public List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact,
ArtifactRepository localRepository, ArtifactRepository localRepository,
ArtifactRepository deploymentRepository ) ArtifactRepository deploymentRepository )
throws ArtifactMetadataRetrievalException throws ArtifactMetadataRetrievalException
{ {
RepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact ); RepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );

View File

@ -80,7 +80,8 @@ public interface RepositorySystem
throws InvalidRepositoryException; throws InvalidRepositoryException;
ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout, ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout,
ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ); ArtifactRepositoryPolicy snapshots,
ArtifactRepositoryPolicy releases );
/** /**
* Calculates the effective repositories for the given input repositories which are assumed to be already mirrored * Calculates the effective repositories for the given input repositories which are assumed to be already mirrored

View File

@ -82,7 +82,8 @@ public class DefaultRuntimeInformation
} }
else else
{ {
logger.warn( "Could not locate " + resource + " on classpath, Maven runtime information not available" ); logger.warn( "Could not locate " + resource
+ " on classpath, Maven runtime information not available" );
} }
String version = props.getProperty( "version", "" ).trim(); String version = props.getProperty( "version", "" ).trim();

View File

@ -74,7 +74,8 @@ public class DefaultToolchainManager
return selectToolchains( models, type, requirements ); return selectToolchains( models, type, requirements );
} }
private List<Toolchain> selectToolchains( List<ToolchainModel> models, String type, Map<String, String> requirements ) private List<Toolchain> selectToolchains( List<ToolchainModel> models, String type,
Map<String, String> requirements )
{ {
List<Toolchain> toolchains = new ArrayList<Toolchain>(); List<Toolchain> toolchains = new ArrayList<Toolchain>();

View File

@ -59,7 +59,7 @@ public class DefaultToolchainsBuilder
{ {
ProblemCollector problems = ProblemCollectorFactory.newInstance( null ); ProblemCollector problems = ProblemCollectorFactory.newInstance( null );
PersistedToolchains globalToolchains = readToolchains( request.getGlobalToolchainsSource() , request, problems ); PersistedToolchains globalToolchains = readToolchains( request.getGlobalToolchainsSource(), request, problems );
PersistedToolchains userToolchains = readToolchains( request.getUserToolchainsSource(), request, problems ); PersistedToolchains userToolchains = readToolchains( request.getUserToolchainsSource(), request, problems );

View File

@ -38,8 +38,8 @@ public interface ToolchainsBuildingRequest
Source getGlobalToolchainsSource(); Source getGlobalToolchainsSource();
/** /**
* Sets the global toolchains source. If both user toolchains and a global toolchains are given, the user toolchains take * Sets the global toolchains source. If both user toolchains and a global toolchains are given, the user toolchains
* precedence. * take precedence.
* *
* @param globalToolchainsSource The global toolchains source, may be {@code null} to disable global toolchains. * @param globalToolchainsSource The global toolchains source, may be {@code null} to disable global toolchains.
* @return This request, never {@code null}. * @return This request, never {@code null}.
@ -54,8 +54,8 @@ public interface ToolchainsBuildingRequest
Source getUserToolchainsSource(); Source getUserToolchainsSource();
/** /**
* Sets the user toolchains source. If both user toolchains and a global toolchains are given, the user toolchains take * Sets the user toolchains source. If both user toolchains and a global toolchains are given, the user toolchains
* precedence. * take precedence.
* *
* @param userToolchainsSource The user toolchains source, may be {@code null} to disable user toolchains. * @param userToolchainsSource The user toolchains source, may be {@code null} to disable user toolchains.
* @return This request, never {@code null}. * @return This request, never {@code null}.

View File

@ -55,8 +55,8 @@ public interface ToolchainsReader
throws IOException, ToolchainsParseException; throws IOException, ToolchainsParseException;
/** /**
* Reads the toolchains from the specified character reader. The reader will be automatically closed before the method * Reads the toolchains from the specified character reader. The reader will be automatically closed before the
* returns. * method returns.
* *
* @param input The reader to deserialize the toolchains from, must not be {@code null}. * @param input The reader to deserialize the toolchains from, must not be {@code null}.
* @param options The options to use for deserialization, may be {@code null} to use the default values. * @param options The options to use for deserialization, may be {@code null} to use the default values.