[MNG-5338] Accept a directory with -f/--file

Submitted by Jesse Glick.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1382080 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-09-07 16:02:54 +00:00
parent 6e901c5797
commit 541bc917e8
2 changed files with 5 additions and 1 deletions

View File

@ -104,7 +104,7 @@ public class CLIManager
{ {
options = new Options(); options = new Options();
options.addOption( OptionBuilder.withLongOpt( "help" ).withDescription( "Display help information" ).create( HELP ) ); options.addOption( OptionBuilder.withLongOpt( "help" ).withDescription( "Display help information" ).create( HELP ) );
options.addOption( OptionBuilder.withLongOpt( "file" ).hasArg().withDescription( "Force the use of an alternate POM file." ).create( ALTERNATE_POM_FILE ) ); options.addOption( OptionBuilder.withLongOpt( "file" ).hasArg().withDescription( "Force the use of an alternate POM file (or directory with pom.xml)." ).create( ALTERNATE_POM_FILE ) );
options.addOption( OptionBuilder.withLongOpt( "define" ).hasArg().withDescription( "Define a system property" ).create( SET_SYSTEM_PROPERTY ) ); options.addOption( OptionBuilder.withLongOpt( "define" ).hasArg().withDescription( "Define a system property" ).create( SET_SYSTEM_PROPERTY ) );
options.addOption( OptionBuilder.withLongOpt( "offline" ).withDescription( "Work offline" ).create( OFFLINE ) ); options.addOption( OptionBuilder.withLongOpt( "offline" ).withDescription( "Work offline" ).create( OFFLINE ) );
options.addOption( OptionBuilder.withLongOpt( "version" ).withDescription( "Display version information" ).create( VERSION ) ); options.addOption( OptionBuilder.withLongOpt( "version" ).withDescription( "Display version information" ).create( VERSION ) );

View File

@ -954,6 +954,10 @@ public class MavenCli
if ( alternatePomFile != null ) if ( alternatePomFile != null )
{ {
File pom = resolveFile( new File( alternatePomFile ), workingDirectory ); File pom = resolveFile( new File( alternatePomFile ), workingDirectory );
if ( pom.isDirectory() )
{
pom = new File( pom, "pom.xml" );
}
request.setPom( pom ); request.setPom( pom );
} }