Source and Javadoc in modules

5 views
Skip to first unread message

Soupdragon

unread,
Oct 5, 2010, 11:58:35 AM10/5/10
to usr-ivybeans
In the Netbeans library system there is provision for source and
javadocs as well as class libraries. This allows, for example, the
Javadocs of a method call to be displayed in the source editor, of for
the source to be opened during debugging.

It's easy enough to put source and Javadocs in as artifacts under a
separate configuration on library modules, but a lot less obvious how
to get Netbeans to download and use it.

Laurent Forêt

unread,
Oct 6, 2010, 6:03:47 AM10/6/10
to usr-iv...@googlegroups.com
While resolving dependencies we get all ModuleDescriptor and for 
and for each ModuleDescriptor resolved we get the 3 type of artifacts  we are interested by : the "jar" the "source" and the "javadoc".


Hope It Helps.

Laurent Forêt
http://www.devcoop.fr,
http://laurentforet.org
IvyBeans Creator
Membre du JUG Bordeaux



--
You received this message because you are subscribed to the Google Groups "usr-ivybeans" group.
To post to this group, send email to usr-iv...@googlegroups.com.
To unsubscribe from this group, send email to usr-ivybeans...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/usr-ivybeans?hl=en.


Soupdragon

unread,
Oct 6, 2010, 6:52:30 AM10/6/10
to usr-ivybeans
So the trick is to specify the right type for these extra artefacts
rather than anything to do with configurations?

They are currently included as .jar files, but I put them in a
separate configuration.

On Oct 6, 11:03 am, Laurent Forêt <laurent.fo...@gmail.com> wrote:
> While resolving dependencies we get all ModuleDescriptor and for
> and for each ModuleDescriptor resolved we get the 3 type of artifacts  we
> are interested by : the "jar" the "source" and the "javadoc".
>
> Hope It Helps.
>
> Laurent Forêthttp://www.devcoop.fr,http://laurentforet.org
> IvyBeans Creator
> Membre du JUG Bordeaux
>
> On Tue, Oct 5, 2010 at 5:58 PM, Soupdragon
> <Malcolm.McMa...@costcutter.com>wrote:
>
> > In the Netbeans library system there is provision for source and
> > javadocs as well as class libraries. This allows, for example, the
> > Javadocs of a method call to be displayed in the source editor, of for
> > the source to be opened during debugging.
>
> > It's easy enough to put source and Javadocs in as artifacts under a
> > separate configuration on library modules, but a lot less obvious how
> > to get Netbeans to download and use it.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "usr-ivybeans" group.
> > To post to this group, send email to usr-iv...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > usr-ivybeans...@googlegroups.com<usr-ivybeans%2Bunsu...@googlegroups.com>
> > .

Soupdragon

unread,
Oct 6, 2010, 11:07:31 AM10/6/10
to usr-ivybeans
OK, Tried that with a couple of modules. For example I changed the
<artifact for the source directory to ext="jar" type="source" and
likewise with the Javadoc.

When I look at the Netbeans sources window, though, what I see is all
the class jars. Goto source gives me the decompiled class file. Still
can't find the javadoc.

When I look at the ivy cache I see the source jars have been placed in
a "Sources" directoy and the documentation in "Javadocs". Cleary ivy
is treating them as a separater type.

Laurent Forêt

unread,
Oct 7, 2010, 4:06:34 AM10/7/10
to usr-iv...@googlegroups.com
It seems to be an ivy issue. 

Indeed when I test a simple configuration from a maven repository it works fine. 

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0">
    <info module="JavaApplication2" organisation="JavaApplication2" revision="1.0"/>
    <configurations>
        <conf name="compile"/>
        <conf name="runtime"/>
        <conf name="compile-test"/>
        <conf name="runtime-test"/>
    </configurations>
    <dependencies>
        <dependency org="commons-logging" name="commons-logging" rev="1.0.4" conf="compile->*" />
    </dependencies>
</ivy-module>

with the default ivySettings it works fine. 

And the ivy-1.0.xml resolved for "commons-logging" looks like :

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="1.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="commons-logging"
module="commons-logging"
revision="1.0"
status="release"
publication="20051108231641"
>
<description homepage="" />
</info>
<configurations>.....
</configurations>
<publications>
<artifact name="commons-logging" type="jar" ext="jar" conf="master"/>
<artifact name="commons-logging" type="javadoc" ext="jar" conf="javadoc" m:classifier="javadoc"/>
</publications>
</ivy-module>
 


Laurent Forêt
http://www.devcoop.fr,
http://laurentforet.org
IvyBeans Creator
Membre du JUG Bordeaux


To unsubscribe from this group, send email to usr-ivybeans...@googlegroups.com.

Laurent Forêt

unread,
Oct 7, 2010, 4:13:24 AM10/7/10
to usr-iv...@googlegroups.com
oups the good one is ivy-1.0.4.xml

<ivy-module version="1.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="commons-logging"
module="commons-logging"
revision="1.0.4"
status="release"
publication="20051108231641"
>
<license name="The Apache Software License, Version 2.0" url="/LICENSE.txt" />
Commons Logging is a thin adapter allowing configurable bridging to other,
    well known logging systems.
</description>
<m:maven.plugins>null__maven-surefire-plugin__null</m:maven.plugins>
</info>
<publications>
<artifact name="commons-logging" type="jar" ext="jar" conf="master"/>
<artifact name="commons-logging" type="source" ext="jar" conf="sources" m:classifier="sources"/>
<artifact name="commons-logging" type="javadoc" ext="jar" conf="javadoc" m:classifier="javadoc"/>
</publications>
<dependencies>
<dependency org="log4j" name="log4j" rev="1.2.6" force="true" conf="optional->compile(*),master(*)"/>
<dependency org="logkit" name="logkit" rev="1.0.1" force="true" conf="optional->compile(*),master(*)"/>
<dependency org="junit" name="junit" rev="3.7" force="true" conf="test->runtime(*),master(*)"/>
<dependency org="avalon-framework" name="avalon-framework" rev="4.1.3" force="true" conf="optional->compile(*),master(*)"/>
</dependencies>
</ivy-module>


But I am sure you get the idea.

Laurent Forêt
http://www.devcoop.fr,
http://laurentforet.org
IvyBeans Creator
Membre du JUG Bordeaux


2010/10/7 Laurent Forêt <lauren...@gmail.com>

Bruce Chapman

unread,
Oct 7, 2010, 4:39:08 AM10/7/10
to usr-iv...@googlegroups.com
On 7/10/2010 4:07 a.m., Soupdragon wrote:
> OK, Tried that with a couple of modules. For example I changed the
> <artifact for the source directory to ext="jar" type="source" and
> likewise with the Javadoc.
>
> When I look at the Netbeans sources window, though, what I see is all
> the class jars. Goto source gives me the decompiled class file. Still
> can't find the javadoc.
>
> When I look at the ivy cache I see the source jars have been placed in
> a "Sources" directoy and the documentation in "Javadocs". Cleary ivy
> is treating them as a separater type.
>
>

A couple of other things:

1. It is also good to specify the maven classifier (see laurent's last
post - note the xmlns specifier and m:classifier)

2. Also, check your ivy-impl.xml ant script, its <ivy:retrieve> probably
only retrieves type=jar (and therefore not type=javadoc or source)

If you want the other files retrieved (rather than just in the cache)
then you'll need type="jar,javadoc,source"

If you build ivybeans from trunk, and install that, you can instead just
put

ivy-retrieve.type=jar,javadoc,source

in project.properties to over-ride the default value of "jar". This was
added in a recent commit (R300).

Bruce

>
>
> On Oct 6, 11:52 am, Soupdragon<Malcolm.McMa...@costcutter.com> wrote:
>> So the trick is to specify the right type for these extra artefacts
>> rather than anything to do with configurations?
>>
>> They are currently included as .jar files, but I put them in a
>> separate configuration.
>>

>> On Oct 6, 11:03 am, Laurent For�t<laurent.fo...@gmail.com> wrote:
>>
>>> While resolving dependencies we get all ModuleDescriptor and for
>>> and for each ModuleDescriptor resolved we get the 3 type of artifacts we
>>> are interested by : the "jar" the "source" and the "javadoc".
>>> Hope It Helps.

>>> Laurent For�thttp://www.devcoop.fr,http://laurentforet.org

Soupdragon

unread,
Oct 7, 2010, 5:23:21 AM10/7/10
to usr-ivybeans
Set the maven classifier, no effect. Added javadoc,sources to
retrieve, now dowloads source but netbeans doesn't treat is as such
(and it will be added to the classpath, which isn't a good thing). I'd
much rather it accessed the source and javadocs from the ivy cache,
rather than downloading into the project.

I've been having a quick look at the IvyBeans source, and AFAIKS,
netbeans is supposed to pick up the sources from the
SourceForBinaryQueryImpl class, which will be populated not by the ant
script retrieve but from ivy being accessed directly by
IvyLibraryController. In fact it doesn't look to me like the ant
script will affect this sources list at all.

(BTW why can't Netbeans find import org.openide.util.Lookup when
examining the ivybeans code?)

The really weird thing is that when I open the debugger sources
window, what I'm seeing is a complete list of the class jars from ivy
dependencies, directed at the ivy cache. No sign of my source jars.
The class jars have no business being on this list.

One of the things I'm going to need to do is to publish source and,
generally, javadoc with library modules being built under netbeans, in
fact this is more important that getting the source for 3rd party
libraries.

Our current company policy is not to use external repositories, by the
way.

Laurent Forêt

unread,
Oct 7, 2010, 5:59:08 AM10/7/10
to usr-iv...@googlegroups.com
On Thu, Oct 7, 2010 at 11:23 AM, Soupdragon <Malcolm...@costcutter.com> wrote:
Set the maven classifier, no effect. Added javadoc,sources to
retrieve, now dowloads source but netbeans doesn't treat is as such
(and it will be added to the classpath, which isn't a good thing). I'd
much rather it accessed the source and javadocs from the ivy cache,
rather than downloading into the project.

I've been having a quick look at the IvyBeans source, and AFAIKS,
netbeans is supposed to pick up the sources from the
SourceForBinaryQueryImpl class, which will be populated not by the ant
script retrieve but from ivy being accessed directly by
IvyLibraryController. In fact it doesn't look to me like the ant
script will affect this sources list at all.

Exactly yes.
 

(BTW why can't Netbeans find import org.openide.util.Lookup when
examining the ivybeans code?)

That is the question ;) ! 

The really weird thing is that when I open the debugger sources
window, what I'm seeing is a complete list of the class jars from ivy
dependencies, directed at the ivy cache. No sign of my source jars.
The class jars have no business being on this list.

One of the things I'm going to need to do is to publish source and,
generally, javadoc with library modules being built under netbeans, in
fact this is more important that getting the source for 3rd party
libraries.

Indeed, if you need to access the source you have to publish it.
 
Our current company policy is not to use external repositories, by the
way.

Maybe, Nexus repository could be an easier solution. But, here it is the maven user who wrote, not the ivybeans developer ;).
 

Laurent.


To unsubscribe from this group, send email to usr-ivybeans...@googlegroups.com.

Soupdragon

unread,
Oct 7, 2010, 6:22:09 AM10/7/10
to usr-ivybeans
Is it possible that the artefacts need to have the same name as the
primary classes jar, or of the jar to which they relate? I'm looking
for differences, between the module file you gave and mine. (This
would require altering the structure of my repository since the source
and classes jar are currently in the same directory.

I could put in a template that adds a [type] directory to the search,
move the javadoc and source into sub-directories.



On Oct 7, 10:59 am, Laurent Forêt <laurent.fo...@gmail.com> wrote:
> On Thu, Oct 7, 2010 at 11:23 AM, Soupdragon
> <Malcolm.McMa...@costcutter.com>wrote:
> > <usr-ivybeans%2Bunsu...@googlegroups.com<usr-ivybeans%252Buns...@googlegroups.com>

Laurent Forêt

unread,
Oct 7, 2010, 6:28:27 AM10/7/10
to usr-iv...@googlegroups.com

Soupdragon

unread,
Oct 7, 2010, 12:02:31 PM10/7/10
to usr-ivybeans
Well, I'm not quite there, but it's a step in the right direction.
Seems to be working for the library I've been tinkering with, but the
project I'm publishing, which as far as I can see has pretty much the
same structure, still doesn't bring source and javadoc in, though the
structure in the repository seems very similar.

The Javadoc now appears to work, though.

On Oct 7, 11:28 am, Laurent Forêt <laurent.fo...@gmail.com> wrote:
> surely, because of that line :
>
> http://code.google.com/p/ivybeans/source/browse/trunk/ivybeans/ivy-li...
>
> Laurent
>
> On Thu, Oct 7, 2010 at 12:22 PM, Soupdragon
> <Malcolm.McMa...@costcutter.com>wrote:

Bruce Chapman

unread,
Oct 8, 2010, 4:35:27 AM10/8/10
to usr-iv...@googlegroups.com
On 7/10/2010 10:23 p.m., Soupdragon wrote:
>
> (BTW why can't Netbeans find import org.openide.util.Lookup when
> examining the ivybeans code?)
>

I had this problem using NB visual API which depends on Lookup.

up till NB 6.8 org.openide.util.Lookup was in the utilities module. in
6.9 it has moved to its own module which the utilities module now
depends on. I have the details at work, but don't have access to them
from home where I am now.

If for example you are following a pre 6.9 netbeans platform tutorial
that says depend on the utilities, then you will possibly need the
Lookup one as well (which is where I got stuck ).

I hope this answers your BTW, and points you in the right direction.

Bruce

Laurent Forêt

unread,
Oct 8, 2010, 5:03:59 AM10/8/10
to usr-iv...@googlegroups.com
Exactly, excuse my first answer, I read too fast . The Lookup feature is very usefull untill the JDK7 will be out : http://download.java.net/jdk7/docs/api/java/util/ServiceLoader.html
And before NB 6.9 the lookup was in the utility module but the Netbeans team decided that  lookup will be in its own module : http://blogs.sun.com/geertjan/entry/top_5_netbeans_platform_enhancements (The 4th accroding to Geertjan)


BTW, while seraching the article I found this usefull article : 

Soupdragon

unread,
Oct 8, 2010, 5:10:11 AM10/8/10
to usr-ivybeans
Aha! The difference appears to be that I was setting the dependency
for my own module to "latest.integration" whereas the 3rd party
library I put an exact version into.

I changed the dependency of the main module to an specific version and
the source and javadoc are now working.

On the other hand I set up the source for a 3rd party module, and the
flag appeared on it's node in ivy libraries, but on a subsequent
"Force Resolve" the flag has gone, without me changing anything.

Laurent Forêt

unread,
Oct 8, 2010, 7:22:54 AM10/8/10
to usr-iv...@googlegroups.com
On Fri, Oct 8, 2010 at 11:10 AM, Soupdragon <Malcolm...@costcutter.com> wrote:
Aha! The difference appears to be that I was setting the dependency
for my own module to "latest.integration" whereas the 3rd party
library I put an exact version into.

I changed the dependency of the main module to an specific version and
the source and javadoc are now working.

Cool.
 
On the other hand I set up the source for a 3rd party module, and the
flag appeared on it's node  in ivy libraries, but on a subsequent
"Force Resolve" the flag has gone, without me changing anything.

 
Yes it is an ugly bug in the current 1.1  version. And I don't remember if it was fixed in trunk.

Laurent
 

On Oct 7, 5:02 pm, Soupdragon <Malcolm.McMa...@costcutter.com> wrote:
> Well, I'm not quite there, but it's a step in the right direction.
> Seems to be working for the library I've been tinkering with, but the
> project I'm publishing, which as far as I can see has pretty much the
> same structure, still doesn't bring source and javadoc in, though the
> structure in the repository seems very similar.
>
> The Javadoc now appears to work, though.
>
> On Oct 7, 11:28 am, Laurent Forêt <laurent.fo...@gmail.com> wrote:
>
> > surely, because of that line :
>
> >http://code.google.com/p/ivybeans/source/browse/trunk/ivybeans/ivy-li...
>
> > Laurent
>
> > On Thu, Oct 7, 2010 at 12:22 PM, Soupdragon
> > <Malcolm.McMa...@costcutter.com>wrote:
>
> > > Is it possible that the artefacts need to have the same name as the
> > > primary classes jar, or of the jar to which they relate?

Bruce Chapman

unread,
Oct 8, 2010, 8:55:18 PM10/8/10
to usr-iv...@googlegroups.com



Exactly, excuse my first answer, I read too fast . The Lookup feature is very usefull untill the JDK7 will be out : http://download.java.net/jdk7/docs/api/java/util/ServiceLoader.html.

j.u.ServiceLoader is available in JDK 6 (and yes,  very useful).

http://download.oracle.com/javase/6/docs/api/index.html?java/util/ServiceLoader.html

Bruce

Reply all
Reply to author
Forward
0 new messages