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 Steve Loughran <st...@apache.org> on 2007/11/19 15:08:51 UTC

retrieving 'profiled' m2 artifacts

There's now a POM file for TestNG 5.7 up on the repository
http://repo1.maven.org/maven2/org/testng/testng/5.7/testng-5.7.pom

however, it is 'profiled'; different artifacts and dependencies for 
java1.5 and java1.4.

I don't think trying to chase all of M2's logic about profile selection 
and the like is worthwhile, but Ivy does need some way of requesting a 
specific profile. I didnt see anything in the online documentation -is 
there a profile attribute that I've missed?

-steve

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

Re: retrieving 'profiled' m2 artifacts

Posted by Jing Xue <ji...@digizenstudio.com>.
Quoting Xavier Hanin <xa...@gmail.com>:

>
> Good point, and I prefer reviewing both script and text together. So it
> seems I won't have time to devote to that until next week at least. If
> somebody else can do some work it would help get the beta 1 sooner. The
> remaining tutorials to review are:
> http://ant.apache.org/ivy/history/trunk/tutorial/multiproject.html
> http://ant.apache.org/ivy/history/trunk/tutorial/conf.html
> http://ant.apache.org/ivy/history/trunk/tutorial/build-repository.html

I should have some time over the long weekend. Will give it a shot.

Cheers.
-- 
Jing

> BTW, I'd really like to have beta 1 released when I'll present Ivy @
> javapolis. It would be more concrete for attendees than using a trunk
> version.
>
> Xavier



RE: retrieving 'profiled' m2 artifacts

Posted by Gilles Scokart <gs...@gmail.com>.
> BTW, I'd really like to have beta 1 released when I'll present Ivy @
> javapolis. It would be more concrete for attendees than using a trunk
> version.

+1

Gilles



Re: retrieving 'profiled' m2 artifacts

Posted by Xavier Hanin <xa...@gmail.com>.
On Nov 21, 2007 3:09 PM, Gilles Scokart <gs...@gmail.com> wrote:

> >
> > Good question... I'd love to see a beta soon, but we (the community)
> haven't
> > reviewed all tutorials yet, and I think releasing a beta with outdated
> and
> > broken tutorials is not a good idea. I hope I'll have some time soon to
> > continue working on this, maybe in the plane (I should be travelling to
> US
> > on friday).
>
> I think now all the tutorial runs.  But they certainly need to be
> reviewed/updated because some might not put the focus
> on the right things (maven repository for instance, ivyrep repository...).

Indeed, that's also what I check/update when I review them.

>
>
> And BTW, most of them are running online.  So, you can certainly review
> the text in a plane, but reviewing the script
> itself might be more difficult.

Good point, and I prefer reviewing both script and text together. So it
seems I won't have time to devote to that until next week at least. If
somebody else can do some work it would help get the beta 1 sooner. The
remaining tutorials to review are:
http://ant.apache.org/ivy/history/trunk/tutorial/multiproject.html
http://ant.apache.org/ivy/history/trunk/tutorial/conf.html
http://ant.apache.org/ivy/history/trunk/tutorial/build-repository.html

BTW, I'd really like to have beta 1 released when I'll present Ivy @
javapolis. It would be more concrete for attendees than using a trunk
version.

Xavier

>
>
> Gilles
>
>
>


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

RE: retrieving 'profiled' m2 artifacts

Posted by Gilles Scokart <gs...@gmail.com>.
> 
> Good question... I'd love to see a beta soon, but we (the community) haven't
> reviewed all tutorials yet, and I think releasing a beta with outdated and
> broken tutorials is not a good idea. I hope I'll have some time soon to
> continue working on this, maybe in the plane (I should be travelling to US
> on friday).

I think now all the tutorial runs.  But they certainly need to be reviewed/updated because some might not put the focus
on the right things (maven repository for instance, ivyrep repository...).

And BTW, most of them are running online.  So, you can certainly review the text in a plane, but reviewing the script
itself might be more difficult.

Gilles



Re: retrieving 'profiled' m2 artifacts

Posted by Xavier Hanin <xa...@gmail.com>.
On Nov 21, 2007 1:25 PM, Steve Loughran <st...@apache.org> wrote:

> Xavier Hanin wrote:
>
> >
> > 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
>
> ok, I will have a look
>
>
> >
> > 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>
>
> that's all I need! Is there going to be a beta soon, or do I need to
> build everything myself ?

Good question... I'd love to see a beta soon, but we (the community) haven't
reviewed all tutorials yet, and I think releasing a beta with outdated and
broken tutorials is not a good idea. I hope I'll have some time soon to
continue working on this, maybe in the plane (I should be travelling to US
on friday).
So I suggest building yourself for the moment, it's really simple, follow
the instructions here:
http://ant.apache.org/ivy/history/trunk/dev.html

Xavier


>
> >
> > 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.
>
> ahh, something else to install.
>



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

Re: retrieving 'profiled' m2 artifacts

Posted by Steve Loughran <st...@apache.org>.
Xavier Hanin wrote:

> 
> 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

ok, I will have a look


> 
> 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>

that's all I need! Is there going to be a beta soon, or do I need to 
build everything myself ?

> 
> 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.

ahh, something else to install.

Re: retrieving 'profiled' m2 artifacts

Posted by Xavier Hanin <xa...@gmail.com>.
On Nov 20, 2007 3:55 PM, Steve Loughran <st...@apache.org> wrote:

> Xavier Hanin wrote:
> > On Nov 19, 2007 3:54 PM, Steve Loughran <st...@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/

Re: retrieving 'profiled' m2 artifacts

Posted by Jing Xue <ji...@digizenstudio.com>.
Quoting Steve Loughran <st...@apache.org>:

> 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

Can -jdk15 be treated as a branch name?  IOW, something along the lines of:

<dependency org="org.testng" module="testng" branch="-jdk15" />

and then in the resolver pattern:

<artifact  
pattern="http://www.ibiblio.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision](-[branch]).[ext]"/>

I have never actually done something like that - just throwing an idea  
out there. 8-)

Cheers.
-- 
Jing Xue


Re: retrieving 'profiled' m2 artifacts

Posted by Steve Loughran <st...@apache.org>.
Xavier Hanin wrote:
> On Nov 19, 2007 3:54 PM, Steve Loughran <st...@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




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

Re: retrieving 'profiled' m2 artifacts

Posted by Xavier Hanin <xa...@gmail.com>.
On Nov 19, 2007 3:54 PM, Steve Loughran <st...@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?

Xavier




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

Re: retrieving 'profiled' m2 artifacts

Posted by Steve Loughran <st...@apache.org>.
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)

Re: retrieving 'profiled' m2 artifacts

Posted by Xavier Hanin <xa...@gmail.com>.
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.

Xavier

On Nov 19, 2007 3:14 PM, Gilles Scokart <gs...@gmail.com> wrote:

> Yes :
>
> mvn -P profile1[,profilen]*
>
> But you can also set profile automatically from your maven settings files.
>
> Gilles
>
> > -----Original Message-----
> > From: Steve Loughran [mailto:stevel@apache.org]
> > Sent: lundi 19 novembre 2007 15:09
> > To: ivy-user@incubator.apache.org
> > Subject: retrieving 'profiled' m2 artifacts
> >
> >
> > There's now a POM file for TestNG 5.7 up on the repository
> > http://repo1.maven.org/maven2/org/testng/testng/5.7/testng-5.7.pom
> >
> > however, it is 'profiled'; different artifacts and dependencies for
> > java1.5 and java1.4.
> >
> > I don't think trying to chase all of M2's logic about profile selection
> > and the like is worthwhile, but Ivy does need some way of requesting a
> > specific profile. I didnt see anything in the online documentation -is
> > there a profile attribute that I've missed?
> >
> > -steve
> >
> > --
> > 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/

RE: retrieving 'profiled' m2 artifacts

Posted by Gilles Scokart <gs...@gmail.com>.
Yes : 

mvn -P profile1[,profilen]*

But you can also set profile automatically from your maven settings files.

Gilles

> -----Original Message-----
> From: Steve Loughran [mailto:stevel@apache.org]
> Sent: lundi 19 novembre 2007 15:09
> To: ivy-user@incubator.apache.org
> Subject: retrieving 'profiled' m2 artifacts
> 
> 
> There's now a POM file for TestNG 5.7 up on the repository
> http://repo1.maven.org/maven2/org/testng/testng/5.7/testng-5.7.pom
> 
> however, it is 'profiled'; different artifacts and dependencies for
> java1.5 and java1.4.
> 
> I don't think trying to chase all of M2's logic about profile selection
> and the like is worthwhile, but Ivy does need some way of requesting a
> specific profile. I didnt see anything in the online documentation -is
> there a profile attribute that I've missed?
> 
> -steve
> 
> --
> Steve Loughran                  http://www.1060.org/blogxter/publish/5
> Author: Ant in Action           http://antbook.org/