ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xavier Hanin" <xavier.ha...@gmail.com>
Subject Re: retrieving 'profiled' m2 artifacts
Date Tue, 20 Nov 2007 15:42:18 GMT
On Nov 20, 2007 3:55 PM, Steve Loughran <stevel@apache.org> wrote:

> Xavier Hanin wrote:
> > On Nov 19, 2007 3:54 PM, Steve Loughran <stevel@apache.org> wrote:
> >
> >> Xavier Hanin wrote:
> >>> I think Steve's asking for the same setting in Ivy. If that's the
> >> question,
> >>> the answer is no, we don't have support for profiles so far in Ivy.
> >>>
> >>> IMO a good way to implement this kind of thing would be to implement
> >>> conditionnal configurations and/or conditionnal dependencies.
> >>> Something like:
> >>> <dependency name="..." rev="..." if="myvariable" />
> >>>
> >>> I remember this has already been discussed, but I don't remember if
> >> someone
> >>> opened an issue for that. With conditional dependencies/confs, we
> could
> >> map
> >>> each profile to a simple variable (for instance profile.<profile
> name>)
> >> then
> >>> activating the profile would be as simple as:
> >>> ant -Dprofile.<profile name> resolve
> >>>
> >>> Implementing conditional dependencies/confs shouldn't be too hard, we
> >> just
> >>> have to ignore them when the condition is not matched. Parsing poms to
> >>> support this shouldn't be too hard either.
> >>>
> >>> If we want to go further, we could deal with jdk enabled profiles
> (which
> >> is
> >>> one of the most common use case behind m2 profiles AFAIK) and set the
> >>> corresponding variables automatically depending on the jdk, to more
> >> closely
> >>> mimic m2.
> >> I can see JDK/java version profiles being good, but it gets complex
> fast.
> >>
> >> I'm currently mainly in need of a way of referring to profiled
> >> artifacts, which come out testng-5.7-java14 and testing-5.7-java15
> >>
> >> I need a way of selecting one of these
> >> <dependency name="..." rev="..."  profile="java1.5" />
> >>
> >> actually choosing which one to use dynamically is feature creep that
> >> doesnt concern me (right now)
> >
> > I'm not sure we understand each other correctly. What I suggest is
> adding
> > conditional dependencies to Ivy, and using this to implement m2
> profiles.
> > Then I say that we might have automatic condition matching based on jdk,
> but
> > this is only for a later implementation, at first conditional
> dependencies
> > is enough IMO (and if I understand correctly you seem to agree with
> that).
> > After all profile="java1.5" is not much different from if="
> profile.java1.5",
> > the latter being only slightly more flexible and matching a similar
> concept
> > in Ant targets.
> >
> > What do you think?
>
> oh, if you want go ahead and do the conditions, then yes please :). But
>  we also need to be able to resolve artifacts in the m2 repository that
> have a profile suffix. Have a look at the files in
> http://repo1.maven.org/maven2/org/testng/testng/5.7/
>
> to see what I mean. I need the -jdk15 files; no need for a condition
> there, as I dont build on java1.4

Damned, is it yet another trick in maven 2? The problem here is not much the
use of profiles, but that in the profile a plugin is configured to publish
an artifact with a specific classifier:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
    <executions>
    <execution>
    <configuration>
<classifier>jdk15</classifier>
</configuration>
    <goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

I don't even know if depending on this module with no classifier works in
maven based on the profile information, but we support maven classifiers in
Ivy trunk version, at least when they are expressed in the pom:
https://issues.apache.org/jira/browse/IVY-418

But here we could know testng is publishing a classifier artifact based on
the maven-jar-plugin details. But I don't know if it's something maven does
or not, and if it's standard or not. So for the moment if you want to
declare a dependency on testng I would do something similar to what is
internally generated by Ivy when converting a pom with a dependency like:

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.7</version>
<classifier>jdk15</classifier>
</dependency>

which should be something like:
<dependency org="org.testng" name="testng" rev="5.7">
<artifact name="testng" type="jar" ext="jar" classifier="jdk15" />
</dependency>

If you have time to give maven 2 a test to see if it works without the
classifier in the dependency declaration, I'd be interested to know.

Xavier




>
>
>
>
> --
> Steve Loughran                  http://www.1060.org/blogxter/publish/5
> Author: Ant in Action           http://antbook.org/
>



-- 
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://ant.apache.org/ivy/
http://www.xoocode.org/

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message