Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-6302] logging the module count #136

Merged
merged 1 commit into from Nov 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -23,6 +23,8 @@
import static org.apache.maven.cli.CLIReportingUtils.formatTimestamp;
import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;

import java.util.List;

import org.apache.commons.lang3.Validate;
import org.apache.maven.execution.AbstractExecutionListener;
import org.apache.maven.execution.BuildFailure;
Expand Down Expand Up @@ -53,6 +55,9 @@ public class ExecutionEventLogger
private static final int MAX_PADDED_BUILD_TIME_DURATION_LENGTH = 9;
private static final int MAX_PROJECT_NAME_LENGTH = 52;

private int totalProjects;
private volatile int currentVisitedProjectCount;

public ExecutionEventLogger()
{
logger = LoggerFactory.getLogger( ExecutionEventLogger.class );
Expand Down Expand Up @@ -106,10 +111,13 @@ public void sessionStarted( ExecutionEvent event )

logger.info( "" );

for ( MavenProject project : event.getSession().getProjects() )
final List<MavenProject> projects = event.getSession().getProjects();
for ( MavenProject project : projects )
{
logger.info( project.getName() );
}

totalProjects = projects.size();
}
}

Expand Down Expand Up @@ -259,6 +267,16 @@ public void projectStarted( ExecutionEvent event )
infoMain( "Building " + event.getProject().getName() + " " + event.getProject().getVersion() );

infoLine( '-' );

if ( totalProjects > 1 )
{
int number;
synchronized ( this )
{
number = ++currentVisitedProjectCount;
}
infoMain( "Module " + number + "/" + totalProjects );
} // else what's the point
}
}

Expand Down