You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by Neil Miller <ne...@livewiremobile.com> on 2011/03/01 01:21:12 UTC
module configurations issue on import
I'm having an issue with importing modules from a public maven repo
(http://repo1.maven.org/maven2). I'm following the tutorial "Building a
repository" with namespace rules
(http://ant.apache.org/ivy/history/latest-milestone/tutorial/build-repository/advanced.html),
to import log4j version 1.2.16
At first I was having getting errors about attempts to overwrite an
artifact. At that point I was using the following artifact pattern:
${basedir}/repository/[organisation]/[module]/[revision]/[artifact].[ext]
Looking at the ivy file for log4j, I saw that the jars and noticed that
the artifacts for various jars all had the same name:
<publications>
<artifact name="log4j" type="bundle" ext="jar" conf="master"/>
<artifact name="log4j" type="source" ext="jar" conf="sources"
m:classifier="sources"/>
<artifact name="log4j" type="javadoc" ext="jar" conf="javadoc"
m:classifier="javadoc"/>
</publications>
So I added [conf] to the path and tried again, it still didn't work, so
I added [type]
(Artifact pattern:
"${basedir}/repository/[organisation]/[module]/[revision]/[conf]/[type]s/[artifact].[ext]")
and got the following directory structure:
apache/log4j/1.2.16/
- default/
- bundles/
- log4j.jar
- log4j.jar.md5
- log4j.jar.sha1
- javadocs/
- log4j.jar
- log4j.jar.md5
- log4j.jar.sha1
- sources/
- log4j.jar
- log4j.jar.md5
- log4j.jar.sha1
Where the artifacts for the three configurations are all under "default"
rather than "master", "sources", and "javaadoc". Is there something I'm
missing here about the way [conf] works in the pattern? (really wish I
could get at the classifier :) )
Thanks,
-n
The full ivy file for log4j:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="apache"
module="log4j"
revision="1.2.16"
status="release"
publication="20100331002544"
namespace="maven2"
>
<license name="The Apache Software License, Version 2.0"
url="http://www.apache.org/licenses/LICENSE-2.0.txt" />
<description homepage="http://logging.apache.org/log4j/1.2/">
Apache Log4j 1.2
</description>
<m:maven.plugins>org.apache.maven.plugins__maven-resources-plugin__null|null__maven-surefire-plugin__2.5|null__maven-compiler-plugin__2.1|null__maven-jar-plugin__2.3|null__maven-antrun-plugin__1.2|null__maven-assembly-plugin__2.2-beta-5|null__maven-javadoc-plugin__2.6.1|null__maven-release-plugin__2.0-beta-9|null__maven-source-plugin__2.1.1|org.codehaus.mojo__clirr-maven-plugin__2.2.2|org.codehaus.mojo__rat-maven-plugin__1.0-alpha-3|org.apache.felix__maven-bundle-plugin__2.0.1</m:maven.plugins>
</info>
<configurations>
<conf name="default" visibility="public" description="runtime
dependencies and master artifact can be used with this conf"
extends="runtime,master"/>
<conf name="master" visibility="public" description="contains only the
artifact published by this module itself, with no transitive dependencies"/>
<conf name="compile" visibility="public" description="this is the
default scope, used if none is specified. Compile dependencies are
available in all classpaths."/>
<conf name="provided" visibility="public" description="this is much like
compile, but indicates you expect the JDK or a container to provide it.
It is only available on the compilation classpath, and is not transitive."/>
<conf name="runtime" visibility="public" description="this scope
indicates that the dependency is not required for compilation, but is
for execution. It is in the runtime and test classpaths, but not the
compile classpath." extends="compile"/>
<conf name="test" visibility="private" description="this scope indicates
that the dependency is not required for normal use of the application,
and is only available for the test compilation and execution phases."
extends="runtime"/>
<conf name="system" visibility="public" description="this scope is
similar to provided except that you have to provide the JAR which
contains it explicitly. The artifact is always available and is not
looked up in a repository."/>
<conf name="sources" visibility="public" description="this configuration
contains the source artifact of this module, if any."/>
<conf name="javadoc" visibility="public" description="this configuration
contains the javadoc artifact of this module, if any."/>
<conf name="optional" visibility="public" description="contains all
optional dependencies"/>
</configurations>
<publications>
<artifact name="log4j" type="bundle" ext="jar" conf="master"/>
<artifact name="log4j" type="source" ext="jar" conf="sources"
m:classifier="sources"/>
<artifact name="log4j" type="javadoc" ext="jar" conf="javadoc"
m:classifier="javadoc"/>
</publications>
<dependencies>
<dependency org="javax.mail" name="mail" rev="1.4.1" force="true"
conf="optional->compile(*),master(*)"/>
<dependency org="apache" name="oro" rev="2.0.8" force="true"
conf="test->runtime(*),master(*)"/>
<dependency org="junit" name="junit" rev="3.8.2" force="true"
conf="test->runtime(*),master(*)"/>
<dependency org="org.apache.geronimo.specs" name="geronimo-jms_1.1_spec"
rev="1.0" force="true" conf="optional->compile(*),master(*)"/>
</dependencies>
</ivy-module>
ivy.xml
Posted by "Brosh, Yossi" <yo...@sap.com>.
Hi to all,
Could you please explain what is wrote in the ivy.xml and the action related to war.
<dependencies defaultconf="compile->*">
<dependency org="saa.bbb.com" name="com.bbb.ccc.ddd.sss.ddd" rev="latest.integration" transitive="false" conf="lib->*"/>
</dependencies>
Yossibr
Re: module configurations issue on import
Posted by Neil Miller <ne...@livewiremobile.com>.
Hey Tom,
Thanks for the link, don't know how that didn't turn up in my searches.
I'd actually just figured that it out by tracing through the source code
and it all makes sense now. Just wish it was clearer in the
documentation of pattern substitutions.
For your situation the extra attributes are perfect, I'm still stuck
though since I'm installing from maven not publishing my own artifacts.
I can, like you, use [type], that works, but is less than ideal. The
attribute I need [m:classifier] doesn't seem to get into extra
attributes list and I'm not sure why that is. Perhaps because it's from
the "http://ant.apache.org/ivy/maven" namespace, though I don't see any
code that is filtering by that or "http://ant.apache.org/ivy/extra".
-n
On 03/02/2011 07:37 AM, tomduck wrote:
> Hey Neil,
>
> We've been struggling with the same thing today and have found the following
> Ivy issue (https://issues.apache.org/jira/browse/IVY-472) which explains why
> this won't work. In short it's a cardinality issue since an artifact is
> allowed to belong to many configurations so it's hard to decide where it
> should go.
>
> We are trying to configure Ivy to publish binaries compiled for different
> platforms and also platform independent headers.
>
> At the moment we are using [type] (albeit a little incorrectly) to achieve
> the same thing. We are looking at extra attributes and using a custom
> e:platform attribute to do what we want. I have some problems with it at the
> moment in that the attribute is not available when publishing the ivy file
> so I can't put it in the right directory in my repository.
>
> Anyway - hope that helps.
>
> Tom
>
>
> Neil Miller-6 wrote:
>> I'm having an issue with importing modules from a public maven repo
>> (http://repo1.maven.org/maven2). I'm following the tutorial "Building a
>> repository" with namespace rules
>> (http://ant.apache.org/ivy/history/latest-milestone/tutorial/build-repository/advanced.html),
>> to import log4j version 1.2.16
>>
>> At first I was having getting errors about attempts to overwrite an
>> artifact. At that point I was using the following artifact pattern:
>> ${basedir}/repository/[organisation]/[module]/[revision]/[artifact].[ext]
>>
>> Looking at the ivy file for log4j, I saw that the jars and noticed that
>> the artifacts for various jars all had the same name:
>> <publications>
>> <artifact name="log4j" type="bundle" ext="jar" conf="master"/>
>> <artifact name="log4j" type="source" ext="jar" conf="sources"
>> m:classifier="sources"/>
>> <artifact name="log4j" type="javadoc" ext="jar" conf="javadoc"
>> m:classifier="javadoc"/>
>> </publications>
>>
>> So I added [conf] to the path and tried again, it still didn't work, so
>> I added [type]
>> (Artifact pattern:
>> "${basedir}/repository/[organisation]/[module]/[revision]/[conf]/[type]s/[artifact].[ext]")
>> and got the following directory structure:
>>
>> apache/log4j/1.2.16/
>> - default/
>> - bundles/
>> - log4j.jar
>> - log4j.jar.md5
>> - log4j.jar.sha1
>> - javadocs/
>> - log4j.jar
>> - log4j.jar.md5
>> - log4j.jar.sha1
>> - sources/
>> - log4j.jar
>> - log4j.jar.md5
>> - log4j.jar.sha1
>>
>> Where the artifacts for the three configurations are all under "default"
>> rather than "master", "sources", and "javaadoc". Is there something I'm
>> missing here about the way [conf] works in the pattern? (really wish I
>> could get at the classifier :) )
>>
>> Thanks,
>> -n
>>
>>
>> The full ivy file for log4j:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
>> <info organisation="apache"
>> module="log4j"
>> revision="1.2.16"
>> status="release"
>> publication="20100331002544"
>> namespace="maven2"
>> >
>> <license name="The Apache Software License, Version 2.0"
>> url="http://www.apache.org/licenses/LICENSE-2.0.txt" />
>> <description homepage="http://logging.apache.org/log4j/1.2/">
>> Apache Log4j 1.2
>> </description>
>> <m:maven.plugins>org.apache.maven.plugins__maven-resources-plugin__null|null__maven-surefire-plugin__2.5|null__maven-compiler-plugin__2.1|null__maven-jar-plugin__2.3|null__maven-antrun-plugin__1.2|null__maven-assembly-plugin__2.2-beta-5|null__maven-javadoc-plugin__2.6.1|null__maven-release-plugin__2.0-beta-9|null__maven-source-plugin__2.1.1|org.codehaus.mojo__clirr-maven-plugin__2.2.2|org.codehaus.mojo__rat-maven-plugin__1.0-alpha-3|org.apache.felix__maven-bundle-plugin__2.0.1</m:maven.plugins>
>> </info>
>> <configurations>
>> <conf name="default" visibility="public" description="runtime
>> dependencies and master artifact can be used with this conf"
>> extends="runtime,master"/>
>> <conf name="master" visibility="public" description="contains only the
>> artifact published by this module itself, with no transitive
>> dependencies"/>
>> <conf name="compile" visibility="public" description="this is the
>> default scope, used if none is specified. Compile dependencies are
>> available in all classpaths."/>
>> <conf name="provided" visibility="public" description="this is much like
>> compile, but indicates you expect the JDK or a container to provide it.
>> It is only available on the compilation classpath, and is not
>> transitive."/>
>> <conf name="runtime" visibility="public" description="this scope
>> indicates that the dependency is not required for compilation, but is
>> for execution. It is in the runtime and test classpaths, but not the
>> compile classpath." extends="compile"/>
>> <conf name="test" visibility="private" description="this scope indicates
>> that the dependency is not required for normal use of the application,
>> and is only available for the test compilation and execution phases."
>> extends="runtime"/>
>> <conf name="system" visibility="public" description="this scope is
>> similar to provided except that you have to provide the JAR which
>> contains it explicitly. The artifact is always available and is not
>> looked up in a repository."/>
>> <conf name="sources" visibility="public" description="this configuration
>> contains the source artifact of this module, if any."/>
>> <conf name="javadoc" visibility="public" description="this configuration
>> contains the javadoc artifact of this module, if any."/>
>> <conf name="optional" visibility="public" description="contains all
>> optional dependencies"/>
>> </configurations>
>> <publications>
>> <artifact name="log4j" type="bundle" ext="jar" conf="master"/>
>> <artifact name="log4j" type="source" ext="jar" conf="sources"
>> m:classifier="sources"/>
>> <artifact name="log4j" type="javadoc" ext="jar" conf="javadoc"
>> m:classifier="javadoc"/>
>> </publications>
>> <dependencies>
>> <dependency org="javax.mail" name="mail" rev="1.4.1" force="true"
>> conf="optional->compile(*),master(*)"/>
>> <dependency org="apache" name="oro" rev="2.0.8" force="true"
>> conf="test->runtime(*),master(*)"/>
>> <dependency org="junit" name="junit" rev="3.8.2" force="true"
>> conf="test->runtime(*),master(*)"/>
>> <dependency org="org.apache.geronimo.specs" name="geronimo-jms_1.1_spec"
>> rev="1.0" force="true" conf="optional->compile(*),master(*)"/>
>> </dependencies>
>> </ivy-module>
>>
>>
>>
>>
Re: module configurations issue on import
Posted by tomduck <to...@gmail.com>.
Hey Neil,
We've been struggling with the same thing today and have found the following
Ivy issue (https://issues.apache.org/jira/browse/IVY-472) which explains why
this won't work. In short it's a cardinality issue since an artifact is
allowed to belong to many configurations so it's hard to decide where it
should go.
We are trying to configure Ivy to publish binaries compiled for different
platforms and also platform independent headers.
At the moment we are using [type] (albeit a little incorrectly) to achieve
the same thing. We are looking at extra attributes and using a custom
e:platform attribute to do what we want. I have some problems with it at the
moment in that the attribute is not available when publishing the ivy file
so I can't put it in the right directory in my repository.
Anyway - hope that helps.
Tom
Neil Miller-6 wrote:
>
> I'm having an issue with importing modules from a public maven repo
> (http://repo1.maven.org/maven2). I'm following the tutorial "Building a
> repository" with namespace rules
> (http://ant.apache.org/ivy/history/latest-milestone/tutorial/build-repository/advanced.html),
> to import log4j version 1.2.16
>
> At first I was having getting errors about attempts to overwrite an
> artifact. At that point I was using the following artifact pattern:
> ${basedir}/repository/[organisation]/[module]/[revision]/[artifact].[ext]
>
> Looking at the ivy file for log4j, I saw that the jars and noticed that
> the artifacts for various jars all had the same name:
> <publications>
> <artifact name="log4j" type="bundle" ext="jar" conf="master"/>
> <artifact name="log4j" type="source" ext="jar" conf="sources"
> m:classifier="sources"/>
> <artifact name="log4j" type="javadoc" ext="jar" conf="javadoc"
> m:classifier="javadoc"/>
> </publications>
>
> So I added [conf] to the path and tried again, it still didn't work, so
> I added [type]
> (Artifact pattern:
> "${basedir}/repository/[organisation]/[module]/[revision]/[conf]/[type]s/[artifact].[ext]")
> and got the following directory structure:
>
> apache/log4j/1.2.16/
> - default/
> - bundles/
> - log4j.jar
> - log4j.jar.md5
> - log4j.jar.sha1
> - javadocs/
> - log4j.jar
> - log4j.jar.md5
> - log4j.jar.sha1
> - sources/
> - log4j.jar
> - log4j.jar.md5
> - log4j.jar.sha1
>
> Where the artifacts for the three configurations are all under "default"
> rather than "master", "sources", and "javaadoc". Is there something I'm
> missing here about the way [conf] works in the pattern? (really wish I
> could get at the classifier :) )
>
> Thanks,
> -n
>
>
> The full ivy file for log4j:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
> <info organisation="apache"
> module="log4j"
> revision="1.2.16"
> status="release"
> publication="20100331002544"
> namespace="maven2"
> >
> <license name="The Apache Software License, Version 2.0"
> url="http://www.apache.org/licenses/LICENSE-2.0.txt" />
> <description homepage="http://logging.apache.org/log4j/1.2/">
> Apache Log4j 1.2
> </description>
> <m:maven.plugins>org.apache.maven.plugins__maven-resources-plugin__null|null__maven-surefire-plugin__2.5|null__maven-compiler-plugin__2.1|null__maven-jar-plugin__2.3|null__maven-antrun-plugin__1.2|null__maven-assembly-plugin__2.2-beta-5|null__maven-javadoc-plugin__2.6.1|null__maven-release-plugin__2.0-beta-9|null__maven-source-plugin__2.1.1|org.codehaus.mojo__clirr-maven-plugin__2.2.2|org.codehaus.mojo__rat-maven-plugin__1.0-alpha-3|org.apache.felix__maven-bundle-plugin__2.0.1</m:maven.plugins>
> </info>
> <configurations>
> <conf name="default" visibility="public" description="runtime
> dependencies and master artifact can be used with this conf"
> extends="runtime,master"/>
> <conf name="master" visibility="public" description="contains only the
> artifact published by this module itself, with no transitive
> dependencies"/>
> <conf name="compile" visibility="public" description="this is the
> default scope, used if none is specified. Compile dependencies are
> available in all classpaths."/>
> <conf name="provided" visibility="public" description="this is much like
> compile, but indicates you expect the JDK or a container to provide it.
> It is only available on the compilation classpath, and is not
> transitive."/>
> <conf name="runtime" visibility="public" description="this scope
> indicates that the dependency is not required for compilation, but is
> for execution. It is in the runtime and test classpaths, but not the
> compile classpath." extends="compile"/>
> <conf name="test" visibility="private" description="this scope indicates
> that the dependency is not required for normal use of the application,
> and is only available for the test compilation and execution phases."
> extends="runtime"/>
> <conf name="system" visibility="public" description="this scope is
> similar to provided except that you have to provide the JAR which
> contains it explicitly. The artifact is always available and is not
> looked up in a repository."/>
> <conf name="sources" visibility="public" description="this configuration
> contains the source artifact of this module, if any."/>
> <conf name="javadoc" visibility="public" description="this configuration
> contains the javadoc artifact of this module, if any."/>
> <conf name="optional" visibility="public" description="contains all
> optional dependencies"/>
> </configurations>
> <publications>
> <artifact name="log4j" type="bundle" ext="jar" conf="master"/>
> <artifact name="log4j" type="source" ext="jar" conf="sources"
> m:classifier="sources"/>
> <artifact name="log4j" type="javadoc" ext="jar" conf="javadoc"
> m:classifier="javadoc"/>
> </publications>
> <dependencies>
> <dependency org="javax.mail" name="mail" rev="1.4.1" force="true"
> conf="optional->compile(*),master(*)"/>
> <dependency org="apache" name="oro" rev="2.0.8" force="true"
> conf="test->runtime(*),master(*)"/>
> <dependency org="junit" name="junit" rev="3.8.2" force="true"
> conf="test->runtime(*),master(*)"/>
> <dependency org="org.apache.geronimo.specs" name="geronimo-jms_1.1_spec"
> rev="1.0" force="true" conf="optional->compile(*),master(*)"/>
> </dependencies>
> </ivy-module>
>
>
>
>
--
View this message in context: http://old.nabble.com/module-configurations-issue-on-import-tp31036969p31048929.html
Sent from the ivy-user mailing list archive at Nabble.com.