mirror of https://github.com/apache/maven.git
[MNG-5572] Warn for building plugins with extensions in a reactor
This commit is contained in:
parent
b4a7780350
commit
f6bb98f584
|
@ -28,6 +28,7 @@ import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
|
@ -48,6 +49,7 @@ import org.apache.maven.execution.MavenSession;
|
||||||
import org.apache.maven.execution.ProjectDependencyGraph;
|
import org.apache.maven.execution.ProjectDependencyGraph;
|
||||||
import org.apache.maven.lifecycle.internal.ExecutionEventCatapult;
|
import org.apache.maven.lifecycle.internal.ExecutionEventCatapult;
|
||||||
import org.apache.maven.lifecycle.internal.LifecycleStarter;
|
import org.apache.maven.lifecycle.internal.LifecycleStarter;
|
||||||
|
import org.apache.maven.model.Plugin;
|
||||||
import org.apache.maven.model.building.ModelProblem;
|
import org.apache.maven.model.building.ModelProblem;
|
||||||
import org.apache.maven.model.building.ModelProblemUtils;
|
import org.apache.maven.model.building.ModelProblemUtils;
|
||||||
import org.apache.maven.model.building.ModelSource;
|
import org.apache.maven.model.building.ModelSource;
|
||||||
|
@ -249,6 +251,8 @@ public class DefaultMaven
|
||||||
return addExceptionToResult( result, e );
|
return addExceptionToResult( result, e );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validateProjects( projects );
|
||||||
|
|
||||||
//
|
//
|
||||||
// This creates the graph and trims the projects down based on the user request using something like:
|
// This creates the graph and trims the projects down based on the user request using something like:
|
||||||
//
|
//
|
||||||
|
@ -724,6 +728,37 @@ public class DefaultMaven
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void validateProjects( List<MavenProject> projects )
|
||||||
|
{
|
||||||
|
Map<String, MavenProject> projectsMap = new HashMap<String, MavenProject>();
|
||||||
|
|
||||||
|
for ( MavenProject project : projects )
|
||||||
|
{
|
||||||
|
String projectKey = ArtifactUtils.key( project.getGroupId(), project.getArtifactId(), project.getVersion() );
|
||||||
|
|
||||||
|
projectsMap.put( projectKey, project );
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( MavenProject project : projects )
|
||||||
|
{
|
||||||
|
// MNG-1911 / MNG-5572: Building plugins with extensions cannot be part of reactor
|
||||||
|
for ( Plugin plugin : project.getBuildPlugins() )
|
||||||
|
{
|
||||||
|
if ( plugin.isExtensions() )
|
||||||
|
{
|
||||||
|
String pluginKey =
|
||||||
|
ArtifactUtils.key( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion() );
|
||||||
|
|
||||||
|
if ( projectsMap.containsKey( pluginKey ) )
|
||||||
|
{
|
||||||
|
logger.warn( project.getName() + " uses " + plugin.getKey()
|
||||||
|
+ " as extensions, which is not possible within the same reactor build. This plugin was pulled from the local repository!" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void validateActivatedProfiles( List<MavenProject> projects, List<String> activeProfileIds )
|
private void validateActivatedProfiles( List<MavenProject> projects, List<String> activeProfileIds )
|
||||||
{
|
{
|
||||||
Collection<String> notActivatedProfileIds = new LinkedHashSet<String>( activeProfileIds );
|
Collection<String> notActivatedProfileIds = new LinkedHashSet<String>( activeProfileIds );
|
||||||
|
|
Loading…
Reference in New Issue