RE: Again about the POM Parser in Maven 1
It seems to me that really something is not OK with your POM Maybe this example will be helpful? : http://maven.apache.org/reference/plugins/xdoc/xref/org/apache/maven/Depende ncyDescriberBean.html (you can look at the method private Project resolveProject(Dependency dependency) ) Michal -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, May 17, 2004 11:25 AM To: Maven Users List Cc: Maven Users List Subject: Again about the POM Parser in Maven 1 Thanks for the hint to point to MavenUtils, I played around a bit with that class, using a know working project.xml. I wrote a small test [...] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Again about the POM Parser in Maven 1
Hello Michal, Probably I was not precise enough. My initial aim is to be able to parse using the API an already working project.xml. Using the maven.bat I can normally work with it. I made before using it in this test also a verification using the POM plugin. maven -e pom:contentValidate pom:validate and the result is pom:contentvalidate: INFO : /project/logo : Element is null or empty. No logo will be displayed. WARNING : /project/licenses : No licenses defined. Your project has a license and it should be entered into the licenses section. pom:validate: D:\Data\IBM\wsappdev51\j2ee\tag\SR_TAG_EAR\admin\project.xml:18:13: error: cvc-complex-type.2.4.a: Invalid content starting with element 'extend'. One of '{:organization}' is expected. Java Result: 1 BUILD SUCCESSFUL And in general with this POM I can build package run war and ear plugins. And using maven.bat everything works fine. My first step was then to use the API of the Parser, to make an initial test, and that is were I got the exception. I would expect that behind the scene when I use maven.bat the same parser is used. So I would get a similar result ? But the fact that I got that error makes the scenario somehow more complex and there is where you could drive me in the right direction. Thanks in advance for your help ... I am also using xml entity for common part among different projects. Regards Michele I attached the POMs for completeness. (See attached file: project.xml)the parent (See attached file: project.xml) and the corresponding entity (See attached file: s13.ent) 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]
RE: Again about the POM Parser in Maven 1
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, May 17, 2004 1:32 PM To: Maven Users List Cc: Maven Users List Subject: RE: Again about the POM Parser in Maven 1 Hello Michal, Probably I was not precise enough. My initial aim is to be able to parse using the API an already working project.xml. Using the maven.bat I can normally work with it. I made before using it in this test also a verification using the POM plugin. No you were precise enough... :) Have you looked at this example which to which I have pointed you. It really does the same things which you want to do ... but it works :) Michal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Again about the POM Parser in Maven 1
Hello Michal, I tried to understand how to use that API, from what I can see the following public void build(Project projectValue) requires already the Project avalable it means : something like File f=new File(s); if (f.exists()){ Project p=MavenUtils.getProject(f); // Using Maven 1 parser DependencyDescriberBean dependency=new DependencyDescriberBean (); dependency.build(p); System.out.println(OK); } .. my problem relies in the first line. The parsing itself fails. Telling me that the dependency id does not exist ... that were I am stuck I have a file POM I want to parse it and crete the Project object. Probably I have misunderstand you sorry for wasting in case your time. Best Regards Michele |-+ | | Maczka Michal| | | [EMAIL PROTECTED]| | | tf.ch | | || | || | | 17/05/2004 13:49 | | | Please respond to| | | Maven Users | | | List| | || |-+ --| | | | | | | | | | | |To: 'Maven Users List' [EMAIL PROTECTED] | |cc: (bcc: Michele Forte/SwissRe) | |bcc:Michele Forte/SwissRe | |Subject:RE: Again about the POM Parser in Maven 1| --| -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, May 17, 2004 1:32 PM To: Maven Users List Cc: Maven Users List Subject: RE: Again about the POM Parser in Maven 1 Hello Michal, Probably I was not precise enough. My initial aim is to be able to parse using the API an already working project.xml. Using the maven.bat I can normally work with it. I made before using it in this test also a verification using the POM plugin. No you were precise enough... :) Have you looked at this example which to which I have pointed you. It really does the same things which you want to do ... but it works :) Michal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] 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]
RE: Again about the POM Parser in Maven 1
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 [EMAIL PROTECTED] 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 groupIdtag/groupId artifactIdsr-tag-web/artifactId version1.0.1/version typewar/type properties swissre.component.repositorySR_TAG_Web /swissre.component.repository swissre.component.repository.tagv_1_0_1_1 /swissre.component.repository.tag swissre.component.typeinternal/swissre.component.type ear.bundletrue/ear.bundle ear.appxml.war.context-rootwebapp/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| | | [EMAIL PROTECTED]| | | tf.ch | | || | || | | 17/05/2004 14:58 | | | Please respond to| | | Maven Users | | | List| | || |-+ --| | | | | | | | | | | |To: 'Maven Users List' [EMAIL PROTECTED] | |cc: (bcc: Michele Forte/SwissRe) | |bcc:Michele Forte/SwissRe | |Subject:RE: Again about the POM Parser in Maven 1| --| -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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
RE: Again about the POM Parser in Maven 1
Post the entire POM to one of us to validate. -- dIon Gillard, Multitask Consulting [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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 groupIdtag/groupId artifactIdsr-tag-web/artifactId version1.0.1/version typewar/type properties swissre.component.repositorySR_TAG_Web /swissre.component.repository swissre.component.repository.tagv_1_0_1_1 /swissre.component.repository.tag swissre.component.typeinternal/swissre.component.type ear.bundletrue/ear.bundle ear.appxml.war.context-rootwebapp/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| | | [EMAIL PROTECTED]| | | tf.ch | | || | || | | 17/05/2004 14:58 | | | Please respond to| | | Maven Users | | | List| | || |-+ -- | || || || || || |To: 'Maven Users List' [EMAIL PROTECTED] | |cc: (bcc: Michele Forte/SwissRe) | |bcc:Michele Forte/SwissRe | |Subject:RE: Again about the POM Parser in Maven 1| -- | -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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: [EMAIL PROTECTED