mirror of https://github.com/apache/maven.git
fixed errors reported by Checkstyle
This commit is contained in:
parent
8e2247dc30
commit
4a39c02156
|
@ -91,7 +91,7 @@ public enum ArtifactScopeEnum
|
|||
}
|
||||
}
|
||||
|
||||
private static final ArtifactScopeEnum [][][] _compliancySets = {
|
||||
private static final ArtifactScopeEnum [][][] COMPLIANCY_SETS = {
|
||||
{ { compile }, { compile, provided, system } }
|
||||
, { { test }, { compile, test, provided, system } }
|
||||
, { { runtime }, { compile, runtime, system } }
|
||||
|
@ -114,7 +114,7 @@ public enum ArtifactScopeEnum
|
|||
return scope.id == system.id;
|
||||
}
|
||||
|
||||
for ( ArtifactScopeEnum[][] set : _compliancySets )
|
||||
for ( ArtifactScopeEnum[][] set : COMPLIANCY_SETS )
|
||||
{
|
||||
if ( id == set[0][0].id )
|
||||
{
|
||||
|
|
|
@ -31,11 +31,11 @@ import org.apache.maven.plugin.MojoExecutionException;
|
|||
*/
|
||||
public interface MojoExecutionListener
|
||||
{
|
||||
public void beforeMojoExecution( MojoExecutionEvent event )
|
||||
void beforeMojoExecution( MojoExecutionEvent event )
|
||||
throws MojoExecutionException;
|
||||
|
||||
public void afterMojoExecutionSuccess( MojoExecutionEvent event )
|
||||
void afterMojoExecutionSuccess( MojoExecutionEvent event )
|
||||
throws MojoExecutionException;
|
||||
|
||||
public void afterExecutionFailure( MojoExecutionEvent event );
|
||||
void afterExecutionFailure( MojoExecutionEvent event );
|
||||
}
|
||||
|
|
|
@ -29,16 +29,16 @@ import org.apache.maven.lifecycle.LifecycleExecutionException;
|
|||
* @since 3.1.2
|
||||
* @provisional This interface is part of work in progress and can be changed or removed without notice.
|
||||
*/
|
||||
public interface ProjectExecutionListener
|
||||
interface ProjectExecutionListener
|
||||
{
|
||||
public void beforeProjectExecution( ProjectExecutionEvent event )
|
||||
void beforeProjectExecution( ProjectExecutionEvent event )
|
||||
throws LifecycleExecutionException;
|
||||
|
||||
public void beforeProjectLifecycleExecution( ProjectExecutionEvent event )
|
||||
void beforeProjectLifecycleExecution( ProjectExecutionEvent event )
|
||||
throws LifecycleExecutionException;
|
||||
|
||||
public void afterProjectExecutionSuccess( ProjectExecutionEvent event )
|
||||
void afterProjectExecutionSuccess( ProjectExecutionEvent event )
|
||||
throws LifecycleExecutionException;
|
||||
|
||||
public void afterProjectExecutionFailure( ProjectExecutionEvent event );
|
||||
void afterProjectExecutionFailure( ProjectExecutionEvent event );
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.execution;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
import org.apache.maven.artifact.ArtifactUtils;
|
||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||
import org.apache.maven.project.DuplicateProjectException;
|
||||
|
@ -29,7 +28,6 @@ import org.codehaus.plexus.util.dag.CycleDetectedException;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -49,9 +47,9 @@ public class ReactorManager
|
|||
// make projects that depend on me, and projects that I depend on
|
||||
public static final String MAKE_BOTH_MODE = "make-both";
|
||||
|
||||
private List blackList = new ArrayList();
|
||||
private List<String> blackList = new ArrayList<String>();
|
||||
|
||||
private Map buildFailuresByProject = new HashMap();
|
||||
private Map<String, BuildFailure> buildFailuresByProject = new HashMap<String, BuildFailure>();
|
||||
|
||||
private Map pluginContextsByProjectAndPluginKey = new HashMap();
|
||||
|
||||
|
@ -59,9 +57,9 @@ public class ReactorManager
|
|||
|
||||
private final ProjectSorter sorter;
|
||||
|
||||
private Map buildSuccessesByProject = new HashMap();
|
||||
private Map<String, BuildSuccess> buildSuccessesByProject = new HashMap<String, BuildSuccess>();
|
||||
|
||||
public ReactorManager( List projects )
|
||||
public ReactorManager( List<MavenProject> projects )
|
||||
throws CycleDetectedException, DuplicateProjectException
|
||||
{
|
||||
this.sorter = new ProjectSorter( projects );
|
||||
|
@ -123,16 +121,14 @@ public class ReactorManager
|
|||
{
|
||||
blackList.add( id );
|
||||
|
||||
List dependents = sorter.getDependents( id );
|
||||
List<String> dependents = sorter.getDependents( id );
|
||||
|
||||
if ( dependents != null && !dependents.isEmpty() )
|
||||
{
|
||||
for ( Object dependent : dependents )
|
||||
for ( String dependentId : dependents )
|
||||
{
|
||||
String dependentId = (String) dependent;
|
||||
|
||||
if ( !buildSuccessesByProject.containsKey( dependentId ) && !buildFailuresByProject.containsKey(
|
||||
dependentId ) )
|
||||
if ( !buildSuccessesByProject.containsKey( dependentId )
|
||||
&& !buildFailuresByProject.containsKey( dependentId ) )
|
||||
{
|
||||
blackList( dependentId );
|
||||
}
|
||||
|
|
|
@ -35,11 +35,11 @@ import org.apache.maven.plugin.MojoExecutionException;
|
|||
*/
|
||||
public interface WeakMojoExecutionListener
|
||||
{
|
||||
public void beforeMojoExecution( MojoExecutionEvent event )
|
||||
void beforeMojoExecution( MojoExecutionEvent event )
|
||||
throws MojoExecutionException;
|
||||
|
||||
public void afterMojoExecutionSuccess( MojoExecutionEvent event )
|
||||
void afterMojoExecutionSuccess( MojoExecutionEvent event )
|
||||
throws MojoExecutionException;
|
||||
|
||||
public void afterExecutionFailure( MojoExecutionEvent event );
|
||||
void afterExecutionFailure( MojoExecutionEvent event );
|
||||
}
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
package org.apache.maven.lifecycle.internal;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "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
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
|
@ -11,7 +30,7 @@ public class BuildThreadFactory
|
|||
{
|
||||
private final AtomicInteger ID = new AtomicInteger();
|
||||
|
||||
private String PREFIX = "BuilderThread";
|
||||
private static final String PREFIX = "BuilderThread";
|
||||
|
||||
public Thread newThread( Runnable r )
|
||||
{
|
||||
|
|
|
@ -145,10 +145,12 @@ public class ProjectBuildList
|
|||
/**
|
||||
* @return a set of all the projects managed by the build
|
||||
*/
|
||||
public Set<MavenProject> getProjects() {
|
||||
public Set<MavenProject> getProjects()
|
||||
{
|
||||
Set<MavenProject> projects = new HashSet<MavenProject>();
|
||||
|
||||
for (ProjectSegment s : items) {
|
||||
for ( ProjectSegment s : items )
|
||||
{
|
||||
projects.add( s.getProject() );
|
||||
}
|
||||
return projects;
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
package org.apache.maven.lifecycle.internal.builder;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "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
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
|
@ -22,7 +41,7 @@ public interface Builder
|
|||
// Be nice to whittle this down to Session, maybe add task segments to the session. The session really is the
|
||||
// the place to store reactor related information.
|
||||
//
|
||||
public void build( MavenSession session, ReactorContext reactorContext, ProjectBuildList projectBuilds,
|
||||
void build( MavenSession session, ReactorContext reactorContext, ProjectBuildList projectBuilds,
|
||||
List<TaskSegment> taskSegments, ReactorBuildStatus reactorBuildStatus )
|
||||
throws ExecutionException, InterruptedException;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,26 @@
|
|||
package org.apache.maven.lifecycle.internal.builder;
|
||||
|
||||
public class BuilderNotFoundException extends Exception
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "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
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
public class BuilderNotFoundException
|
||||
extends Exception
|
||||
{
|
||||
public BuilderNotFoundException( String message )
|
||||
{
|
||||
|
|
|
@ -53,7 +53,8 @@ import org.codehaus.plexus.logging.Logger;
|
|||
* NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
|
||||
*/
|
||||
@Component( role = Builder.class, hint = "multithreaded" )
|
||||
public class MultiThreadedBuilder implements Builder
|
||||
public class MultiThreadedBuilder
|
||||
implements Builder
|
||||
{
|
||||
|
||||
@Requirement
|
||||
|
@ -72,9 +73,12 @@ public class MultiThreadedBuilder implements Builder
|
|||
List<TaskSegment> taskSegments, ReactorBuildStatus reactorBuildStatus )
|
||||
throws ExecutionException, InterruptedException
|
||||
{
|
||||
ExecutorService executor = Executors.newFixedThreadPool(Math.min(session.getRequest().getDegreeOfConcurrency(), session.getProjects().size()), new BuildThreadFactory());
|
||||
ExecutorService executor =
|
||||
Executors.newFixedThreadPool( Math.min( session.getRequest().getDegreeOfConcurrency(),
|
||||
session.getProjects().size() ), new BuildThreadFactory() );
|
||||
CompletionService<ProjectSegment> service = new ExecutorCompletionService<ProjectSegment>( executor );
|
||||
ConcurrencyDependencyGraph analyzer = new ConcurrencyDependencyGraph(projectBuilds, session.getProjectDependencyGraph());
|
||||
ConcurrencyDependencyGraph analyzer =
|
||||
new ConcurrencyDependencyGraph( projectBuilds, session.getProjectDependencyGraph() );
|
||||
|
||||
// Currently disabled
|
||||
ThreadOutputMuxer muxer = null; // new ThreadOutputMuxer( analyzer.getProjectBuilds(), System.out );
|
||||
|
|
|
@ -1,5 +1,24 @@
|
|||
package org.apache.maven.lifecycle.internal.builder.singlethreaded;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "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
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
|
|
|
@ -77,11 +77,14 @@ public class DefaultModelValidator
|
|||
Parent parent = model.getParent();
|
||||
if ( parent != null )
|
||||
{
|
||||
validateStringNotEmpty( "parent.groupId", problems, Severity.FATAL, Version.BASE, parent.getGroupId(), parent );
|
||||
validateStringNotEmpty( "parent.groupId", problems, Severity.FATAL, Version.BASE, parent.getGroupId(),
|
||||
parent );
|
||||
|
||||
validateStringNotEmpty( "parent.artifactId", problems, Severity.FATAL, Version.BASE, parent.getArtifactId(), parent );
|
||||
validateStringNotEmpty( "parent.artifactId", problems, Severity.FATAL, Version.BASE,
|
||||
parent.getArtifactId(), parent );
|
||||
|
||||
validateStringNotEmpty( "parent.version", problems, Severity.FATAL, Version.BASE, parent.getVersion(), parent );
|
||||
validateStringNotEmpty( "parent.version", problems, Severity.FATAL, Version.BASE, parent.getVersion(),
|
||||
parent );
|
||||
|
||||
if ( equals( parent.getGroupId(), model.getGroupId() )
|
||||
&& equals( parent.getArtifactId(), model.getArtifactId() ) )
|
||||
|
@ -95,7 +98,8 @@ public class DefaultModelValidator
|
|||
{
|
||||
Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 );
|
||||
|
||||
validateEnum( "modelVersion", problems, Severity.ERROR, Version.V20, model.getModelVersion(), null, model, "4.0.0" );
|
||||
validateEnum( "modelVersion", problems, Severity.ERROR, Version.V20, model.getModelVersion(), null, model,
|
||||
"4.0.0" );
|
||||
|
||||
validateStringNoExpression( "groupId", problems, Severity.WARNING, Version.V20, model.getGroupId(), model );
|
||||
if ( parent == null )
|
||||
|
@ -103,7 +107,8 @@ public class DefaultModelValidator
|
|||
validateStringNotEmpty( "groupId", problems, Severity.FATAL, Version.V20, model.getGroupId(), model );
|
||||
}
|
||||
|
||||
validateStringNoExpression( "artifactId", problems, Severity.WARNING, Version.V20, model.getArtifactId(), model );
|
||||
validateStringNoExpression( "artifactId", problems, Severity.WARNING, Version.V20, model.getArtifactId(),
|
||||
model );
|
||||
validateStringNotEmpty( "artifactId", problems, Severity.FATAL, Version.V20, model.getArtifactId(), model );
|
||||
|
||||
validateVersionNoExpression( "version", problems, Severity.WARNING, Version.V20, model.getVersion(), model );
|
||||
|
@ -133,8 +138,7 @@ public class DefaultModelValidator
|
|||
PluginManagement mngt = build.getPluginManagement();
|
||||
if ( mngt != null )
|
||||
{
|
||||
validate20RawPlugins( problems, mngt.getPlugins(), "build.pluginManagement.plugins.plugin",
|
||||
request );
|
||||
validate20RawPlugins( problems, mngt.getPlugins(), "build.pluginManagement.plugins.plugin", request );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -681,8 +685,8 @@ public class DefaultModelValidator
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean validateVersionNoExpression(String fieldName, ModelProblemCollector problems, Severity severity, Version version,
|
||||
String string, InputLocationTracker tracker)
|
||||
private boolean validateVersionNoExpression( String fieldName, ModelProblemCollector problems, Severity severity,
|
||||
Version version, String string, InputLocationTracker tracker )
|
||||
{
|
||||
|
||||
if ( !hasExpression( string ) )
|
||||
|
@ -697,12 +701,14 @@ public class DefaultModelValidator
|
|||
// revision
|
||||
// sha1
|
||||
//
|
||||
if( string.trim().contains("${changelist}") || string.trim().contains("${revision}") || string.trim().contains("${sha1}") )
|
||||
if ( string.trim().contains( "${changelist}" ) || string.trim().contains( "${revision}" )
|
||||
|| string.trim().contains( "${sha1}" ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
addViolation(problems, severity, version, fieldName, null, "contains an expression but should be a constant.", tracker);
|
||||
addViolation( problems, severity, version, fieldName, null, "contains an expression but should be a constant.",
|
||||
tracker );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -764,8 +770,8 @@ public class DefaultModelValidator
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean validateBoolean( String fieldName, ModelProblemCollector problems, Severity severity, Version version,
|
||||
String string, String sourceHint, InputLocationTracker tracker )
|
||||
private boolean validateBoolean( String fieldName, ModelProblemCollector problems, Severity severity,
|
||||
Version version, String string, String sourceHint, InputLocationTracker tracker )
|
||||
{
|
||||
if ( string == null || string.length() <= 0 )
|
||||
{
|
||||
|
@ -777,14 +783,14 @@ public class DefaultModelValidator
|
|||
return true;
|
||||
}
|
||||
|
||||
addViolation( problems, severity, version, fieldName, sourceHint, "must be 'true' or 'false' but is '" + string + "'.",
|
||||
tracker );
|
||||
addViolation( problems, severity, version, fieldName, sourceHint, "must be 'true' or 'false' but is '" + string
|
||||
+ "'.", tracker );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean validateEnum( String fieldName, ModelProblemCollector problems, Severity severity, Version version, String string,
|
||||
String sourceHint, InputLocationTracker tracker, String... validValues )
|
||||
private boolean validateEnum( String fieldName, ModelProblemCollector problems, Severity severity, Version version,
|
||||
String string, String sourceHint, InputLocationTracker tracker, String... validValues )
|
||||
{
|
||||
if ( string == null || string.length() <= 0 )
|
||||
{
|
||||
|
@ -804,9 +810,9 @@ public class DefaultModelValidator
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean validateBannedCharacters( String fieldName, ModelProblemCollector problems, Severity severity, Version version,
|
||||
String string, String sourceHint, InputLocationTracker tracker,
|
||||
String banned )
|
||||
private boolean validateBannedCharacters( String fieldName, ModelProblemCollector problems, Severity severity,
|
||||
Version version, String string, String sourceHint,
|
||||
InputLocationTracker tracker, String banned )
|
||||
{
|
||||
if ( string != null )
|
||||
{
|
||||
|
@ -825,8 +831,8 @@ public class DefaultModelValidator
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean validateVersion( String fieldName, ModelProblemCollector problems, Severity severity, Version version,
|
||||
String string, String sourceHint, InputLocationTracker tracker )
|
||||
private boolean validateVersion( String fieldName, ModelProblemCollector problems, Severity severity,
|
||||
Version version, String string, String sourceHint, InputLocationTracker tracker )
|
||||
{
|
||||
if ( string == null || string.length() <= 0 )
|
||||
{
|
||||
|
@ -845,8 +851,9 @@ public class DefaultModelValidator
|
|||
|
||||
}
|
||||
|
||||
private boolean validate20ProperSnapshotVersion( String fieldName, ModelProblemCollector problems, Severity severity, Version version,
|
||||
String string, String sourceHint, InputLocationTracker tracker )
|
||||
private boolean validate20ProperSnapshotVersion( String fieldName, ModelProblemCollector problems,
|
||||
Severity severity, Version version, String string,
|
||||
String sourceHint, InputLocationTracker tracker )
|
||||
{
|
||||
if ( string == null || string.length() <= 0 )
|
||||
{
|
||||
|
@ -855,8 +862,8 @@ public class DefaultModelValidator
|
|||
|
||||
if ( string.endsWith( "SNAPSHOT" ) && !string.endsWith( "-SNAPSHOT" ) )
|
||||
{
|
||||
addViolation( problems, severity, version, fieldName, sourceHint, "uses an unsupported snapshot version format"
|
||||
+ ", should be '*-SNAPSHOT' instead.", tracker );
|
||||
addViolation( problems, severity, version, fieldName, sourceHint,
|
||||
"uses an unsupported snapshot version format" + ", should be '*-SNAPSHOT' instead.", tracker );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -882,16 +889,16 @@ public class DefaultModelValidator
|
|||
|
||||
if ( string.length() <= 0 || "RELEASE".equals( string ) || "LATEST".equals( string ) )
|
||||
{
|
||||
addViolation( problems, errOn30, Version.V20, fieldName, sourceHint, "must be a valid version but is '" + string + "'.",
|
||||
tracker );
|
||||
addViolation( problems, errOn30, Version.V20, fieldName, sourceHint, "must be a valid version but is '"
|
||||
+ string + "'.", tracker );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void addViolation( ModelProblemCollector problems, Severity severity, Version version, String fieldName,
|
||||
String sourceHint, String message, InputLocationTracker tracker )
|
||||
private static void addViolation( ModelProblemCollector problems, Severity severity, Version version,
|
||||
String fieldName, String sourceHint, String message, InputLocationTracker tracker )
|
||||
{
|
||||
StringBuilder buffer = new StringBuilder( 256 );
|
||||
buffer.append( '\'' ).append( fieldName ).append( '\'' );
|
||||
|
|
Loading…
Reference in New Issue