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 Alan Chaney <al...@mechnicality.com> on 2012/02/24 22:30:28 UTC

Ivyde, ivy-roundup and 'source'

Hi Everybody

For a long while I've been rather frustrated with the "the jar of this 
class file belongs to ivy.xml" message that pops up in eclipse with 
certain projects. I searched for other messages on this subject but 
found nothing conclusive.

I'm using eclipse indigo and helios, both with ivy 2.2 and ivyde 2.1.

Generally, it works really well, but I've been hitting the above 
problem, so I had a look into it and found the following:

1. The files that were giving a problem where ones with the following in 
the ivy.xml:

<publications>
<artifact/>
<artifact name="source" type="source" ext="zip"/>
</publications>

what this says to Ivy, or so I understand, is publish the jar in a 
folder called jar with the name  [project]-[revision].jar  and publish 
the source in a folder called sources with the name source-[revision].zip.

I was experimenting with javax.transaction (jta) so my jar path was: 
jta/jar/jta-1.1.jar and my source path was jta/sources/source-1.1.zip

It seems that there is no 'sources' pattern that I can find that matches 
sources/source.zip. If you double-click on a class name in the eclipse 
browser, you get the dreaded 'jar of class... " message and a 
disassembly of the java.


I found that if I edited the <publications> element as:

<publications>
<artifact/>
<artifact type="source" ext="zip"/>
</publications>

and renamed my source file in the cache as [project]-[revision].zip (in 
my example above to jta-1.1.zip) then, magically, it all worked!

Sadly, the pattern name="source" type="source" extn="zip" appears to be 
widely used in ivy-roundup.

So it seems to me that there are three solutions to this problem:

1. Tell me what pattern to use in the Advanced--sources field of ivyde 
to resolve patterns of the form source-[revision].zip

2. Fix ivyde so that it will match source-[revision].zip

3. modify ivy-roundup by removing name="source" or changing it to name 
the sources as the project name, e.g in my example name="jta"

I'm partly doing this because other people I work with are moaning about 
how Ivy is not allowing them to see the sources of the files they 
download, and the only other fix is for me to build a corporate repository.

Does anyone have any other thoughts?

Thanks

Alan


















Re: Ivyde, ivy-roundup and 'source'

Posted by Archie Cobbs <ar...@dellroad.org>.
Well heck! That makes it easy :)

I've updated Ivy RoundUp to (a) support the ivyde:source and ivyde:javadoc
attributes on ivy.xml files and (b) automatically add these attributes when
appropriate.

Try it out and let me know if that helps!

-Archie

2012/2/27 Nicolas Lalevée <ni...@hibnet.org>

>
> Le 26 févr. 2012 à 21:56, Archie Cobbs a écrit :
>
> > 2012/2/25 Nicolas Lalevée <ni...@hibnet.org>
> >
> >> Le 24 févr. 2012 à 23:03, Archie Cobbs a écrit :
> >>> People have complained about this for a long time.
> >>
> >> The semantic of the types in an ivy.xml is specified by the one writing
> >> them. So for each repository there could probably be as many mapping
> >> strategies as there are repositories around the world.
> >>
> >
> > Good point. Maybe ivy needs new elements/attributes that can define a
> > mapping between artifacts of different types.
>
> This has also been implemented but in IvyDE: see the "IvyDE namespace" in
> the doc [1].
>
> Nicolas
>
> [1] http://ant.apache.org/ivy/ivyde/history/trunk/cpc/jarmapping.html
>
>


-- 
Archie L. Cobbs

Re: Ivyde, ivy-roundup and 'source'

Posted by Nicolas Lalevée <ni...@hibnet.org>.
Le 26 févr. 2012 à 21:56, Archie Cobbs a écrit :

> 2012/2/25 Nicolas Lalevée <ni...@hibnet.org>
> 
>> Le 24 févr. 2012 à 23:03, Archie Cobbs a écrit :
>>> People have complained about this for a long time.
>> 
>> The semantic of the types in an ivy.xml is specified by the one writing
>> them. So for each repository there could probably be as many mapping
>> strategies as there are repositories around the world.
>> 
> 
> Good point. Maybe ivy needs new elements/attributes that can define a
> mapping between artifacts of different types.

This has also been implemented but in IvyDE: see the "IvyDE namespace" in the doc [1].

Nicolas

[1] http://ant.apache.org/ivy/ivyde/history/trunk/cpc/jarmapping.html


Re: Ivyde, ivy-roundup and 'source'

Posted by Archie Cobbs <ar...@dellroad.org>.
2012/2/25 Nicolas Lalevée <ni...@hibnet.org>

> Le 24 févr. 2012 à 23:03, Archie Cobbs a écrit :
> > People have complained about this for a long time.
>
> The semantic of the types in an ivy.xml is specified by the one writing
> them. So for each repository there could probably be as many mapping
> strategies as there are repositories around the world.
>

Good point. Maybe ivy needs new elements/attributes that can define a
mapping between artifacts of different types.

-Archie

-- 
Archie L. Cobbs

Re: Ivyde, ivy-roundup and 'source'

Posted by Nicolas Lalevée <ni...@hibnet.org>.
Le 24 févr. 2012 à 23:03, Archie Cobbs a écrit :

> People have complained about this for a long time.
> 
> I may be biased but in my opinion this is clearly an IvyDE problem: IvyDE
> should be associating sources to JARs using ivy configurations, not
> filenames. In fact, ivy does not define filenames, the user of ivy does
> (see this discussion<http://code.google.com/p/ivyroundup/wiki/HowToConfigureIvy#Retrieval_Patterns>).
> In this case, that user is IvyDE.
> 
> But even doing that is not necessary. Here is a very simple approach for
> IvyDE to take: for a given ivy module, download all the artifacts of type
> "source". Then when a user clicks to "view source" on a Java class name,
> search all these source artifacts for the first one containing the
> corresponding java file and display it. Why is this so hard?
> 
> Instead, they have hard-coded assumptions which are brittle and won't ever
> work for all ivy modules anyway, e.g., those that don't have a 1:1 JAR to
> source ZIP correspondence.

The semantic of the types in an ivy.xml is specified by the one writing them. So for each repository there could probably be as many mapping strategies as there are repositories around the world. Since the 1:1 mapping is the very common one, IvyDE obviously implements it.

But thanks to the beauty of open source, anyone interested in making IvyDE correctly understand the ivyround up semantic can contribute. Someone did and it will be available in the release to com. See "Auto map jar artifacts with unique source artifact" in the doc [1].

Nicolas

[1] http://ant.apache.org/ivy/ivyde/history/trunk/preferences.html#mapping

> On Fri, Feb 24, 2012 at 3:30 PM, Alan Chaney <al...@mechnicality.com> wrote:
> 
>> Hi Everybody
>> 
>> For a long while I've been rather frustrated with the "the jar of this
>> class file belongs to ivy.xml" message that pops up in eclipse with certain
>> projects. I searched for other messages on this subject but found nothing
>> conclusive.
>> 
>> I'm using eclipse indigo and helios, both with ivy 2.2 and ivyde 2.1.
>> 
>> Generally, it works really well, but I've been hitting the above problem,
>> so I had a look into it and found the following:
>> 
>> 1. The files that were giving a problem where ones with the following in
>> the ivy.xml:
>> 
>> <publications>
>> <artifact/>
>> <artifact name="source" type="source" ext="zip"/>
>> </publications>
>> 
>> what this says to Ivy, or so I understand, is publish the jar in a folder
>> called jar with the name  [project]-[revision].jar  and publish the source
>> in a folder called sources with the name source-[revision].zip.
>> 
>> I was experimenting with javax.transaction (jta) so my jar path was:
>> jta/jar/jta-1.1.jar and my source path was jta/sources/source-1.1.zip
>> 
>> It seems that there is no 'sources' pattern that I can find that matches
>> sources/source.zip. If you double-click on a class name in the eclipse
>> browser, you get the dreaded 'jar of class... " message and a disassembly
>> of the java.
>> 
>> 
>> I found that if I edited the <publications> element as:
>> 
>> <publications>
>> <artifact/>
>> <artifact type="source" ext="zip"/>
>> </publications>
>> 
>> and renamed my source file in the cache as [project]-[revision].zip (in my
>> example above to jta-1.1.zip) then, magically, it all worked!
>> 
>> Sadly, the pattern name="source" type="source" extn="zip" appears to be
>> widely used in ivy-roundup.
>> 
>> So it seems to me that there are three solutions to this problem:
>> 
>> 1. Tell me what pattern to use in the Advanced--sources field of ivyde to
>> resolve patterns of the form source-[revision].zip
>> 
>> 2. Fix ivyde so that it will match source-[revision].zip
>> 
>> 3. modify ivy-roundup by removing name="source" or changing it to name the
>> sources as the project name, e.g in my example name="jta"
>> 
>> I'm partly doing this because other people I work with are moaning about
>> how Ivy is not allowing them to see the sources of the files they download,
>> and the only other fix is for me to build a corporate repository.
>> 
>> Does anyone have any other thoughts?
>> 
>> Thanks
>> 
>> Alan
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
> 
> 
> -- 
> Archie L. Cobbs


Re: Ivyde, ivy-roundup and 'source'

Posted by Archie Cobbs <ar...@dellroad.org>.
People have complained about this for a long time.

I may be biased but in my opinion this is clearly an IvyDE problem: IvyDE
should be associating sources to JARs using ivy configurations, not
filenames. In fact, ivy does not define filenames, the user of ivy does
(see this discussion<http://code.google.com/p/ivyroundup/wiki/HowToConfigureIvy#Retrieval_Patterns>).
In this case, that user is IvyDE.

But even doing that is not necessary. Here is a very simple approach for
IvyDE to take: for a given ivy module, download all the artifacts of type
"source". Then when a user clicks to "view source" on a Java class name,
search all these source artifacts for the first one containing the
corresponding java file and display it. Why is this so hard?

Instead, they have hard-coded assumptions which are brittle and won't ever
work for all ivy modules anyway, e.g., those that don't have a 1:1 JAR to
source ZIP correspondence.

-Archie

On Fri, Feb 24, 2012 at 3:30 PM, Alan Chaney <al...@mechnicality.com> wrote:

> Hi Everybody
>
> For a long while I've been rather frustrated with the "the jar of this
> class file belongs to ivy.xml" message that pops up in eclipse with certain
> projects. I searched for other messages on this subject but found nothing
> conclusive.
>
> I'm using eclipse indigo and helios, both with ivy 2.2 and ivyde 2.1.
>
> Generally, it works really well, but I've been hitting the above problem,
> so I had a look into it and found the following:
>
> 1. The files that were giving a problem where ones with the following in
> the ivy.xml:
>
> <publications>
> <artifact/>
> <artifact name="source" type="source" ext="zip"/>
> </publications>
>
> what this says to Ivy, or so I understand, is publish the jar in a folder
> called jar with the name  [project]-[revision].jar  and publish the source
> in a folder called sources with the name source-[revision].zip.
>
> I was experimenting with javax.transaction (jta) so my jar path was:
> jta/jar/jta-1.1.jar and my source path was jta/sources/source-1.1.zip
>
> It seems that there is no 'sources' pattern that I can find that matches
> sources/source.zip. If you double-click on a class name in the eclipse
> browser, you get the dreaded 'jar of class... " message and a disassembly
> of the java.
>
>
> I found that if I edited the <publications> element as:
>
> <publications>
> <artifact/>
> <artifact type="source" ext="zip"/>
> </publications>
>
> and renamed my source file in the cache as [project]-[revision].zip (in my
> example above to jta-1.1.zip) then, magically, it all worked!
>
> Sadly, the pattern name="source" type="source" extn="zip" appears to be
> widely used in ivy-roundup.
>
> So it seems to me that there are three solutions to this problem:
>
> 1. Tell me what pattern to use in the Advanced--sources field of ivyde to
> resolve patterns of the form source-[revision].zip
>
> 2. Fix ivyde so that it will match source-[revision].zip
>
> 3. modify ivy-roundup by removing name="source" or changing it to name the
> sources as the project name, e.g in my example name="jta"
>
> I'm partly doing this because other people I work with are moaning about
> how Ivy is not allowing them to see the sources of the files they download,
> and the only other fix is for me to build a corporate repository.
>
> Does anyone have any other thoughts?
>
> Thanks
>
> Alan
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


-- 
Archie L. Cobbs