You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/05/24 08:07:00 UTC
svn commit: r178084 - in /maven/maven-1/core/trunk: project.xml
src/java/org/apache/maven/cli/CLIManager.java
Author: brett
Date: Mon May 23 23:06:59 2005
New Revision: 178084
URL: http://svn.apache.org/viewcvs?rev=178084&view=rev
Log:
get rid of which
Modified:
maven/maven-1/core/trunk/project.xml
maven/maven-1/core/trunk/src/java/org/apache/maven/cli/CLIManager.java
Modified: maven/maven-1/core/trunk/project.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/core/trunk/project.xml?rev=178084&r1=178083&r2=178084&view=diff
==============================================================================
--- maven/maven-1/core/trunk/project.xml (original)
+++ maven/maven-1/core/trunk/project.xml Mon May 23 23:06:59 2005
@@ -568,12 +568,6 @@
<version>1.2.8</version>
<url>http://logging.apache.org/log4j/</url>
</dependency>
-<!-- TODO: can be removed? -->
- <dependency>
- <id>which</id>
- <version>1.0</version>
- <url>http://xml.apache.org/commons/components/which/index.html</url>
- </dependency>
<dependency>
<groupId>plexus</groupId>
Modified: maven/maven-1/core/trunk/src/java/org/apache/maven/cli/CLIManager.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/core/trunk/src/java/org/apache/maven/cli/CLIManager.java?rev=178084&r1=178083&r2=178084&view=diff
==============================================================================
--- maven/maven-1/core/trunk/src/java/org/apache/maven/cli/CLIManager.java (original)
+++ maven/maven-1/core/trunk/src/java/org/apache/maven/cli/CLIManager.java Mon May 23 23:06:59 2005
@@ -24,34 +24,35 @@
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
-import org.apache.env.Which;
-/** Utility for managing and parsing MavenSession's command-line.
+/**
+ * Utility for managing and parsing MavenSession's command-line.
*
- * <p>
- * <b>implementation note:</b> This is the class to modify when
- * adding, removing or modifying MavenSession's command-line options
- * and flags.
- * </p>
+ * <p>
+ * <b>implementation note:</b> This is the class to modify when
+ * adding, removing or modifying MavenSession's command-line options
+ * and flags.
+ * </p>
*
- * <p>
- * This class uses the
- * <a href="http://jakarta.apache.org/commons/cli/">commons-cli</a>
- * library for command-line parsing.
- * </p>
+ * <p>
+ * This class uses the
+ * <a href="http://jakarta.apache.org/commons/cli/">commons-cli</a>
+ * library for command-line parsing.
+ * </p>
*
- * @author <a href="mailto:bob@eng.werken.com">bob mcwhirter</a>
- * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
+ * @author <a href="mailto:bob@eng.werken.com">bob mcwhirter</a>
+ * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
*/
public class CLIManager
{
-
- /** MavenSession't command-line option configuration. */
+ /**
+ * MavenSession't command-line option configuration.
+ */
private static Options options = null;
/** Configure the option set. */
- static
- {
+
+ static {
options = new Options();
/*
@@ -62,136 +63,140 @@
* no longer static).
*/
options.addOption( OptionBuilder
- .withLongOpt( "nobanner" )
- .withDescription( "Suppress logo banner" )
- .create( 'b' ) );
+ .withLongOpt( "nobanner" )
+ .withDescription( "Suppress logo banner" )
+ .create( 'b' ) );
options.addOption( OptionBuilder
- .withLongOpt( "define" )
- .hasArg()
- .withDescription( "Define a system property" )
- .create( 'D' ) );
+ .withLongOpt( "define" )
+ .hasArg()
+ .withDescription( "Define a system property" )
+ .create( 'D' ) );
options.addOption( OptionBuilder
- .withLongOpt( "dir" )
- .hasArg()
- .withDescription( "Set effective working directory (ignored with -p or -f)" )
- .create( 'd' ) );
+ .withLongOpt( "dir" )
+ .hasArg()
+ .withDescription( "Set effective working directory (ignored with -p or -f)" )
+ .create( 'd' ) );
options.addOption( OptionBuilder
- .withLongOpt( "exception" )
- .withDescription( "Produce exception stack traces" )
- .create( 'e' ) );
+ .withLongOpt( "exception" )
+ .withDescription( "Produce exception stack traces" )
+ .create( 'e' ) );
options.addOption( OptionBuilder
- .withLongOpt( "emacs" )
- .withDescription( "Produce logging information without adornments" )
- .create( 'E' ) );
+ .withLongOpt( "emacs" )
+ .withDescription( "Produce logging information without adornments" )
+ .create( 'E' ) );
options.addOption( OptionBuilder
- .withLongOpt( "find" )
- .hasArg()
- .withDescription( "Set project file and effective working directory by finding the project file" )
- .create( 'f' ) );
+ .withLongOpt( "find" )
+ .hasArg()
+ .withDescription( "Set project file and effective working directory by finding the project file" )
+ .create( 'f' ) );
options.addOption( OptionBuilder
- .withLongOpt( "goals" )
- .withDescription( "Display available goals" )
- .create( 'g' ) );
+ .withLongOpt( "goals" )
+ .withDescription( "Display available goals" )
+ .create( 'g' ) );
options.addOption( OptionBuilder
- .withLongOpt( "usage" )
- .withDescription( "Display help on using the current project" )
- .create( 'u' ) );
+ .withLongOpt( "usage" )
+ .withDescription( "Display help on using the current project" )
+ .create( 'u' ) );
options.addOption( OptionBuilder
- .withLongOpt( "help" )
- .withDescription( "Display help information" )
- .create( 'h' ) );
+ .withLongOpt( "help" )
+ .withDescription( "Display help information" )
+ .create( 'h' ) );
options.addOption( OptionBuilder
- .withLongOpt( "info" )
- .withDescription( "Display system information" )
- .create( 'i' ) );
+ .withLongOpt( "info" )
+ .withDescription( "Display system information" )
+ .create( 'i' ) );
options.addOption( OptionBuilder
- .withLongOpt( "offline" )
- .withDescription( "Build is happening offline" )
- .create( 'o' ) );
+ .withLongOpt( "offline" )
+ .withDescription( "Build is happening offline" )
+ .create( 'o' ) );
options.addOption( OptionBuilder
- .withLongOpt( "pom" )
- .hasArg()
- .withDescription( "Set project file" )
- .create( 'p' ) );
+ .withLongOpt( "pom" )
+ .hasArg()
+ .withDescription( "Set project file" )
+ .create( 'p' ) );
options.addOption( OptionBuilder
- .withLongOpt( "version" )
- .withDescription( "Display version information" )
- .create( 'v' ) );
+ .withLongOpt( "version" )
+ .withDescription( "Display version information" )
+ .create( 'v' ) );
options.addOption( OptionBuilder
- .withLongOpt( "quiet" )
- .withDescription( "Reduce execution output" )
- .create( 'q' ) );
+ .withLongOpt( "quiet" )
+ .withDescription( "Reduce execution output" )
+ .create( 'q' ) );
options.addOption( OptionBuilder
- .withLongOpt( "debug" )
- .withDescription( "Produce execution debug output" )
- .create( 'X' ) );
+ .withLongOpt( "debug" )
+ .withDescription( "Produce execution debug output" )
+ .create( 'X' ) );
options.addOption( OptionBuilder
- .withLongOpt( "plugin-help" )
- .withDescription( "Display help on using a given plugin" )
- .hasOptionalArg()
- .create( 'P' ) );
+ .withLongOpt( "plugin-help" )
+ .withDescription( "Display help on using a given plugin" )
+ .hasOptionalArg()
+ .create( 'P' ) );
}
- /** Parse a string-array of command-line arguments.
- *
- * <p>
- * This will parse the arguments against the configured
- * maven command-line options, and return a <code>CommandLine</code>
- * object which may be queried for the presence of flags
- * and options and their arguments, if any.
- * </p>
- *
- * @see <a href="http://jakarta.apache.org/commons/cli/">CLI</a>
- *
- * @param args The command-line arguments to parse.
+ /**
+ * Parse a string-array of command-line arguments.
*
- * @return The parsed <code>CommandLine</code> result.
+ * <p>
+ * This will parse the arguments against the configured
+ * maven command-line options, and return a <code>CommandLine</code>
+ * object which may be queried for the presence of flags
+ * and options and their arguments, if any.
+ * </p>
*
- * @throws ParseException If an error occurs while parsing
- * the command-line options.
+ * @param args The command-line arguments to parse.
+ * @return The parsed <code>CommandLine</code> result.
+ * @throws ParseException If an error occurs while parsing
+ * the command-line options.
+ * @see <a href="http://jakarta.apache.org/commons/cli/">CLI</a>
*/
- public static CommandLine parse( String[] args ) throws ParseException
+ public static CommandLine parse( String[] args )
+ throws ParseException
{
CommandLineParser parser = new PosixParser();
return parser.parse( options, args );
}
- /** Display usage information based upon current
- * command-line option configuration.
+ /**
+ * Display usage information based upon current
+ * command-line option configuration.
*/
public static void displayHelp()
{
HelpFormatter formatter = new HelpFormatter();
- formatter.printHelp( "maven [options] [goal [goal2 [goal3] ...]]",
- "\nOptions:",
- options,
- "\n" );
+ formatter.printHelp( "maven [options] [goal [goal2 [goal3] ...]]", "\nOptions:", options, "\n" );
}
- /** Display system information. This is generally useful, maybe
- * this could be made part of CLI? But it definitely shouldn't
- * be stuck in MavenSession.
+ /**
+ * Display system information. This is generally useful, maybe
+ * this could be made part of CLI? But it definitely shouldn't
+ * be stuck in MavenSession.
*/
public static void displayInfo()
{
- Which env = new Which();
- env.doMain( new String[]{} );
+ System.out.println( "----- Environment" );
+ String[] properties = new String[]{"java.version", "file.encoding", "java.ext.dirs", "java.class.path",
+ "os.name", "java.vendor", "sun.boot.class.path", "java.runtime.name"};
+ for ( int i = 0; i < properties.length; i++ )
+ {
+ System.out.println( " " + properties[i] + "=" + System.getProperty( properties[i] ) );
+ }
+ System.out.println( "-----" );
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org