Re: MavenUtil.getProject()

2004-10-15 Thread Brett Porter
That call is going to rely heavily on the corect construction of a
jelly context so that it can attempt to evaluate values. Maybe some
values are not being substituted?

What are the dependencies in the project.xml? It seems one of them is malformed.

The differences between 1.3 and 1.4 would just be the xml parser. The
xml parsers must be endorsed and in the root classpath in 1.4 to take
effect and override the default built-in xml parser. It doesn't appear
to be the problem here - and you may not actuially need xerces if you
are going to run under 1.4 every time.

- Brett


On Wed, 13 Oct 2004 21:06:32 +0200, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Here is a challenging question for the Maven architects.
 
 In my project i want to make persistent the POM in order to achieve that I
 need an in memory representation of the Project, instead of writing my own
 POM parser I decided to use the util class provided in Maven, specifically
 the public static method available at org.apache.maven.MavenUtil
 
  But the same POM that works normally in Maven when used in its proper
 environment fails when i use the API directly from my program:
 
 That is an example:
 
   137860|DEBUG|[sports : 1]|srzfhe|ache.commons.digester.Digester -
 bodyText='sje'
   137860|DEBUG|[sports : 1]|srzfhe|ache.commons.digester.Digester -   Fire
 body() for [EMAIL PROTECTED]
   137860|DEBUG|[sports : 1]|srzfhe|commons.beanutils.ConvertUtils - Convert
 string 'sje' to class 'java.lang.String'
   137860|DEBUG|[sports : 1]|srzfhe|commons.beanutils.ConvertUtils -   Using
 converter [EMAIL PROTECTED]
   137860|ERROR|[sports : 1]|srzfhe|ache.commons.digester.Digester - Body
 event threw exception
 java.lang.IllegalStateException: either id or (groupId and artifactId) must
 be provided for a dependency
   at org.apache.maven.project.Dependency.getId(Dependency.java:116)
   at org.apache.maven.project.Dependency.toString(Dependency.java:313)
   at java.lang.String.valueOf(String.java(Inlined Compiled Code))
   at java.lang.StringBuffer.append(StringBuffer.java(Compiled Code))
   at
 org.apache.commons.betwixt.expression.MethodUpdater.update(MethodUpdater.java:135)
   at
 org.apache.commons.betwixt.io.BeanCreateRule$1.body(BeanCreateRule.java:584)
   at org.apache.commons.digester.Rule.body(Rule.java:240)
   at
 org.apache.commons.digester.Digester.endElement(Digester.java:1034)
   at
 org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java(Compiled
  Code))
   at
 org.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(XMLNamespaceBinder.java(Compiled
  Code))
   at
 org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java(Compiled
  Code))
   at
 org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java(Compiled
  Code))
   at
 org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java(Compiled
  Code))
   at
 org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.handleEndElement(XMLDocumentFragmentScannerImpl.java(Compiled
  Code))
   at
 org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java(Compiled
  Code))
   at
 org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java(Compiled
  Code))
   at
 org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)
   at
 org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:525)
   at
 org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:581)
   at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
   at
 org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1158)
   at org.apache.commons.digester.Digester.parse(Digester.java:1527)
   at
 org.apache.maven.MavenUtils.getNonJellyProject(MavenUtils.java:183)
   at org.apache.maven.MavenUtils.getProject(MavenUtils.java:144)
   at org.apache.maven.MavenUtils.getProject(MavenUtils.java:126)
   at org.apache.maven.MavenUtils.getProject(MavenUtils.java:113)
   at
 com.swissre.d08.commons.pom.D08CommonsPom.getProject(D08CommonsPom.java:81)
   at
 com.swissre.d08.business.impl.D08BusinessLogicImpl.validate(D08BusinessLogicImpl.java:1449)
   at java.lang.reflect.Method.invoke(Native Method)
   at
 com.swissre.d08.business.D08BusinessLogicFactory$1.invoke(D08BusinessLogicFactory.java:75)
 
 The first consideration, it goes into the way the parsing mechanism happens
 in Maven, and the role that the endorsed jars (xerses-2.4.0,
 xml-apis-1.0.b2.jar ) have in the construction of the classpath in normal
 usage of maven. I can only have a those classes in the classpath. If anyone
 wants to spend some explanation on that it will make my job easier.
 
 The second is the role of the jdk, can 

MavenUtil.getProject()

2004-10-13 Thread Michele_Forte
Here is a challenging question for the Maven architects.

In my project i want to make persistent the POM in order to achieve that I
need an in memory representation of the Project, instead of writing my own
POM parser I decided to use the util class provided in Maven, specifically
the public static method available at org.apache.maven.MavenUtil

 But the same POM that works normally in Maven when used in its proper
environment fails when i use the API directly from my program:

That is an example:

  137860|DEBUG|[sports : 1]|srzfhe|ache.commons.digester.Digester -
bodyText='sje'
  137860|DEBUG|[sports : 1]|srzfhe|ache.commons.digester.Digester -   Fire
body() for [EMAIL PROTECTED]
  137860|DEBUG|[sports : 1]|srzfhe|commons.beanutils.ConvertUtils - Convert
string 'sje' to class 'java.lang.String'
  137860|DEBUG|[sports : 1]|srzfhe|commons.beanutils.ConvertUtils -   Using
converter [EMAIL PROTECTED]
  137860|ERROR|[sports : 1]|srzfhe|ache.commons.digester.Digester - Body
event threw exception
java.lang.IllegalStateException: either id or (groupId and artifactId) must
be provided for a dependency
  at org.apache.maven.project.Dependency.getId(Dependency.java:116)
  at org.apache.maven.project.Dependency.toString(Dependency.java:313)
  at java.lang.String.valueOf(String.java(Inlined Compiled Code))
  at java.lang.StringBuffer.append(StringBuffer.java(Compiled Code))
  at
org.apache.commons.betwixt.expression.MethodUpdater.update(MethodUpdater.java:135)
  at
org.apache.commons.betwixt.io.BeanCreateRule$1.body(BeanCreateRule.java:584)
  at org.apache.commons.digester.Rule.body(Rule.java:240)
  at
org.apache.commons.digester.Digester.endElement(Digester.java:1034)
  at
org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java(Compiled
 Code))
  at
org.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(XMLNamespaceBinder.java(Compiled
 Code))
  at
org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java(Compiled
 Code))
  at
org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java(Compiled
 Code))
  at
org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java(Compiled
 Code))
  at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.handleEndElement(XMLDocumentFragmentScannerImpl.java(Compiled
 Code))
  at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java(Compiled
 Code))
  at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java(Compiled
 Code))
  at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)
  at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:525)
  at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:581)
  at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
  at
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1158)
  at org.apache.commons.digester.Digester.parse(Digester.java:1527)
  at
org.apache.maven.MavenUtils.getNonJellyProject(MavenUtils.java:183)
  at org.apache.maven.MavenUtils.getProject(MavenUtils.java:144)
  at org.apache.maven.MavenUtils.getProject(MavenUtils.java:126)
  at org.apache.maven.MavenUtils.getProject(MavenUtils.java:113)
  at
com.swissre.d08.commons.pom.D08CommonsPom.getProject(D08CommonsPom.java:81)
  at
com.swissre.d08.business.impl.D08BusinessLogicImpl.validate(D08BusinessLogicImpl.java:1449)
  at java.lang.reflect.Method.invoke(Native Method)
  at
com.swissre.d08.business.D08BusinessLogicFactory$1.invoke(D08BusinessLogicFactory.java:75)

The first consideration, it goes into the way the parsing mechanism happens
in Maven, and the role that the endorsed jars (xerses-2.4.0,
xml-apis-1.0.b2.jar ) have in the construction of the classpath in normal
usage of maven. I can only have a those classes in the classpath. If anyone
wants to spend some explanation on that it will make my job easier.

The second is the role of the jdk, can different jdks ( say 1.4.1 and 1.3.1
) play a different role ?

Any help is welcome.

Regards

Michele







This e-mail, including attachments, is intended for the person(s) or
company named and may contain confidential and/or legally privileged
information. Unauthorized disclosure, copying or use of this information
may be unlawful and is prohibited. If you are not the intended recipient,
please delete this message and notify the sender


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]