mirror of https://github.com/apache/maven.git
[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.project.artifact.ProjectArtifact;
|
|||
import org.apache.maven.repository.RepositorySystem;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
import org.codehaus.plexus.logging.Logger;
|
||||
import org.codehaus.plexus.util.Os;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
|
||||
|
@ -60,6 +61,9 @@ public class DefaultProjectBuilder
|
|||
implements ProjectBuilder
|
||||
{
|
||||
|
||||
@Requirement
|
||||
private Logger logger;
|
||||
|
||||
@Requirement
|
||||
private ModelBuilder modelBuilder;
|
||||
|
||||
|
@ -106,7 +110,7 @@ public class DefaultProjectBuilder
|
|||
{
|
||||
ModelBuildingRequest request = getModelBuildingRequest( configuration, null );
|
||||
|
||||
project = new MavenProject( repositorySystem, this, configuration );
|
||||
project = new MavenProject( repositorySystem, this, configuration, logger );
|
||||
|
||||
DefaultModelBuildingListener listener =
|
||||
new DefaultModelBuildingListener( project, projectBuildingHelper, configuration );
|
||||
|
@ -313,7 +317,7 @@ public class DefaultProjectBuilder
|
|||
{
|
||||
ModelBuildingRequest request = getModelBuildingRequest( config, reactorModelPool );
|
||||
|
||||
MavenProject project = new MavenProject( repositorySystem, this, config );
|
||||
MavenProject project = new MavenProject( repositorySystem, this, config, logger );
|
||||
|
||||
request.setPomFile( pomFile );
|
||||
request.setTwoPhaseBuilding( true );
|
||||
|
|
|
@ -72,6 +72,7 @@ import org.apache.maven.project.artifact.InvalidDependencyVersionException;
|
|||
import org.apache.maven.project.artifact.MavenMetadataSource;
|
||||
import org.apache.maven.repository.RepositorySystem;
|
||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||
import org.codehaus.plexus.logging.Logger;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
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 Logger logger;
|
||||
|
||||
public MavenProject()
|
||||
{
|
||||
Model model = new Model();
|
||||
|
@ -232,7 +235,7 @@ public class MavenProject
|
|||
* @throws InvalidRepositoryException
|
||||
*/
|
||||
MavenProject( RepositorySystem repositorySystem, ProjectBuilder mavenProjectBuilder,
|
||||
ProjectBuildingRequest projectBuilderConfiguration )
|
||||
ProjectBuildingRequest projectBuilderConfiguration, Logger logger )
|
||||
{
|
||||
if ( repositorySystem == null )
|
||||
{
|
||||
|
@ -242,6 +245,7 @@ public class MavenProject
|
|||
this.mavenProjectBuilder = mavenProjectBuilder;
|
||||
this.projectBuilderConfiguration = projectBuilderConfiguration;
|
||||
this.repositorySystem = repositorySystem;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -345,8 +349,10 @@ public class MavenProject
|
|||
}
|
||||
catch ( ProjectBuildingException e )
|
||||
{
|
||||
//TODO: awful
|
||||
e.printStackTrace();
|
||||
if ( logger != null )
|
||||
{
|
||||
logger.debug( "Failed to build parent project for " + getId(), e );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( model.getParent() != null )
|
||||
|
@ -357,8 +363,10 @@ public class MavenProject
|
|||
}
|
||||
catch ( ProjectBuildingException e )
|
||||
{
|
||||
// TODO: awful
|
||||
e.printStackTrace();
|
||||
if ( logger != null )
|
||||
{
|
||||
logger.debug( "Failed to build parent project for " + getId(), e );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1423,8 +1431,10 @@ public class MavenProject
|
|||
|
||||
if ( attachedArtifacts.contains( artifact ) )
|
||||
{
|
||||
//should add logger to this class:
|
||||
System.out.println( "[Warning] Duplicate artifact: " + artifact.toString() );
|
||||
if ( logger != null )
|
||||
{
|
||||
logger.warn( "Artifact " + artifact + " already attached to project, ignoring duplicate" );
|
||||
}
|
||||
return;
|
||||
//throw new DuplicateArtifactAttachmentException( this, artifact );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue