brett 2004/04/22 20:19:28
Modified: src/java/org/apache/maven Tag: MAVEN-1_0-BRANCH
MavenSession.java MavenUtils.java
src/java/org/apache/maven/cli Tag: MAVEN-1_0-BRANCH App.java
src/java/org/apache/maven/jelly Tag: MAVEN-1_0-BRANCH
MavenJellyContext.java
src/java/org/apache/maven/plugin Tag: MAVEN-1_0-BRANCH
PluginManager.java
Log:
o enhancements to maven --info
o display help on submitting a bug report if fatal exception thrown
o resolve relative paths for properties such as maven.repo.local
Revision Changes Path
No revision
No revision
1.18.4.10 +7 -1 maven/src/java/org/apache/maven/MavenSession.java
Index: MavenSession.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/MavenSession.java,v
retrieving revision 1.18.4.9
retrieving revision 1.18.4.10
diff -u -r1.18.4.9 -r1.18.4.10
--- MavenSession.java 21 Apr 2004 08:20:53 -0000 1.18.4.9
+++ MavenSession.java 23 Apr 2004 03:19:28 -0000 1.18.4.10
@@ -22,6 +22,7 @@
import org.apache.maven.project.Project;
import java.io.File;
+import java.util.Collection;
import java.util.List;
import java.util.Set;
@@ -273,6 +274,11 @@
public Set getProjectGoals( Project project ) throws MavenException
{
return pluginManager.getGoalNames( project );
+ }
+
+ public Collection getPluginList()
+ {
+ return pluginManager.getPluginList();
}
}
1.107.4.19 +4 -1 maven/src/java/org/apache/maven/MavenUtils.java
Index: MavenUtils.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/MavenUtils.java,v
retrieving revision 1.107.4.18
retrieving revision 1.107.4.19
diff -u -r1.107.4.18 -r1.107.4.19
--- MavenUtils.java 10 Apr 2004 00:56:43 -0000 1.107.4.18
+++ MavenUtils.java 23 Apr 2004 03:19:28 -0000 1.107.4.19
@@ -784,6 +784,9 @@
// Set the basedir value in the context.
context.setVariable( "basedir", descriptorDirectory.getAbsolutePath() );
+ // deliberately use the original base directory for these variables
+ context.resolveRelativePaths( new File( System.getProperty( "user.dir" ) )
);
+
return context;
}
No revision
No revision
1.37.4.22 +52 -10 maven/src/java/org/apache/maven/cli/App.java
Index: App.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/cli/App.java,v
retrieving revision 1.37.4.21
retrieving revision 1.37.4.22
diff -u -r1.37.4.21 -r1.37.4.22
--- App.java 21 Apr 2004 08:20:53 -0000 1.37.4.21
+++ App.java 23 Apr 2004 03:19:28 -0000 1.37.4.22
@@ -40,6 +40,7 @@
import org.apache.maven.verifier.UnsatisfiedDependencyException;
import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
@@ -54,6 +55,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
@@ -337,15 +339,16 @@
workingDir = dir.getAbsolutePath();
}
- System.setProperty("user.dir", workingDir);
+ System.setProperty( "user.dir", workingDir );
}
// We will assume here that there might not be a project.xml file present
// and we will create the root context from the directory gleaned from
// the user.dir system property.
- MavenJellyContext c = MavenUtils.createContext( new File(
System.getProperty( "user.dir" ) ) );
+ File basedir = new File( System.getProperty( "user.dir" ) );
+ MavenJellyContext c = MavenUtils.createContext( basedir );
setRootContext( c );
- getRootContext().setXMLOutput( output );
+ c.setXMLOutput( output );
// This is just a start at this mode - there'll still be some output
if ( getCli().hasOption( QUIET ) )
@@ -377,12 +380,10 @@
if ( getCli().hasOption( WORK_OFFLINE ) )
{
- //getRootContext().setOnline( Boolean.FALSE );
System.setProperty( MavenConstants.ONLINE, "false" );
}
else
{
- //getRootContext().setOnline( Boolean.TRUE );
System.setProperty( MavenConstants.ONLINE, "true" );
}
}
@@ -457,7 +458,6 @@
initializeMain(args);
displayHelp();
- displayInfo();
displayVersion();
int returnCode = RC_OK;
@@ -473,6 +473,7 @@
{
mavenSession.initialize();
+ displayInfo();
displayProjectHelp();
displayPluginHelp();
@@ -557,12 +558,14 @@
{
e.printStackTrace();
}
+ displayBugReportHelp();
}
- catch ( Exception e )
+ catch ( Throwable t )
{
returnCode = RC_OTHER_FAILURE;
failed = true;
- e.printStackTrace();
+ t.printStackTrace();
+ displayBugReportHelp();
}
if ( !failed )
@@ -664,6 +667,26 @@
}
/**
+ * Display information on how to file a bug report if an unknown error occurs.
+ */
+ private void displayBugReportHelp()
+ {
+ String message = "You have encountered an unknown error running Maven. "
+ + "Please help us to correct this problem by following these simple
steps:\n"
+ + "- read the Maven FAQ at http://maven.apache.org/faq.html\n"
+ + "- run the same command again with the '-e' parameter, eg maven -e
jar\n"
+ + "- search the maven-user archives for the error at\n"
+ + " http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]"
+ + "- post the output of maven -e to JIRA at\n"
+ + " http://jira.codehaus.org/BrowseProject.jspa?id=10030 (you must
sign up first)\n"
+ + "- run 'maven --info' and post the output as the environment to the
bug above\n";
+
+ log.info( "" );
+ log.info( wrapConsoleMessage( message, 0, CONSOLE_WIDTH ) );
+ log.info( "" );
+ }
+
+ /**
* Display the project help if the option is present, then exit
*/
private void displayProjectHelp() throws MavenException
@@ -694,6 +717,22 @@
{
CLIManager.displayInfo();
log.info( "" );
+ log.info( "Installed plugins:" );
+ for ( Iterator i = mavenSession.getPluginList().iterator();
i.hasNext(); )
+ {
+ log.info( " " + i.next() );
+ }
+
+ Properties buildProperties = new Properties();
+ try
+ {
+ buildProperties.load( new FileInputStream( System.getProperty(
"user.home" ) + "/build.properties" ) );
+ }
+ catch ( IOException e )
+ {
+ log.info( "Exception reading build.properties: " + e.getMessage() );
+ }
+ log.info( "Home Build properties: " + buildProperties );
exit( RC_OK );
return;
}
@@ -775,7 +814,10 @@
}
else
{
- rootCause.printStackTrace();
+ if ( getCli().hasOption( DISPLAY_STACKTRACE ) )
+ {
+ rootCause.printStackTrace();
+ }
msg = rootCause.getLocalizedMessage();
if ( msg == null )
No revision
No revision
1.35.4.7 +24 -1 maven/src/java/org/apache/maven/jelly/MavenJellyContext.java
Index: MavenJellyContext.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/jelly/MavenJellyContext.java,v
retrieving revision 1.35.4.6
retrieving revision 1.35.4.7
diff -u -r1.35.4.6 -r1.35.4.7
--- MavenJellyContext.java 14 Apr 2004 00:58:26 -0000 1.35.4.6
+++ MavenJellyContext.java 23 Apr 2004 03:19:28 -0000 1.35.4.7
@@ -32,6 +32,7 @@
import org.apache.maven.jelly.tags.maven.MavenTagLibrary;
import org.apache.maven.project.Project;
+import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
@@ -671,4 +672,26 @@
{
super.setParent(context);
}
+
+ public void resolveRelativePaths( File basedir )
+ {
+ resolveRelativePath( basedir, MavenConstants.REPO_LOCAL );
+ resolveRelativePath( basedir, MavenConstants.MAVEN_UNPACKED_PLUGINS_DIR );
+ resolveRelativePath( basedir, MavenConstants.MAVEN_PLUGINS_DIR );
+ resolveRelativePath( basedir, MavenConstants.MAVEN_HOME_LOCAL );
+ resolveRelativePath( basedir, MavenConstants.MAVEN_HOME );
+ }
+
+ private void resolveRelativePath( File basedir, String var )
+ {
+ String value = ( String ) getVariable( var );
+ File f = new File( value );
+ if ( !f.isAbsolute() )
+ {
+ f = new File( basedir, f.getPath() );
+ log.debug( "Resolving " + var + " to " + f );
+ setVariable( var, f.getAbsolutePath() );
+ }
+ }
}
+
No revision
No revision
1.70.4.40 +13 -1 maven/src/java/org/apache/maven/plugin/PluginManager.java
Index: PluginManager.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/plugin/PluginManager.java,v
retrieving revision 1.70.4.39
retrieving revision 1.70.4.40
diff -u -r1.70.4.39 -r1.70.4.40
--- PluginManager.java 21 Apr 2004 00:33:22 -0000 1.70.4.39
+++ PluginManager.java 23 Apr 2004 03:19:28 -0000 1.70.4.40
@@ -46,6 +46,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -915,6 +916,17 @@
{
JellyScriptHousing housing = mapper.getPluginHousing( goal );
return housing != null ? housing.getProject() : null;
+ }
+
+ public Collection getPluginList()
+ {
+ Collection list = new ArrayList();
+ for ( Iterator i = pluginHousings.values().iterator(); i.hasNext(); )
+ {
+ JellyScriptHousing housing = ( JellyScriptHousing ) i.next();
+ list.add( housing.getName() );
+ }
+ return list;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]