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 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/maven-v4_0_0.xsd; parent groupIdOER-Common/groupId artifactIdOER-Common/artifactId version0.0.1-SNAPSHOT/version /parent modelVersion4.0.0/modelVersion groupIdOER-Common/groupId artifactIdcommon.artifact/artifactId version0.0.1-SNAPSHOT/version namecommon.artifact/name dependencies dependency groupIdOER-Common/groupId artifactIdcommon.web/artifactId version0.0.1-SNAPSHOT/version /dependency dependency groupIdOER-Common/groupId artifactIdcommon.util/artifactId version0.0.1-SNAPSHOT/version classifiertests/classifier scopetest/scope /dependency /dependencies /project ?xml version=1.0 encoding=US-ASCII ? project xmlns=http://maven.apache.org/POM/4.0.0; modelVersion4.0.0/modelVersion groupIdcommon.artifact/groupId artifactIdcommon.artifact/artifactId version0.0.1-SNAPSHOT/version build sourceDirectorysrc/main/java//sourceDirectory outputDirectorytarget//outputDirectory plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId version2.0.2/version configuration source 1.6 /source target 1.6 /target /configuration /plugin /plugins /build /project - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
AW: What should be the correct check for any XML to be POM?
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.mou...@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?
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 amaresh.mou...@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-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org -- Germanys national anthem is the most boring in the world - how telling! - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org