mirror of
https://github.com/apache/maven.git
synced 2025-02-08 02:59:22 +00:00
[MNG-4773] Stack trace printed from MavenProject.getParent
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@987610 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f022e66b2a
commit
4b04709828
@ -49,6 +49,7 @@
|
|||||||
import org.apache.maven.repository.RepositorySystem;
|
import org.apache.maven.repository.RepositorySystem;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
import org.codehaus.plexus.component.annotations.Requirement;
|
import org.codehaus.plexus.component.annotations.Requirement;
|
||||||
|
import org.codehaus.plexus.logging.Logger;
|
||||||
import org.codehaus.plexus.util.Os;
|
import org.codehaus.plexus.util.Os;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
|
|
||||||
@ -60,6 +61,9 @@ public class DefaultProjectBuilder
|
|||||||
implements ProjectBuilder
|
implements ProjectBuilder
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@Requirement
|
||||||
|
private Logger logger;
|
||||||
|
|
||||||
@Requirement
|
@Requirement
|
||||||
private ModelBuilder modelBuilder;
|
private ModelBuilder modelBuilder;
|
||||||
|
|
||||||
@ -106,7 +110,7 @@ private ProjectBuildingResult build( File pomFile, ModelSource modelSource, Proj
|
|||||||
{
|
{
|
||||||
ModelBuildingRequest request = getModelBuildingRequest( configuration, null );
|
ModelBuildingRequest request = getModelBuildingRequest( configuration, null );
|
||||||
|
|
||||||
project = new MavenProject( repositorySystem, this, configuration );
|
project = new MavenProject( repositorySystem, this, configuration, logger );
|
||||||
|
|
||||||
DefaultModelBuildingListener listener =
|
DefaultModelBuildingListener listener =
|
||||||
new DefaultModelBuildingListener( project, projectBuildingHelper, configuration );
|
new DefaultModelBuildingListener( project, projectBuildingHelper, configuration );
|
||||||
@ -313,7 +317,7 @@ private boolean build( List<ProjectBuildingResult> results, List<InterimResult>
|
|||||||
{
|
{
|
||||||
ModelBuildingRequest request = getModelBuildingRequest( config, reactorModelPool );
|
ModelBuildingRequest request = getModelBuildingRequest( config, reactorModelPool );
|
||||||
|
|
||||||
MavenProject project = new MavenProject( repositorySystem, this, config );
|
MavenProject project = new MavenProject( repositorySystem, this, config, logger );
|
||||||
|
|
||||||
request.setPomFile( pomFile );
|
request.setPomFile( pomFile );
|
||||||
request.setTwoPhaseBuilding( true );
|
request.setTwoPhaseBuilding( true );
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
import org.apache.maven.project.artifact.MavenMetadataSource;
|
import org.apache.maven.project.artifact.MavenMetadataSource;
|
||||||
import org.apache.maven.repository.RepositorySystem;
|
import org.apache.maven.repository.RepositorySystem;
|
||||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||||
|
import org.codehaus.plexus.logging.Logger;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||||
|
|
||||||
@ -181,6 +182,8 @@ public class MavenProject
|
|||||||
|
|
||||||
private final Set<String> lifecyclePhases = Collections.synchronizedSet( new LinkedHashSet<String>() );
|
private final Set<String> lifecyclePhases = Collections.synchronizedSet( new LinkedHashSet<String>() );
|
||||||
|
|
||||||
|
private Logger logger;
|
||||||
|
|
||||||
public MavenProject()
|
public MavenProject()
|
||||||
{
|
{
|
||||||
Model model = new Model();
|
Model model = new Model();
|
||||||
@ -232,7 +235,7 @@ public void setParentFile( File parentFile )
|
|||||||
* @throws InvalidRepositoryException
|
* @throws InvalidRepositoryException
|
||||||
*/
|
*/
|
||||||
MavenProject( RepositorySystem repositorySystem, ProjectBuilder mavenProjectBuilder,
|
MavenProject( RepositorySystem repositorySystem, ProjectBuilder mavenProjectBuilder,
|
||||||
ProjectBuildingRequest projectBuilderConfiguration )
|
ProjectBuildingRequest projectBuilderConfiguration, Logger logger )
|
||||||
{
|
{
|
||||||
if ( repositorySystem == null )
|
if ( repositorySystem == null )
|
||||||
{
|
{
|
||||||
@ -242,6 +245,7 @@ public void setParentFile( File parentFile )
|
|||||||
this.mavenProjectBuilder = mavenProjectBuilder;
|
this.mavenProjectBuilder = mavenProjectBuilder;
|
||||||
this.projectBuilderConfiguration = projectBuilderConfiguration;
|
this.projectBuilderConfiguration = projectBuilderConfiguration;
|
||||||
this.repositorySystem = repositorySystem;
|
this.repositorySystem = repositorySystem;
|
||||||
|
this.logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -345,8 +349,10 @@ public MavenProject getParent()
|
|||||||
}
|
}
|
||||||
catch ( ProjectBuildingException e )
|
catch ( ProjectBuildingException e )
|
||||||
{
|
{
|
||||||
//TODO: awful
|
if ( logger != null )
|
||||||
e.printStackTrace();
|
{
|
||||||
|
logger.debug( "Failed to build parent project for " + getId(), e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( model.getParent() != null )
|
else if ( model.getParent() != null )
|
||||||
@ -357,8 +363,10 @@ else if ( model.getParent() != null )
|
|||||||
}
|
}
|
||||||
catch ( ProjectBuildingException e )
|
catch ( ProjectBuildingException e )
|
||||||
{
|
{
|
||||||
// TODO: awful
|
if ( logger != null )
|
||||||
e.printStackTrace();
|
{
|
||||||
|
logger.debug( "Failed to build parent project for " + getId(), e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1423,8 +1431,10 @@ public void addAttachedArtifact( Artifact artifact )
|
|||||||
|
|
||||||
if ( attachedArtifacts.contains( artifact ) )
|
if ( attachedArtifacts.contains( artifact ) )
|
||||||
{
|
{
|
||||||
//should add logger to this class:
|
if ( logger != null )
|
||||||
System.out.println( "[Warning] Duplicate artifact: " + artifact.toString() );
|
{
|
||||||
|
logger.warn( "Artifact " + artifact + " already attached to project, ignoring duplicate" );
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
//throw new DuplicateArtifactAttachmentException( this, artifact );
|
//throw new DuplicateArtifactAttachmentException( this, artifact );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user