[
https://issues.apache.org/jira/browse/MNG-2715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15307347#comment-15307347
]
Roland Huss commented on MNG-2715:
----------------------------------
Sorry to revive this old issue, but unfortunately it seems that I'm not allowed
to create new issues ;(
I still have this very same problem with
{code}
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5;
2015-11-10T17:41:47+01:00)
Maven home: /usr/local/Cellar/maven/3.3.9/libexec
Java version: 1.8.0_40, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.11.4", arch: "x86_64", family: "mac"
{code}
When I use this pom.xml in order to allow an XSD for my custom plugin
configuration:
{code:xml}
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/POM/4.0.0">
....
<plugin>
....
<m:configuration xmlns:m="http://maven.apache.org/POM/4.0.0"
xmlns="http://fabric8.io/fabric8-maven-plugin">
<myConfig>.....</myConfig>
</m:configuration>
</plugin>
....
</project>
{code}
I get this error:
{code}
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Malformed POM
/Users/roland/Development/docker/docker-maven-plugin/samples/data-jolokia-demo/pom.xml:
Unrecognised tag: 'm:configuration' (position: START_TAG seen
...che.org/POM/4.0.0" xmlns="http://fabric8.io/fabric8-maven-plugin">...
@91:117) @
/Users/roland/Development/docker/docker-maven-plugin/samples/data-jolokia-demo/pom.xml,
line 91, column 117
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project io.fabric8:docker-jolokia-demo:0.15-SNAPSHOT
(/Users/roland/Development/docker/docker-maven-plugin/samples/data-jolokia-demo/pom.xml)
has 1 error
[ERROR] Malformed POM
/Users/roland/Development/docker/docker-maven-plugin/samples/data-jolokia-demo/pom.xml:
Unrecognised tag: 'm:configuration' (position: START_TAG seen
...che.org/POM/4.0.0" xmlns="http://fabric8.io/fabric8-maven-plugin">...
@91:117) @
/Users/roland/Development/docker/docker-maven-plugin/samples/data-jolokia-demo/pom.xml,
line 91, column 117 -> [Help 2]
{code}
Except for
https://cwiki.apache.org/confluence/display/MAVEN/Moving+forward+with+the+POM+data+model
I couldn't find any statement when namespaces are supported or tolerated. Are
there any plans for this (and maybe also to relax the schema constraints on the
{{<configuration>}} tag ?
> Maven does not comply to XML rules regarding prefixes.
> ------------------------------------------------------
>
> Key: MNG-2715
> URL: https://issues.apache.org/jira/browse/MNG-2715
> Project: Maven
> Issue Type: Bug
> Components: POM
> Environment: Ubuntu 6.10
> Maven 2.0.4
> Reporter: Seva Safris
> Priority: Critical
>
> I am new to Maven and have been trying to learn how to create a simple
> project.
> Let me walk through my scenario of creating a pom.xml file:
> 1. I bind the {http://maven.apache.org/POM/4.0.0} namespace (defined at
> "http://maven.apache.org/maven-v4_0_0.xsd") to Java classes using an XML
> Binding solution.
> 2. I use the bound classes to create a simple <project/> as one would expect
> to see in a pom.xml file.
> 3. I marshal the bound Java objects into xml and write it into pom.xml. Here
> is the xml I use:
> <ns1:project
> xmlns:ns1="http://maven.apache.org/POM/4.0.0">
> <ns1:modelVersion>4.0.0</ns1:modelVersion>
> <ns1:groupId>com.myapp</ns1:groupId>
> <ns1:artifactId>sample-project</ns1:artifactId>
> <ns1:name>Sample Maven Project</ns1:name>
> <ns1:version>1.0</ns1:version>
> <ns1:developers>
> <ns1:developer>
> <ns1:id>ssafris</ns1:id>
> <ns1:name>Seva Safris</ns1:name>
> </ns1:developer>
> </ns1:developers>
> <ns1:build>
> <ns1:sourceDirectory>${basedir}/src/java</ns1:sourceDirectory>
> </ns1:build>
> </ns1:project>
> 4. I run mvn, and am promptly given a "Not a v4.0.0 POM." exception.
> Tracing through Maven's source, I went to the exact location of the exception
> in DefaultMavenProjectBuilder.java. On line 1297 it has:
> if ( modelSource.indexOf( "<modelVersion>4.0.0" ) < 0 )
> {
> throw new InvalidProjectModelException( projectId, pomLocation, "Not a
> v4.0.0 POM." );
> }
> Since modelSource is checked explicitly for <modelVersion[...], my <project/>
> xml as shown above will fail this test because it has: <ns1:modelVersion[...].
> This is most definitely a bug in Maven and should be fixed as soon as
> possible. The workaround is to use a
> xmlns="http://maven.apache.org/POM/4.0.0" and define all elements without a
> prefix. However, my use of xmlns:ns1="http://maven.apache.org/POM/4.0.0"
> should not break Maven as it is not merely legal by xml conventions, but is
> also a better practice for xml documents.
> I hope you see the importance of getting this bug fixed: My use of a XML
> Binding solution to bind Maven's xml to Java allows me a strongly-typed level
> of indirection that will deterministically create proper xml that will
> validate successfully. If this bug is not fixed, then this level of
> indirection is not possible (or very very very difficult because the XML
> Binding solution would have to be hacked to use the xmlns="[...]"
> convention). I have only found this one instance of where the bug is obvious,
> but perhaps there are more locations in Maven where the same kind of error
> can occur.
> Thank you for your time, and I hope you consider this issue as seriously as I
> do.
> Sincerely,
> Seva Safris
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)