cvs commit: maven/src/java/org/apache/maven MavenUtils.java
brett 2004/12/03 13:40:27 Modified:src/java/org/apache/maven Tag: MAVEN-1_0-BRANCH MavenUtils.java Log: remove TODO, this was already verified Revision ChangesPath No revision No revision 1.107.4.30 +1 -2 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.29 retrieving revision 1.107.4.30 diff -u -r1.107.4.29 -r1.107.4.30 --- MavenUtils.java 3 Dec 2004 20:50:55 - 1.107.4.29 +++ MavenUtils.java 3 Dec 2004 21:40:27 - 1.107.4.30 @@ -252,7 +252,6 @@ project.mergeParent( parent ); } -// TODO: check defaults are also applied to project.xml correctly applyDefaults( context ); // Set the created context, and put the project itself in the context. This - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
brett 2004/11/05 23:27:11 Modified:src/java/org/apache/maven Tag: MAVEN-1_0-BRANCH MavenUtils.java Log: javadoc Revision ChangesPath No revision No revision 1.107.4.28 +2 -2 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.27 retrieving revision 1.107.4.28 diff -u -r1.107.4.27 -r1.107.4.28 --- MavenUtils.java 4 Nov 2004 14:16:24 - 1.107.4.27 +++ MavenUtils.java 6 Nov 2004 07:27:11 - 1.107.4.28 @@ -283,7 +283,7 @@ * @param excludes Patterns to exclude. * @param context the parent context * @return a {link List} of [EMAIL PROTECTED] Project}s - * @throws MavenException when anything goes wrong. FIXME this is bad + * @throws MavenException when anything goes wrong. */ public static List getProjects( File directory, String includes, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
brett 2004/11/04 06:16:24 Modified:src/java/org/apache/maven Tag: MAVEN-1_0-BRANCH MavenUtils.java Log: PR: MAVEN-1422 Submitted by: Eric Lapierre Reviewed by: Brett Porter don't evaluate expressions or parent contexts when integrating each new child Revision ChangesPath No revision No revision 1.107.4.27 +4 -4 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.26 retrieving revision 1.107.4.27 diff -u -r1.107.4.26 -r1.107.4.27 --- MavenUtils.java 4 Nov 2004 13:35:10 - 1.107.4.26 +++ MavenUtils.java 4 Nov 2004 14:16:24 - 1.107.4.27 @@ -18,7 +18,6 @@ */ import com.werken.forehead.ForeheadClassLoader; - import org.apache.commons.betwixt.XMLIntrospector; import org.apache.commons.betwixt.io.BeanReader; import org.apache.commons.betwixt.io.BeanWriter; @@ -44,7 +43,6 @@ import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParserFactory; - import java.beans.IntrospectionException; import java.io.ByteArrayOutputStream; import java.io.File; @@ -823,7 +821,9 @@ String key = (String) i.next(); Object value; -if ( context.getVariable( key ) == null ) +// Parent contexts are already handled, so only concern ourselves with whether it exists in the current +// context +if ( context.getVariables().get( key ) == null ) { value = map.get( key ); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
brett 2004/11/04 05:35:10 Modified:src/java/org/apache/maven Tag: MAVEN-1_0-BRANCH MavenUtils.java Log: PR: MAVEN-1404 stop erroneous classcastexception in log Revision ChangesPath No revision No revision 1.107.4.26 +17 -14maven/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.25 retrieving revision 1.107.4.26 diff -u -r1.107.4.25 -r1.107.4.26 --- MavenUtils.java 30 Oct 2004 11:14:13 - 1.107.4.25 +++ MavenUtils.java 4 Nov 2004 13:35:10 - 1.107.4.26 @@ -827,24 +827,27 @@ { value = map.get( key ); -try +if ( value instanceof String ) { -String literalValue = (String) value; -Expression expr = CompositeExpression.parse( literalValue, factory ); - -if ( expr != null ) +try { -value = expr; +String literalValue = (String) value; +Expression expr = CompositeExpression.parse( literalValue, factory ); + +if ( expr != null ) +{ +value = expr; +} +else +{ +value = literalValue; +} } -else +catch ( Exception e ) { -value = literalValue; +// do nothing. +log.debug( "Unexpected error evaluating expression", e ); } -} -catch ( Exception e ) -{ -// do nothing. -log.debug( "Unexpected error evaluating expression", e ); } context.setVariable( key, value ); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
vmassol 2004/07/19 06:48:58 Modified:src/java/org/apache/maven Tag: MAVEN-1_0-BRANCH MavenUtils.java Log: Fixed MAVEN-1380 Revision ChangesPath No revision No revision 1.107.4.23 +2 -2 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.22 retrieving revision 1.107.4.23 diff -u -r1.107.4.22 -r1.107.4.23 --- MavenUtils.java 6 Jul 2004 12:23:41 - 1.107.4.22 +++ MavenUtils.java 19 Jul 2004 13:48:58 - 1.107.4.23 @@ -205,7 +205,7 @@ } catch (Exception e) { -throw new MavenException("Error parsing project.xml '" + projectDescriptor.getAbsolutePath() + "'"); +throw new MavenException("Error parsing project.xml '" + projectDescriptor.getAbsolutePath() + "'", e); } // 2) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
brett 2004/07/06 05:23:41 Modified:src/java/org/apache/maven Tag: MAVEN-1_0-BRANCH MavenUtils.java Log: PR: MAVEN-1296 Submitted by: Eric Lapierre Reviewed by: Brett Porter fix for property inheritence in some circumstances Revision ChangesPath No revision No revision 1.107.4.22 +3 -5 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.21 retrieving revision 1.107.4.22 diff -u -r1.107.4.21 -r1.107.4.22 --- MavenUtils.java 26 Jun 2004 14:52:05 - 1.107.4.21 +++ MavenUtils.java 6 Jul 2004 12:23:41 - 1.107.4.22 @@ -236,10 +236,8 @@ context.setParent( parent.getContext() ); } -Properties properties = loadProjectBuildProperties( parentPom.getParentFile() ); -integrateMapInContext( properties, context ); -properties = loadProjectProperties( parentPom.getParentFile() ); -integrateMapInContext( properties, context ); +// Map in the parent context which already has the properties loaded +integrateMapInContext( parent.getContext().getVariables(), context ); project.mergeParent( parent ); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
brett 2004/04/09 17:56:43 Modified:src/java/org/apache/maven Tag: MAVEN-1_0-BRANCH MavenUtils.java Log: trim properties Revision ChangesPath No revision No revision 1.107.4.18 +8 -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.17 retrieving revision 1.107.4.18 diff -u -r1.107.4.17 -r1.107.4.18 --- MavenUtils.java 4 Apr 2004 02:48:03 - 1.107.4.17 +++ MavenUtils.java 10 Apr 2004 00:56:43 - 1.107.4.18 @@ -873,6 +873,13 @@ { Properties properties = new Properties(); properties.load( is ); + +for ( Iterator i = properties.keySet().iterator(); i.hasNext(); ) +{ +String property = ( String ) i.next(); +properties.setProperty( property, properties.getProperty( property ).trim() ); +} + return properties; } catch ( IOException e ) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
brett 2004/04/03 18:48:03 Modified:src/java/org/apache/maven Tag: MAVEN-1_0-BRANCH MavenUtils.java Log: PR: MAVEN-1050 Submitted by: Shinsuke SUGAYA Use system file encoding for POM Revision ChangesPath No revision No revision 1.107.4.17 +3 -11 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.16 retrieving revision 1.107.4.17 diff -u -r1.107.4.16 -r1.107.4.17 --- MavenUtils.java 2 Apr 2004 23:37:19 - 1.107.4.16 +++ MavenUtils.java 4 Apr 2004 02:48:03 - 1.107.4.17 @@ -81,9 +81,6 @@ /** Log. */ private static final Log log = LogFactory.getLog( MavenUtils.class ); -/** Internal encoding used for Jelly interpolation. */ -private static final String INTERNAL_ENCODING = "ISO-8859-1"; - /** we want to parse something */ private static final ThreadLocal xmlReaderPool = new ThreadLocal(); @@ -423,10 +420,7 @@ beanWriter.setWriteIDs( true ); beanWriter.write( project ); -// We do not care what the original encoding was originally. This -// is all completely internal. Our StringInputStream requires -// everything to be encoded in "ISO-8859-1". -return projectStream.toString( INTERNAL_ENCODING ); +return projectStream.toString( System.getProperty( "file.encoding" ) ); } /** @@ -718,7 +712,7 @@ * @return The generated maven based on the contents of the standard maven * properties files. */ -public static MavenJellyContext createContext( File descriptorDirectory, +public static MavenJellyContext createContext( File descriptorDirectory, MavenJellyContext parentContext ) { // System properties @@ -758,8 +752,6 @@ // child's context values into the jelly context because we want the // child values to win and only use the parent in the event the // child cannot provide the value. - - // TODO: need an exception for those specified on the command line if ( parentContext != null ) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
brett 2004/04/02 15:37:19 Modified:src/java/org/apache/maven Tag: MAVEN-1_0-BRANCH MavenUtils.java Log: PR: MAVEN-1205 remove function unused, and would cause ClassCastException if used Revision ChangesPath No revision No revision 1.107.4.16 +5 -7 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.15 retrieving revision 1.107.4.16 diff -u -r1.107.4.15 -r1.107.4.16 --- MavenUtils.java 28 Mar 2004 21:27:26 - 1.107.4.15 +++ MavenUtils.java 2 Apr 2004 23:37:19 - 1.107.4.16 @@ -33,7 +33,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.maven.jelly.JellyUtils; -import org.apache.maven.jelly.MavenExpressionFactory; import org.apache.maven.jelly.MavenJellyContext; import org.apache.maven.project.BaseObject; import org.apache.maven.project.Project; @@ -97,9 +96,6 @@ /** Project Bean Reader */ private static BeanReader projectBeanReader; -/** Maven Expression Factory. */ -private static MavenExpressionFactory mavenExpressionFactory = new MavenExpressionFactory(); - /** Map of loaded POMs. */ private static HashMap parentPoms = new HashMap(); @@ -225,7 +221,7 @@ // We must look in the element for expressions that may be present as // // ../project.xml -Expression e = JellyUtils.decomposeExpression( pomToExtend, mavenExpressionFactory, context ); +Expression e = JellyUtils.decomposeExpression( pomToExtend, context ); pomToExtend = e.evaluateAsString( context ); pomToExtend = MavenUtils.makeAbsolutePath( projectDescriptor.getParentFile(), pomToExtend ); project.setExtend( pomToExtend ); @@ -377,7 +373,7 @@ throws IOException, SAXException, IntrospectionException, ParserConfigurationException { String projectString = getProjectString(project); -Expression e = JellyUtils.decomposeExpression( projectString, mavenExpressionFactory, context ); +Expression e = JellyUtils.decomposeExpression( projectString, context ); String newProjectString = e.evaluateAsString( context ); project = (Project) getProjectBeanReader().parse( new StringReader( newProjectString ) ); return project; @@ -762,6 +758,8 @@ // child's context values into the jelly context because we want the // child values to win and only use the parent in the event the // child cannot provide the value. + + // TODO: need an exception for those specified on the command line if ( parentContext != null ) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
brett 2004/03/06 16:01:29 Modified:src/java/org/apache/maven Tag: MAVEN-1_0-BRANCH MavenUtils.java Log: show classloader name Revision ChangesPath No revision No revision 1.107.4.12 +3 -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.11 retrieving revision 1.107.4.12 diff -u -r1.107.4.11 -r1.107.4.12 --- MavenUtils.java 1 Mar 2004 22:36:36 - 1.107.4.11 +++ MavenUtils.java 7 Mar 2004 00:01:29 - 1.107.4.12 @@ -1040,6 +1040,8 @@ */ public static void displayClassLoaderContents( ForeheadClassLoader classLoader ) { +System.out.println( "ClassLoader name: " + classLoader.getName() ); + URL[] urls = classLoader.getURLs(); for ( int i = 0; i < urls.length; i++ ) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
brett 2004/02/26 08:10:27 Modified:src/java/org/apache/maven Tag: MAVEN-1_0-BRANCH MavenUtils.java Log: fix possible NPE in reactor Revision ChangesPath No revision No revision 1.107.4.10 +2 -2 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.9 retrieving revision 1.107.4.10 diff -u -r1.107.4.9 -r1.107.4.10 --- MavenUtils.java 19 Feb 2004 23:28:31 - 1.107.4.9 +++ MavenUtils.java 26 Feb 2004 16:10:27 - 1.107.4.10 @@ -242,7 +242,7 @@ Project parent = (Project) parentPoms.get( parentPom.getCanonicalPath() ); if ( parent == null ) { -parent = getNonJellyProject( parentPom, null, true ); +parent = getNonJellyProject( parentPom, parentContext, true ); parent.setFile( parentPom ); parentPoms.put( parentPom.getCanonicalPath(), parent ); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
brett 2004/02/07 13:47:11 Modified:src/java/org/apache/maven Tag: MAVEN-1_0-BRANCH MavenUtils.java Log: reinstate useful debugging function Revision ChangesPath No revision No revision 1.107.4.8 +26 -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.7 retrieving revision 1.107.4.8 diff -u -r1.107.4.7 -r1.107.4.8 --- MavenUtils.java 26 Jan 2004 23:36:08 - 1.107.4.7 +++ MavenUtils.java 7 Feb 2004 21:47:10 - 1.107.4.8 @@ -56,6 +56,7 @@ * */ +import com.werken.forehead.ForeheadClassLoader; import org.apache.commons.betwixt.XMLIntrospector; import org.apache.commons.betwixt.io.BeanReader; import org.apache.commons.betwixt.io.BeanWriter; @@ -87,6 +88,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.StringReader; +import java.net.URL; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -1066,4 +1068,27 @@ } return goals; } + +/** + * Debugging function. + * @param project + * @param classLoader + */ +public static void displayClassLoaderContents( ForeheadClassLoader classLoader ) +{ +URL[] urls = classLoader.getURLs(); + +for ( int i = 0; i < urls.length; i++ ) +{ +System.out.println( "urls[" + i + "] = " + urls[i] ); +} + +ClassLoader parent = classLoader.getParent(); +if ( parent != null && parent instanceof ForeheadClassLoader ) +{ +System.out.println( "Displaying Parent classloader: " ); +displayClassLoaderContents( ( ForeheadClassLoader ) classLoader.getParent()); +} +} + } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
dion2004/01/07 08:28:03 Modified:src/java/org/apache/maven Tag: MAVEN-1_0-BRANCH MavenUtils.java Log: Code cleanup Revision ChangesPath No revision No revision 1.107.4.6 +7 -7 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.5 retrieving revision 1.107.4.6 diff -u -r1.107.4.5 -r1.107.4.6 --- MavenUtils.java 6 Jan 2004 08:07:03 - 1.107.4.5 +++ MavenUtils.java 7 Jan 2004 16:28:03 - 1.107.4.6 @@ -166,7 +166,7 @@ /** * Create a Project object given a file descriptor and optionally a parent Jelly - * context. + * context. * * @param projectDescriptor a maven project.xml [EMAIL PROTECTED] File} * @param parentContext the parent context for the new project @@ -352,10 +352,10 @@ project.setContext( null ); Project parent = project.getParent(); project.setParent( null ); - + // Interpolate project = getInterpolatedPOM(project, context); - + // Restore parent and context project.setParent( parent ); project.setContext( originalContext ); @@ -777,7 +777,7 @@ // Set the basedir value in the context. context.setVariable( "basedir", descriptorDirectory.getAbsolutePath() ); - + return context; } @@ -819,7 +819,7 @@ { value = literalValue; } - + context.setVariable( key, value ); } catch ( Exception e ) @@ -1061,7 +1061,7 @@ { StringTokenizer tok = new StringTokenizer( goalCsv, "," ); List goals = new ArrayList(); -while ( tok.hasMoreTokens() ) +while ( tok.hasMoreTokens() ) { goals.add( tok.nextToken() ); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
brett 2003/12/30 17:32:36 Modified:src/java/org/apache/maven Tag: MAVEN-1_0-BRANCH MavenUtils.java Log: cleanup project creation, make inheritence work Revision ChangesPath No revision No revision 1.107.4.4 +49 -42maven/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.3 retrieving revision 1.107.4.4 diff -u -r1.107.4.3 -r1.107.4.4 --- MavenUtils.java 10 Dec 2003 23:08:44 - 1.107.4.3 +++ MavenUtils.java 31 Dec 2003 01:32:36 - 1.107.4.4 @@ -115,7 +115,7 @@ public class MavenUtils { /** Log. */ -private static final Log logger = LogFactory.getLog( MavenUtils.class ); +private static final Log log = LogFactory.getLog( MavenUtils.class ); /** Internal encoding used for Jelly interpolation. */ private static final String INTERNAL_ENCODING = "ISO-8859-1"; @@ -166,7 +166,32 @@ /** * Create a Project object given a file descriptor and optionally a parent Jelly - * context. We are doing several things when creating a POM object, the phases + * context. + * + * @param projectDescriptor a maven project.xml [EMAIL PROTECTED] File} + * @param parentContext the parent context for the new project + * @param useParentPom whether a parent project should be respected + * @return the MavenSession project object for the given project descriptor + * @throws Exception when any errors occur - TODO [RC2] bad + */ +public static Project getProject( File projectDescriptor, + MavenJellyContext parentContext, + boolean useParentPom ) +throws Exception +{ +Project project = getNonJellyProject( projectDescriptor, parentContext, useParentPom ); +project = getJellyProject( project ); +project.setFile( projectDescriptor ); + +// Fully initialize the project. +project.initialize(); + +return project; +} + +/** + * Get a project, but not a Jelly-ised project. ie Don't evaluate the + * variables. We are doing several things when creating a POM object, the phases * are outlined here: * * 1) The project.xml file is read in using betwixt which creates for us a @@ -177,33 +202,27 @@ *own context. See the createContext() method for the details context creation *process. * - * 3) We check to see if the tag is being employed. If so, the parent + * 3) We check to see if thetag is being employed. If so, the parent *project.xml file is read in. At this point we have a child and parent POM *and the values are merged where the child's values override those of the *parent. - * - * 4) The POM we have at this point is then processed through Jelly. - * - * @todo should cache all project xml files with the right context , merged down to the leafs in inheritence - * @param projectDescriptor a maven project.xml [EMAIL PROTECTED] File} + * @param projectDescriptor the project file * @param parentContext the parent context for the new project * @param useParentPom whether a parent project should be respected - * @return the MavenSession project object for the given project descriptor - * @throws Exception when any errors occur + * @return the project + * @throws Exception when any errors occur - TODO [RC2] bad */ -public static Project getProject( File projectDescriptor, - MavenJellyContext parentContext, - boolean useParentPom ) +private static Project getNonJellyProject( File projectDescriptor, + MavenJellyContext parentContext, + boolean useParentPom ) throws Exception { -//if ( pom.get()) - // 1) Project project = (Project) getProjectBeanReader().parse( projectDescriptor ); // 2) -MavenJellyContext context = MavenUtils.createContext( projectDescriptor.getParentFile(), - parentContext ); +MavenJellyContext context = MavenUtils.createContext( projectDescriptor.getParentFile(), parentContext ); + // 3) String pomToExtend = project.getExtend(); @@ -222,15 +241,11 @@ Project parent = (Project) parentPoms.get( parentPom.getCanonicalPath() ); if ( par
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
dion2003/10/16 18:08:02 Modified:src/java/org/apache/maven MavenUtils.java Log: style Revision ChangesPath 1.107 +2 -2 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.106 retrieving revision 1.107 diff -u -r1.106 -r1.107 --- MavenUtils.java 16 Oct 2003 08:53:42 - 1.106 +++ MavenUtils.java 17 Oct 2003 01:08:02 - 1.107 @@ -1094,7 +1094,7 @@ String canonicalBasedir = basedir.getCanonicalPath(); String canonicalPath = new File( path ).getCanonicalPath(); -if ( canonicalPath.equals(canonicalBasedir)) +if ( canonicalPath.equals(canonicalBasedir) ) { return "."; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
dion2003/10/16 01:53:42 Modified:src/test/java/org/apache/maven MavenUtilsTest.java src/java/org/apache/maven MavenUtils.java Log: handle path == basedir for makeRelativePath Revision ChangesPath 1.14 +4 -1 maven/src/test/java/org/apache/maven/MavenUtilsTest.java Index: MavenUtilsTest.java === RCS file: /home/cvs/maven/src/test/java/org/apache/maven/MavenUtilsTest.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- MavenUtilsTest.java 20 Aug 2003 00:18:53 - 1.13 +++ MavenUtilsTest.java 16 Oct 2003 08:53:42 - 1.14 @@ -303,5 +303,8 @@ new File( basedir + "/src/test/basedir/project.xml" ).getCanonicalPath() ) ); assertEquals( "Check absolute path outside basedir", new File( "/www/docs/index.html" ).getCanonicalPath(), MavenUtils.makeRelativePath( basedirFile, new File( "/www/docs/index.html" ).getCanonicalPath() ) ); + +assertEquals( "Check absolute path == basedir", ".", + MavenUtils.makeRelativePath( basedirFile, basedir ) ); } } 1.106 +7 -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.105 retrieving revision 1.106 diff -u -r1.105 -r1.106 --- MavenUtils.java 4 Sep 2003 00:36:04 - 1.105 +++ MavenUtils.java 16 Oct 2003 08:53:42 - 1.106 @@ -1093,6 +1093,12 @@ { String canonicalBasedir = basedir.getCanonicalPath(); String canonicalPath = new File( path ).getCanonicalPath(); + +if ( canonicalPath.equals(canonicalBasedir)) +{ +return "."; +} + if ( canonicalPath.startsWith( canonicalBasedir ) ) { if ( canonicalPath.charAt( canonicalBasedir.length() ) == File.separatorChar ) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
dion2003/09/03 17:36:04 Modified:src/java/org/apache/maven MavenUtils.java Log: Fix tabs Revision ChangesPath 1.105 +4 -4 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.104 retrieving revision 1.105 diff -u -r1.104 -r1.105 --- MavenUtils.java 2 Sep 2003 12:55:12 - 1.104 +++ MavenUtils.java 4 Sep 2003 00:36:04 - 1.105 @@ -826,13 +826,13 @@ context = new MavenJellyContext(); //integrate everything else... -MavenUtils.integrateMapInContext( result, context ); +MavenUtils.integrateMapInContext( result, context ); //integrate defaults... MavenUtils.integrateMapInContext( defaultProperties, context ); -// Turn inheritance back on to make the parent's values visible. -context.setInherit( true ); +// Turn inheritance back on to make the parent's values visible. +context.setInherit( true ); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
evenisse2003/09/02 03:28:28 Modified:src/java/org/apache/maven MavenUtils.java Log: Fix documentation. Revision ChangesPath 1.103 +2 -3 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.102 retrieving revision 1.103 diff -u -r1.102 -r1.103 --- MavenUtils.java 1 Sep 2003 06:56:58 - 1.102 +++ MavenUtils.java 2 Sep 2003 10:28:28 - 1.103 @@ -209,9 +209,8 @@ if ( pomToExtend != null && useParentPom ) { // We must look in the element for expressions that may be present as -// we encourage the use of ${basedir} using extension: // -// ${basedir}/../project.xml +// ../project.xml Expression e = JellyUtils.decomposeExpression( pomToExtend, mavenExpressionFactory, context ); pomToExtend = e.evaluateAsString( context ); pomToExtend = MavenUtils.makeAbsolutePath( projectDescriptor.getParentFile(), pomToExtend ); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
dion2003/08/31 23:56:58 Modified:src/java/org/apache/maven MavenUtils.java Log: Remove local variable Revision ChangesPath 1.102 +3 -4 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.101 retrieving revision 1.102 diff -u -r1.101 -r1.102 --- MavenUtils.java 1 Sep 2003 05:34:08 - 1.101 +++ MavenUtils.java 1 Sep 2003 06:56:58 - 1.102 @@ -198,8 +198,7 @@ //if ( pom.get()) // 1) -BeanReader beanReader = getProjectBeanReader(); -Project project = (Project) beanReader.parse( projectDescriptor ); +Project project = (Project) getProjectBeanReader().parse( projectDescriptor ); // 2) MavenJellyContext context = MavenUtils.createContext( projectDescriptor.getParentFile(), @@ -223,7 +222,7 @@ Project parent = (Project) parentPoms.get( parentPom.getCanonicalPath() ); if ( parent == null ) { -parent = (Project) beanReader.parse( parentPom ); +parent = (Project) getProjectBeanReader().parse( parentPom ); if ( parent != null ) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
dion2003/08/31 22:34:08 Modified:src/java/org/apache/maven MavenUtils.java Log: rename local variable to not hide outer one Revision ChangesPath 1.101 +4 -4 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.100 retrieving revision 1.101 diff -u -r1.100 -r1.101 --- MavenUtils.java 1 Sep 2003 00:34:40 - 1.100 +++ MavenUtils.java 1 Sep 2003 05:34:08 - 1.101 @@ -198,8 +198,8 @@ //if ( pom.get()) // 1) -BeanReader projectBeanReader = getProjectBeanReader(); -Project project = (Project) projectBeanReader.parse( projectDescriptor ); +BeanReader beanReader = getProjectBeanReader(); +Project project = (Project) beanReader.parse( projectDescriptor ); // 2) MavenJellyContext context = MavenUtils.createContext( projectDescriptor.getParentFile(), @@ -223,7 +223,7 @@ Project parent = (Project) parentPoms.get( parentPom.getCanonicalPath() ); if ( parent == null ) { -parent = (Project) projectBeanReader.parse( parentPom ); +parent = (Project) beanReader.parse( parentPom ); if ( parent != null ) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
dion2003/08/31 17:34:40 Modified:src/java/org/apache/maven MavenUtils.java Log: Change POM interpolation from compiling as a script to evaluating as an expression. This saves around 40M on bootstrapping. Checkstyle fixes. Revision ChangesPath 1.100 +72 -38maven/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.99 retrieving revision 1.100 diff -u -r1.99 -r1.100 --- MavenUtils.java 19 Aug 2003 04:31:38 - 1.99 +++ MavenUtils.java 1 Sep 2003 00:34:40 - 1.100 @@ -65,8 +65,6 @@ import org.apache.commons.digester.ExtendedBaseRules; import org.apache.commons.digester.Rule; import org.apache.commons.jelly.JellyContext; -import org.apache.commons.jelly.Script; -import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.expression.CompositeExpression; import org.apache.commons.jelly.expression.Expression; import org.apache.commons.jelly.expression.jexl.JexlExpressionFactory; @@ -80,18 +78,16 @@ import org.apache.maven.project.Project; import org.apache.maven.util.StringInputStream; import org.apache.tools.ant.DirectoryScanner; +import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import javax.xml.parsers.SAXParserFactory; -import java.io.BufferedWriter; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.io.OutputStreamWriter; import java.io.StringReader; -import java.io.Writer; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -140,7 +136,7 @@ private static HashMap parentPoms = new HashMap(); /** - * Create a Project object given a name a file descriptor. + * Create a Project object given a file descriptor. * * @param projectDescriptor a maven project.xml * @return the Maven project object for the given project descriptor @@ -152,6 +148,13 @@ return getProject( projectDescriptor, null ); } +/** + * Create a Project object given a file descriptor, and a parent context + * @param projectDescriptor The file to create the project from + * @param parentContext the parent Maven Jelly Context + * @return a new Project + * @throws Exception when any error happens. FIXME + */ public static Project getProject( File projectDescriptor, MavenJellyContext parentContext ) throws Exception { @@ -182,6 +185,8 @@ *the project itself. * * @param projectDescriptor a maven project.xml [EMAIL PROTECTED] File} + * @param parentContext the parent context for the new project + * @param useParentPom whether a parent project should be respected * @return the MavenSession project object for the given project descriptor * @throws Exception when any errors occur */ @@ -211,6 +216,7 @@ Expression e = JellyUtils.decomposeExpression( pomToExtend, mavenExpressionFactory, context ); pomToExtend = e.evaluateAsString( context ); pomToExtend = MavenUtils.makeAbsolutePath( projectDescriptor.getParentFile(), pomToExtend ); +project.setExtend( pomToExtend ); File parentPom = new File( pomToExtend ); @@ -255,6 +261,7 @@ * * @param directory the directory to scan for maven projects * @param includes the pattern that matches a project + * @param context the parent context * @return a {link List} of [EMAIL PROTECTED] Project}s * @throws Exception when anything goes wrong. FIXME this is bad */ @@ -270,6 +277,7 @@ * @param directory the directory to scan for maven projects * @param includes Patterns to include. * @param excludes Patterns to exclude. + * @param context the parent context * @return a {link List} of [EMAIL PROTECTED] Project}s * @throws Exception when anything goes wrong. FIXME this is bad */ @@ -335,22 +343,8 @@ // We don't want the context being written out into the XML which // is the interpolated POM. project.setContext( null ); -Script script = JellyUtils.compileScript( getProjectInputStream( project ), - context, - INTERNAL_ENCODING ); - -// Now run the script against the fully populated context so all the -// values are filled in correctly. -ByteArrayOutputStream baos = new ByteArrayOutputStream(); -Writer writer = new BufferedWriter( new OutputS
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
dion2003/08/05 22:05:23 Modified:src/java/org/apache/maven MavenUtils.java Log: Update copyright Revision ChangesPath 1.98 +2 -2 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.97 retrieving revision 1.98 diff -u -r1.97 -r1.98 --- MavenUtils.java 29 Jul 2003 01:04:36 - 1.97 +++ MavenUtils.java 6 Aug 2003 05:05:23 - 1.98 @@ -3,7 +3,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
dion2003/08/12 23:37:43 Modified:src/java/org/apache/maven Tag: MAVEN_RC1_STABLE MavenUtils.java Log: Fix typo Revision ChangesPath No revision No revision 1.94.2.3 +2 -2 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.94.2.2 retrieving revision 1.94.2.3 diff -u -r1.94.2.2 -r1.94.2.3 --- MavenUtils.java 11 Aug 2003 06:16:11 - 1.94.2.2 +++ MavenUtils.java 13 Aug 2003 06:37:43 - 1.94.2.3 @@ -143,7 +143,7 @@ * Create a Project object given a name a file descriptor. * * @param projectDescriptor a maven project.xml - * @return the MavenSession project object for the given project descriptor + * @return the Maven project object for the given project descriptor * @throws Exception when any errors occur */ public static Project getProject( File projectDescriptor ) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
dion2003/07/28 18:04:37 Modified:src/java/org/apache/maven MavenUtils.java Log: Add debug messages with silly project.xml files Revision ChangesPath 1.97 +12 -2 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.96 retrieving revision 1.97 diff -u -r1.96 -r1.97 --- MavenUtils.java 29 Jul 2003 00:17:50 - 1.96 +++ MavenUtils.java 29 Jul 2003 01:04:36 - 1.97 @@ -80,6 +80,7 @@ import org.apache.maven.util.StringInputStream; import org.apache.plexus.util.DirectoryScanner; import org.apache.plexus.util.StringUtils; +import org.xmlpull.v1.XmlPullParserException; /** * Utilities for reading maven project descriptors, profile descriptors and @@ -124,7 +125,16 @@ { // 1) FileReader pfr = new FileReader( projectDescriptor ); -Project project = unmarshaller.parse( pfr ); +Project project = null; +try +{ +project = unmarshaller.parse( pfr ); +} +catch (XmlPullParserException e) +{ +System.err.println("Error reading file: " + projectDescriptor); +throw e; +} pfr.close(); // 2) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
dion2003/07/28 17:17:50 Modified:src/java/org/apache/maven MavenUtils.java Log: Reorg improts Revision ChangesPath 1.96 +8 -10 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.95 retrieving revision 1.96 diff -u -r1.95 -r1.96 --- MavenUtils.java 27 Jul 2003 23:33:56 - 1.95 +++ MavenUtils.java 29 Jul 2003 00:17:50 - 1.96 @@ -56,12 +56,6 @@ * */ -import org.apache.commons.collections.CollectionUtils; -import org.apache.maven.project.Project; -import org.apache.maven.util.StringInputStream; -import org.apache.plexus.util.DirectoryScanner; -import org.apache.plexus.util.StringUtils; - import java.io.File; import java.io.FileInputStream; import java.io.FileReader; @@ -69,8 +63,6 @@ import java.io.InputStream; import java.io.StringReader; import java.io.StringWriter; -import java.io.Writer; -import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -83,6 +75,12 @@ import java.util.ResourceBundle; import java.util.Set; +import org.apache.commons.collections.CollectionUtils; +import org.apache.maven.project.Project; +import org.apache.maven.util.StringInputStream; +import org.apache.plexus.util.DirectoryScanner; +import org.apache.plexus.util.StringUtils; + /** * Utilities for reading maven project descriptors, profile descriptors and * workspace descriptors. @@ -134,7 +132,7 @@ // We do not want to do POM interpolation in properties files but maven.final.name is // baked into the driver.properties file. So we'll leave its default value but we will -// place the real value in here because we are not interpolatin the POM into roperties. +// place the real value in here because we are not interpolating the POM into properties. String mavenFinalName = (String) properties.get( "maven.final.name" ); if ( mavenFinalName.indexOf( "${" ) >= 0 ) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: maven/src/java/org/apache/maven MavenUtils.java
dion2003/03/24 05:55:28 Modified:src/java/org/apache/maven MavenUtils.java Log: Remove deprecated digester and betwixt methods Revision ChangesPath 1.91 +4 -5 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.90 retrieving revision 1.91 diff -u -r1.90 -r1.91 --- MavenUtils.java 8 Mar 2003 02:31:36 - 1.90 +++ MavenUtils.java 24 Mar 2003 13:55:28 - 1.91 @@ -591,7 +591,6 @@ XMLIntrospector introspector = new XMLIntrospector(); introspector.setAttributesForPrimitives( false ); -introspector.setCachingEnabled( true ); introspector.setElementNameMapper( new DecapitalizeNameMapper() ); return introspector; @@ -950,10 +949,10 @@ * @param value body * @throws Exception when any errors occur */ -public void body( String value ) +public void body(String namespace, String name, String text) throws Exception { -this.value = value; +this.value = text; } /** @@ -961,7 +960,7 @@ * * @throws Exception when any errors occur */ -public void end() +public void end(String namespace, String elementName) throws Exception { BaseObject baseObject = (BaseObject) getDigester().peek(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]