You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mi...@swissre.com on 2004/05/18 09:40:04 UTC

Again POM Parser in Maven 1

Hello dIon,

here is the POMs I am using :

(See attached file: s13.ent)the entity is used among different category of
projects

(See attached file: project.xml)the initial POM is relative to a particular
module

(See attached file: project.xml)the father is used to group together
property of a single project

I then use that POM to generate an ear but this part is not imporatant at
the moment I want to find a way using the API  how to parse the POM and
create a Project rappresentation in memory.

Best Regards and thanks for your time  and above all for the great job you
all did.

Michele




|---------+----------------------------->
|         |           dion_gillard@multi|
|         |           task.com.au       |
|         |                             |
|         |                             |
|         |           18/05/2004 01:42  |
|         |           Please respond to |
|         |           "Maven Users List"|
|         |                             |
|---------+----------------------------->
  >------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                              |
  |                                                                                                                              |
  |                                                                                                                              |
  |                                                                                                                              |
  |                                                                                                                              |
  |        To:                                         "Maven Users List" <us...@maven.apache.org>                               |
  |        cc:                                         (bcc: Michele Forte/SwissRe)                                              |
  |        bcc:                                        Michele Forte/SwissRe                                                     |
  |        Subject:                                    RE: Again about the  POM Parser in Maven 1                                |
  >------------------------------------------------------------------------------------------------------------------------------|




Post the entire POM to one of us to validate.
--
dIon Gillard, Multitask Consulting



Michele_Forte@swissre.com wrote on 17/05/2004 11:21:07 PM:

> then I understood you correctly
>
> if (projectFile.exists() && projectFile.canRead())
> 130       {
> 131         return MavenUtils.getProject(
> 132           projectFile,
> 133           null,
> 134           false);
> 135       }
>
>
> that is in fact what I am using I locate my File() containing the POM
and
> then I parse it .
>       here I start my program
>       File f=new File(s);
>       if (f.exists()){
>                   Project p=MavenUtils.getProject(f,null,true); // Using
> Maven 1 parser
>
> that give me the exception I am using the last from head of the maven
> project I can even debug in it :
> the Sax parser runs and then it stops at the
>
>  2063|DEBUG|[main      ]| |org.apache.commons.beanutils.ConvertUtils
> - Convert string 'tag' to class 'java.lang.String'
>     2063|DEBUG|[main      ]|
> |org.apache.commons.beanutils.ConvertUtils                    -   Using
> converter org.apache.commons.beanutils.converters.StringConverter@b1074a
>   962082|ERROR|[main      ]|      |org.apache.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:2177)
>
> In reality the Dependency class is empty
>
> (Embedded image moved to file: pic15141.pcx)
>
> and the error appears correct,    the corresponding dependency that is
> trying to parse is:
>
>  <dependency>
>       <groupId>tag</groupId>
>       <artifactId>sr-tag-web</artifactId>
>       <version>1.0.1</version>
>       <type>war</type>
>       <properties>
>               <swissre.component.repository>SR_TAG_Web
> </swissre.component.repository>
>               <swissre.component.repository.tag>v_1_0_1_1
> </swissre.component.repository.tag>
>               <swissre.component.type>internal</swissre.component.type>
>               <ear.bundle>true</ear.bundle>
>               <ear.appxml.war.context-root>webapp/tag
> </ear.appxml.war.context-root>
>        </properties>
> </dependency>
>
>
> now that looks pretty standard to me and not really exceptional.
>
> Is there something else that you would suggest to try ?
>
> Best Regards
>
> michele
>
>
>
> |---------+---------------------------->
> |         |           Maczka Michal    |
> |         |           <michal.maczka@im|
> |         |           tf.ch>           |
> |         |                            |
> |         |                            |
> |         |           17/05/2004 14:58 |
> |         |           Please respond to|
> |         |           "Maven Users     |
> |         |           List"            |
> |         |                            |
> |---------+---------------------------->
>
>
>
------------------------------------------------------------------------------------------------------------------------------

> |
>   |    |
>   |    |
>   |    |
>   |    |
>   |    |
>   |        To:                                         "'Maven Users
> List'" <us...@maven.apache.org>                             |
>   |        cc:                                         (bcc: Michele
> Forte/SwissRe)                                              |
>   |        bcc:                                        Michele
> Forte/SwissRe                                                     |
>   |        Subject:                                    RE: Again
> about the  POM Parser in Maven 1                                |
>
>
>
------------------------------------------------------------------------------------------------------------------------------

> |
>
>
>
>
>
>
> > -----Original Message-----
> > From: Michele_Forte@swissre.com [mailto:Michele_Forte@swissre.com]
> > Sent: Monday, May 17, 2004 2:50 PM
> > To: Maven Users List
> > Cc: 'Maven Users List'
> > Subject: RE: Again about the POM Parser in Maven 1
> >
> >
>
> > Probably I have misunderstand you ....sorry for wasting in
> > case your time.
>
> No problem. Probably you did misuderstand me.
>
> I asked you to look at like 106 of this class
>
>
http://maven.apache.org/reference/plugins/xdoc/xref/org/apache/maven/Depende

>
> ncyDescriberBean.html#106
>
>
> This methods takes dependecy as parameter, constructs the path to
> corespoding POM, parses that POM and returns it.
> Either I am missing something but this is more or less what you want to
do.
>
> The first half of this method contains the code which generates the path
> which leads to POM,
> second half shows how to use it when you want to get (parsed) POM.
> There is no requiremnt that some POM should exists before.
> So it is not very different from your code and I don't know why your
> version
> is not working.
>
> Which version of maven are you using? <id> tag was indeed required at
some
> moment in time but that was ages ago...
>
> Michal
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>
>
>
> 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org






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