Generated default module descriptors with extra attributes are not working
because of missing namespace
-------------------------------------------------------------------------------------------------------
Key: IVY-1322
URL: https://issues.apache.org/jira/browse/IVY-1322
Project: Ivy
Issue Type: Bug
Components: Core
Affects Versions: 2.2.0, trunk
Reporter: Björn Kautler
The following three files
{code:title=ivysettings.xml|borderStyle=solid}
<?xml version="1.0" encoding="UTF-8"?>
<ivysettings>
<settings defaultResolver="default"/>
<include url="${ivy.default.settings.dir}/ivysettings-public.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-shared.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-local.xml"/>
<include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml"/>
<include
url="${ivy.default.settings.dir}/ivysettings-default-chain.xml"/>
<resolvers>
<url name="launch4j">
<artifact
pattern="http://downloads.sourceforge.net/project/launch4j/launch4j-3/[revision]/[artifact]-[revision]-[classifier].[ext]"
/>
</url>
</resolvers>
<modules>
<module organisation="net.sf.launch4j" resolver="launch4j" />
</modules>
</ivysettings>
{code}
{code:title=ivy.xml|borderStyle=solid}
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0"
xmlns:e="http://ant.apache.org/ivy/extra"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info organisation="com.example" module="ivy"/>
<configurations confmappingoverride="true"
defaultconfmapping="%->default">
<conf name="launch4j"/>
</configurations>
<dependencies defaultconf="compile;sources;javadoc">
<dependency org="net.sf.launch4j" name="launch4j" rev="3.0.2"
conf="launch4j">
<artifact name="launch4j" e:classifier="win32"
type="zip"/>
<artifact name="launch4j" e:classifier="macosx"
type="tgz"/>
<artifact name="launch4j" e:classifier="linux"
type="tgz"/>
</dependency>
</dependencies>
</ivy-module>
{code}
{code:title=build.xml|borderStyle=solid}
<?xml version="1.0"?>
<project default="retrieve" xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="check-ivy">
<available property="ivy.jar.present"
file="lib/ivy/ivy-2.2.0.jar"
type="file"/>
</target>
<target name="download-ivy"
depends="check-ivy"
unless="ivy.jar.present">
<mkdir dir="lib/ivy"/>
<get
src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.2.0/ivy-2.2.0.jar"
dest="lib/ivy/ivy-2.2.0.jar"
usetimestamp="true"/>
</target>
<target name="init-ivy"
depends="download-ivy">
<property name="ivy.retrieve.pattern"
value="lib/[conf]/[artifact](-[classifier]).[ext]"/>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
classpath="lib/ivy/ivy-2.2.0.jar"
loaderref="ivy.loader"
uri="antlib:org.apache.ivy.ant"/>
<ivy:settings file="ivysettings.xml"/>
</target>
<target name="retrieve"
description="retrieve the dependencies"
depends="init-ivy">
<ivy:retrieve sync="true"/>
<ivy:retrieve pattern="lib/ivy/[artifact]-[revision].[ext]"
organisation="org.apache.ivy"
module="ivy"
revision="2.2.0"
conf="default"
inline="true"/>
</target>
</project>
{code}
produce the following file
{code:title=~/.ivy2/cache/net.sf.launch4j/launch4j/ivy-3.0.2.xml|borderStyle=solid}
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0">
<info organisation="net.sf.launch4j"
module="launch4j"
revision="3.0.2"
status="release"
publication="20111120230713"
default="true"
/>
<configurations>
<conf name="default" visibility="public"/>
</configurations>
<publications>
<artifact name="launch4j" type="zip" ext="zip" conf="default"
classifier="win32"/>
<artifact name="launch4j" type="tgz" ext="tgz" conf="default"
classifier="macosx"/>
<artifact name="launch4j" type="tgz" ext="tgz" conf="default"
classifier="linux"/>
</publications>
</ivy-module>
{code}
In this file, the classifier attributes do not have a namespace which will
cause validation to fail and the build cannot be done offline, because launch4j
is redownloaded on every retrieve like seen here:
{code}
[ivy:retrieve] problem while parsing cached ivy file for:
net.sf.launch4j#launch4j;3.0.2: [xml parsing: ivy-3.0.2.xml:14:85:
cvc-complex-type.3.2.2: Attribute 'classifier' is not allowed to appear in
element 'artifact'. in
file:/home/vampire/.ivy2/cache/net.sf.launch4j/launch4j/ivy-3.0.2.xml
[ivy:retrieve] , xml parsing: ivy-3.0.2.xml:15:86: cvc-complex-type.3.2.2:
Attribute 'classifier' is not allowed to appear in element 'artifact'. in
file:/home/vampire/.ivy2/cache/net.sf.launch4j/launch4j/ivy-3.0.2.xml
[ivy:retrieve] , xml parsing: ivy-3.0.2.xml:16:85: cvc-complex-type.3.2.2:
Attribute 'classifier' is not allowed to appear in element 'artifact'. in
file:/home/vampire/.ivy2/cache/net.sf.launch4j/launch4j/ivy-3.0.2.xml
...
[ivy:retrieve] trying
http://downloads.sourceforge.net/project/launch4j/launch4j-3/3.0.2/launch4j-3.0.2-win32.zip
[ivy:retrieve] tried
http://downloads.sourceforge.net/project/launch4j/launch4j-3/3.0.2/launch4j-3.0.2-win32.zip
[ivy:retrieve] launch4j: no ivy file found for net.sf.launch4j#launch4j;3.0.2:
using default data
...
[ivy:retrieve] :: resolution report :: resolve 790ms :: artifacts dl 4ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| launch4j | 1 | 1 | 0 | 0 || 3 | 0 |
---------------------------------------------------------------------
{code}
In DefaultModuleDescriptor.newDefaultInstance() line 112 getExtraAttributes()
is used and thus the namespace is lost. Even if getQualifiedExtraAttributes()
would be used this would not suffice, as then the namespace declaration is
missing and again the validation would fail.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira