You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by amaresh mourya <am...@gmail.com> on 2010/01/08 10:51:47 UTC

What should be the correct check for any XML to be POM?

Hi all,
I am need of writing a check method to filter POMs from a list of xml files.
What should be the exact check?
Only the <project> tag along with Namespace is sufficient or I need to check
for all three xmlns, xmlns :xsi and xsi:schemaLocation?

<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                      http://maven.apache.org/xsd/maven-4.0.0.xsd">


Another related question is : Consider a case of multi-module application
pom, where in each module's directory there are more than one xml files, So
is it possible that for this module there can be two POMs ? or only one.?

 There are two xml files attached, that have the same artifactId
"common-artifact", what check would return me correct POM for this artifact.
1. bak_pom.xml
2. pom.xml

Thanks
--amaresh

AW: What should be the correct check for any XML to be POM?

Posted by Entner Harald <En...@afb.de>.
Hi Amaresh, 

 

it is possible that in one directory more than one pom file exists. Even
as far as i have used maven this case never occured. You can call mvn
with the -f option in order to specify another pom.xml file. But keep in
mind, that prior to version 2.0.9 (since 2.0.9 it is possible [1]) it
was not possible to these pom files as modules. 

 

Regarding your question about the check: In my opinion it is sufficient
to check the project with the default namespace (xmlns=...). In order to
have things working in the future without touching your code i would
make this configurable, as the namespace can change.

 

Maybe it would be sufficient to use the filename (pom.xml) only. This
depends on your setup. E.g. pom.xml.bak would be found when all xml
files are considered (and it would match all syntax checks, but .bak
files are normally considered as backup files and as a consequence it is
very likely that you don't want to consider it.)

 

 

[1] http://jira.codehaus.org/browse/MNG-1493

 

Von: amaresh mourya [mailto:amaresh.mourya@gmail.com] 
Gesendet: Freitag, 8. Januar 2010 10:52
An: Maven Users List
Betreff: What should be the correct check for any XML to be POM?

 

Hi all,
I am need of writing a check method to filter POMs from a list of xml
files. What should be the exact check?
Only the <project> tag along with Namespace is sufficient or I need to
check for all three xmlns, xmlns :xsi and xsi:schemaLocation?

<project xmlns="http://maven.apache.org/POM/4.0.0"

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"




  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0

                      http://maven.apache.org/xsd/maven-4.0.0.xsd">




 


Another related question is : Consider a case of multi-module
application pom, where in each module's directory there are more than
one xml files, So is it possible that for this module there can be two
POMs ? or only one.?

 There are two xml files attached, that have the same artifactId
"common-artifact", what check would return me correct POM for this
artifact.
1. bak_pom.xml
2. pom.xml

Thanks
--amaresh 


Re: What should be the correct check for any XML to be POM?

Posted by Jochen Wiedmann <jo...@gmail.com>.
Project and namespace

Depending on the pom generator, you have no idea, whether the
xmlns:xsi and xsi:schemaLocation are present or not.

Jochen


2010/1/8 amaresh mourya <am...@gmail.com>:
> Hi all,
> I am need of writing a check method to filter POMs from a list of xml files.
> What should be the exact check?
> Only the <project> tag along with Namespace is sufficient or I need to check
> for all three xmlns, xmlns :xsi and xsi:schemaLocation?
>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
>   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>                       http://maven.apache.org/xsd/maven-4.0.0.xsd">
>
>
>
> Another related question is : Consider a case of multi-module application
> pom, where in each module's directory there are more than one xml files, So
> is it possible that for this module there can be two POMs ? or only one.?
>
>  There are two xml files attached, that have the same artifactId
> "common-artifact", what check would return me correct POM for this artifact.
> 1. bak_pom.xml
> 2. pom.xml
>
> Thanks
> --amaresh
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>



-- 
Germanys national anthem is the most boring in the world - how telling!

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