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

[MRELEASE-1085] Upgrade Maven Invoker to 3.2.0 #117

Merged
merged 1 commit into from
Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion maven-release-manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-invoker</artifactId>
<version>2.2</version>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ protected void setupRequest( InvocationRequest req,

if ( cli.hasOption( QUIET ) )
{
// TODO: setQuiet() currently not supported by InvocationRequest
req.setDebug( false );
req.setQuiet( true );
}
else if ( cli.hasOption( DEBUG ) )
{
Expand Down Expand Up @@ -252,11 +251,11 @@ else if ( cli.hasOption( NON_RECURSIVE ) )

if ( cli.hasOption( CHECKSUM_FAILURE_POLICY ) )
{
req.setGlobalChecksumPolicy( InvocationRequest.CHECKSUM_POLICY_FAIL );
req.setGlobalChecksumPolicy( InvocationRequest.CheckSumPolicy.Fail );
}
else if ( cli.hasOption( CHECKSUM_WARNING_POLICY ) )
{
req.setGlobalChecksumPolicy( InvocationRequest.CHECKSUM_POLICY_WARN );
req.setGlobalChecksumPolicy( InvocationRequest.CheckSumPolicy.Warn );
}

if ( cli.hasOption( ALTERNATE_USER_SETTINGS ) )
Expand All @@ -271,15 +270,15 @@ else if ( cli.hasOption( CHECKSUM_WARNING_POLICY ) )

if ( cli.hasOption( FAIL_AT_END ) )
{
req.setFailureBehavior( InvocationRequest.REACTOR_FAIL_AT_END );
req.setReactorFailureBehavior( InvocationRequest.ReactorFailureBehavior.FailAtEnd );
}
else if ( cli.hasOption( FAIL_FAST ) )
{
req.setFailureBehavior( InvocationRequest.REACTOR_FAIL_FAST );
req.setReactorFailureBehavior( InvocationRequest.ReactorFailureBehavior.FailFast );
}
if ( cli.hasOption( FAIL_NEVER ) )
{
req.setFailureBehavior( InvocationRequest.REACTOR_FAIL_NEVER );
req.setReactorFailureBehavior( InvocationRequest.ReactorFailureBehavior.FailNever );
}
if ( cli.hasOption( ALTERNATE_POM_FILE ) )
{
Expand All @@ -300,7 +299,7 @@ else if ( cli.hasOption( FAIL_FAST ) )

if ( cli.hasOption( BATCH_MODE ) )
{
req.setInteractive( false );
req.setBatchMode( true );
}

if ( cli.hasOption( ALTERNATE_USER_TOOLCHAINS ) )
Expand Down Expand Up @@ -343,13 +342,17 @@ public void executeGoals( File workingDirectory, List<String> goals, ReleaseEnvi
}
mavenPath = mavenHome == null ? null : new File( mavenHome );
}
Invoker invoker =
new DefaultInvoker().setMavenHome( mavenPath ).setLogger( bridge )
.setOutputHandler( handler ).setErrorHandler( handler );

InvocationRequest req =
new DefaultInvocationRequest().setDebug( getLogger().isDebugEnabled() )
.setBaseDirectory( workingDirectory ).setInteractive( interactive );
Invoker invoker = new DefaultInvoker()
.setMavenHome( mavenPath )
.setLogger( bridge );

InvocationRequest req = new DefaultInvocationRequest()
.setDebug( getLogger().isDebugEnabled() )
.setBaseDirectory( workingDirectory )
.setBatchMode( !interactive )
.setOutputHandler( handler )
.setErrorHandler( handler );

if ( pomFileName != null )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,15 @@ public void testBatch()
executor.enableLogging( logger );

InvocationRequest req = new DefaultInvocationRequest();
// bug: assertEquals( true, req.isInteractive() );

req = new DefaultInvocationRequest();
req.setInteractive( true );
req.setBatchMode( false );
executor.setupRequest( req, null, "-B" );
assertEquals( false, req.isInteractive() );
assertTrue( req.isBatchMode() );

req = new DefaultInvocationRequest();
req.setInteractive( true );
req.setBatchMode( false );
executor.setupRequest( req, null, "\"-B\"" );
assertEquals( false, req.isInteractive() );
assertTrue( req.isBatchMode() );
}

@Test
Expand Down