This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 114734 - Classpath problems in Freeform projects
Summary: Classpath problems in Freeform projects
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Freeform (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-05 10:58 UTC by gborkowski
Modified: 2010-01-11 04:28 UTC (History)
0 users

See Also:
Issue Type: TASK
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gborkowski 2007-09-05 10:58:50 UTC
Freeform projects support in NetBeans is a great thing, but it has several drawbacks, very annoying for me and
discouraging to freeform projects. This especially touches classpath settings. This was already a problem in 5.5, I
can't believe it is not going to change in 6.0.
So the problems are:
 1. No possibility to specify classpath for test packages in project properties window (for IDE code completion etc). In
normal circumstances, unit test classpath consists of three parts: compiled classes from source packages + classpath of
source packages + additional classpath for tests; currently only the first part works, I must manually edit project.xml
file to fix it; I think it should be in the following way: compiled classes and sources classpath are added
automatically to tests classpath + there should be an option to specify additional test classpath in project properties
dialog (as it is now for "Web Sources Classpath")
 2. All jars for code completion must be enumerated explicitly. It is horrible - you must edit classpath everytime you
add/remove a jar. Normally nobody enumerates explicitly jars in Ant file, instead one uses wildcards, e.g  lib/*.jar. 
It should be done exactly the some in the IDE: either simply be able to specify a folder with jars, or be able to use
wildcards in classpath settings. This would be very helpful.
 3. No option of associate IDE classpath with Ant classpath by its ID from Ant. It would be the best option: good Ant
file declares classpath as separate element with ID, e.g. <path id="test.classpath">. In the IDE I should be able to use
 this ID instead of duplicating classpath settings from Ant. 
 4. No option to specify Javadoc for code completion. Currently I cannot find a way to associate a Javadoc
jar/zip/folder to be used at code completion by an IDE. Adding it to classpath does not work. Library Manager is also
not valid in freeform projects. And definitely it is not a thing which can be defined in Ant script. So there should be
separate option in freeform project properties dialog to define javadoc for code completion (proabably separate for java
sources, web sources, and tests, with similar rules as classpath, i.e. test include java source automatically).
Comment 1 Milan Kubec 2007-09-07 16:27:09 UTC
ad 1) You can define classpath for test source root the same way as for any other source root - in project customizer on
Java Sources Classpath panel (if you define test source root in the first panel - Java Sources).

ad 2) Might be considered as an option, but the UI for that will be kind of difficult. There would have to be some list
of folders and each folder needs some include/exclude pattern definition. And of course final list of jar files will
have to be displayed as well.

ad 3) We've been considering that with relation to automated build script parsing to find out important locations for
the project.

ad 4) You can create library using Library Manager and if you specify library classpath and javadoc it will be used in
code completion in editor.

Changing status of the issue to Enhancement. There will be probably some changes in freeform project in major post 6.0
release.
Comment 2 gborkowski 2007-09-10 11:30:15 UTC
Ad 1) Looks like you are right. Somehow I did not find out that i can use drop down list. My mistake.

Ad 2) I thing simply using wildcards will be sufficient. E.g 
<classpath mode="compile">lib/*.jar</classpath>
instead of 
<classpath mode="compile">lib/commons-dbcp-1.2.2.jar;lib/commons-logging-1.1.jar;lib/commons-logging-adapters-1.1.jar;
......</classpath>
In project customizer the final list of jars is not needed I think: simple single entry lib/*.jar would be sufficient.

Ad 3) This feature would be very useful, I think: this would lessen a need for implementing point 2.
In project customizer dialog, there can be an option to either enumerate jars, or select path ID from Ant.

Ad 4) I found it too. Not very intuitive, but works. But there is no word about this in any help/documentation.

So points 1 and 4 are invalid (with notice for point 4 that it should be better documented). Points 2 and 3 remain.
Comment 3 bruff 2007-09-24 19:39:18 UTC
For item 4 I've successfully created an Ant task to generate a valid Library file (valid for 5.5 at least).  Here it is
for whatever it is worth - is there a good Wiki location to add this as an example?
    <macrodef name="generate.netbean.library.file">
        <attribute name="classpath" default="project.class.path"/>  
        <attribute name="srcpath" default="project.libs.src.path"/>
        <attribute name="javadocpath" default="project.libs.javadoc.path"/>
        <sequential>
            <makeurl property="classpath" separator="!/&lt;/resource>&lt;resource>jar:">
                <path refid="@{classpath}"/>
            </makeurl>
            <makeurl property="srcpath" separator="&lt;/resource>&lt;resource>">
                <path refid="@{srcpath}"/>
            </makeurl>
            <makeurl property="javadocpath" separator="&lt;/resource>&lt;resource>">
                <path refid="@{javadocpath}"/>
            </makeurl>            
            <echo file="${ant.project.name}.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library PUBLIC "-//NetBeans//DTD Library Declaration 1.0//EN"
"http://www.netbeans.org/dtds/library-declaration-1_0.dtd">
<library version="1.0">
        <name>${ant.project.name}</name>
        <type>j2se</type>
        <volume>
                <type>classpath</type>
                <resource>jar:${classpath}!/</resource>
        </volume>
        <volume>
                <type>src</type>
                <resource>${srcpath}</resource>
        </volume>
        <volume>
                <type>javadoc</type>
                <resource>${javadocpath}</resource>
        </volume>
</library>
            ]]></echo> 
        </sequential>
    </macrodef>
Comment 4 Milan Kubec 2007-09-27 15:01:24 UTC
There is wiki topic: http://wiki.netbeans.org/wiki/view/NetBeansUserFAQ#section-NetBeansUserFAQ-FreeformProjects, do you
have an account for nb wiki? Will you add it there?
Comment 5 Milan Kubec 2008-10-17 08:59:42 UTC
Changing to TASK to include the script in nb wiki. Other mentioned points are either misunderstandings or will be
addressed in Automatic projects.
Comment 6 Antonin Nebuzelsky 2010-01-11 04:28:54 UTC
Changing the default component owner to tzezula.