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 Mi...@bmw.de on 2017/02/22 10:27:45 UTC
Ivy Module and extra attributes
Hi,
in the documentation I read about the extra attributes:
"Extra attributes: Those extra attributes will indeed be used as identifier for the module like the org the name and the revision:"
https://ant.apache.org/ivy/history/2.1.0/concept.html
We would like to organize the libs for different platforms "x86_64_linux", "x86_64_windows" and "all" with an extra attribute. So we created an ivy descriptor with the extra attribute e:platform. In the dependencies we want to depend on the same module but for a different platform e.g. "all".
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
<info organisation="org.apache.libs" module="lib1" e:platform="x86_64_linux" status="integration" />
<configurations>
<conf name="default" />
<conf name="dev" />
<conf name="test" />
<conf name="report" />
</configurations>
<publications>
<artifact name="lib1" type="bin" conf="default" ext="zip" />
</publications>
<dependencies>
<dependency org="org.apache.libs" name="lib1" e:platform="all" rev="last.integration"/>
</dependencies>
</ivy-module>
While the ivy:retrieve step we get following error message:
java.lang.IllegalArgumentException: a module is not authorized to depend on itself: org.apache.libs#lib1#master;last.integration
at org.apache.ivy.core.resolve.IvyNodeCallers.addCaller(IvyNodeCallers.java:166)
at org.apache.ivy.core.resolve.IvyNode.addCaller(IvyNode.java:1076)
at org.apache.ivy.core.resolve.IvyNode.getDependencies(IvyNode.java:372)
at org.apache.ivy.core.resolve.VisitNode.getDependencies(VisitNode.java:313)
at org.apache.ivy.core.resolve.ResolveEngine.doFetchDependencies(ResolveEngine.java:796)
at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(ResolveEngine.java:726)
at org.apache.ivy.core.resolve.ResolveEngine.getDependencies(ResolveEngine.java:599)
at org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:236)
at org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:197)
at org.apache.ivy.Ivy.resolve(Ivy.java:508)
The question is if ivy should support a combination of org - module - e:platform to uniquely identify depending SW component - also if the same module name exists twice?
Thanks
Michael
Re: Ivy Module and extra attributes
Posted by Marc De Boeck <md...@gmail.com>.
From the documentation, I also understand that it should be possible to do
what you described.
However, I would not use the extra-attributes for defining modules which
are different implementations of the same library. Having a module which
seems to depend upon itself (except for the extra attribute), could become
confusing.
You have different alternatives to deal with such situations:
* If each implementation has a different source-base and its own ivy.xml,
then you could define modules lib1-linux, lib1-windows and lib1-all (or
lib1-common).
* If you have the same sources (described by one ivy.xml file), then you
could define different artifacts for each platform:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
<info organisation="org.apache.libs" module="lib1" status="integration"
/>
<configurations>
<conf name="default" />
<conf name="dev" />
<conf name="test" />
<conf name="report" />
</configurations>
<publications>
<artifact name="lib1" type="bin" conf="default" ext="zip"
e:platform="linux" />
<artifact name="lib1" type="bin" conf="default" ext="zip"
e:platform="windows" />
</publications>
</ivy-module>
* Alternatively, you could also split up your configurations into
dev-linux, dev-windows, etc...
Marc
2017-02-22 11:27 GMT+01:00 <Mi...@bmw.de>:
> Hi,
> in the documentation I read about the extra attributes:
>
> "Extra attributes: Those extra attributes will indeed be used as
> identifier for the module like the org the name and the revision:"
>
> https://ant.apache.org/ivy/history/2.1.0/concept.html
>
> We would like to organize the libs for different platforms "x86_64_linux",
> "x86_64_windows" and "all" with an extra attribute. So we created an ivy
> descriptor with the extra attribute e:platform. In the dependencies we want
> to depend on the same module but for a different platform e.g. "all".
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
> <info organisation="org.apache.libs" module="lib1"
> e:platform="x86_64_linux" status="integration" />
>
> <configurations>
> <conf name="default" />
> <conf name="dev" />
> <conf name="test" />
> <conf name="report" />
> </configurations>
>
> <publications>
> <artifact name="lib1" type="bin" conf="default" ext="zip" />
> </publications>
>
> <dependencies>
> <dependency org="org.apache.libs" name="lib1" e:platform="all"
> rev="last.integration"/>
> </dependencies>
> </ivy-module>
>
> While the ivy:retrieve step we get following error message:
>
> java.lang.IllegalArgumentException: a module is not authorized to depend
> on itself: org.apache.libs#lib1#master;last.integration
> at org.apache.ivy.core.resolve.IvyNodeCallers.addCaller(
> IvyNodeCallers.java:166)
> at org.apache.ivy.core.resolve.IvyNode.addCaller(IvyNode.java:1076)
> at org.apache.ivy.core.resolve.IvyNode.getDependencies(IvyNode.java:372)
> at org.apache.ivy.core.resolve.VisitNode.getDependencies(
> VisitNode.java:313)
> at org.apache.ivy.core.resolve.ResolveEngine.doFetchDependencies(
> ResolveEngine.java:796)
> at org.apache.ivy.core.resolve.ResolveEngine.fetchDependencies(
> ResolveEngine.java:726)
> at org.apache.ivy.core.resolve.ResolveEngine.getDependencies(
> ResolveEngine.java:599)
> at org.apache.ivy.core.resolve.ResolveEngine.resolve(
> ResolveEngine.java:236)
> at org.apache.ivy.core.resolve.ResolveEngine.resolve(
> ResolveEngine.java:197)
> at org.apache.ivy.Ivy.resolve(Ivy.java:508)
>
> The question is if ivy should support a combination of org - module -
> e:platform to uniquely identify depending SW component - also if the same
> module name exists twice?
>
> Thanks
> Michael
>