From 541bc917e84fa00ebb33705df42571e3ddd86c8d Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 7 Sep 2012 16:02:54 +0000 Subject: [PATCH] [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 --- .../src/main/java/org/apache/maven/cli/CLIManager.java | 2 +- .../src/main/java/org/apache/maven/cli/MavenCli.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java index 90f61c7082..0e7f2b622a 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java @@ -104,7 +104,7 @@ public class CLIManager { options = new Options(); 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( "offline" ).withDescription( "Work offline" ).create( OFFLINE ) ); options.addOption( OptionBuilder.withLongOpt( "version" ).withDescription( "Display version information" ).create( VERSION ) ); diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 981b6f8040..d42328a90e 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -954,6 +954,10 @@ public class MavenCli if ( alternatePomFile != null ) { File pom = resolveFile( new File( alternatePomFile ), workingDirectory ); + if ( pom.isDirectory() ) + { + pom = new File( pom, "pom.xml" ); + } request.setPom( pom ); }