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 141237 - Mustang-style classpath wildcards not working for free-form projects
Summary: Mustang-style classpath wildcards not working for free-form projects
Status: RESOLVED DUPLICATE of bug 116185
Alias: None
Product: java
Classification: Unclassified
Component: Freeform (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Milan Kubec
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-22 22:30 UTC by carniz
Modified: 2008-07-24 14:49 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description carniz 2008-07-22 22:30:35 UTC
Using the following snippet (in nbproject/project.xml):

        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
            <compilation-unit>
                <package-root>${project.dir}/src/main/java</package-root>
                <source-level>1.5</source-level>
            </compilation-unit>
            <compilation-unit>
                <package-root>${project.dir}/src/test/java</package-root>
                <unit-tests/>
                <!--classpath
mode="compile">src/main/java;build/lib/test/log4j-1.2.15.jar;build/lib/test/testng-5.6-jdk15.jar;build/lib/test/catalina-5.5.26.jar;build/lib/test/commons-logging-1.1.1.jar;build/lib/test/catalina-optional-5.5.26.jar;build/lib/test/selenium-java-client-driver-1.0-beta-1.jar</classpath-->
		<classpath mode="compile">src/main/java;build/lib/test/'*'</classpath>
                <source-level>1.5</source-level>
            </compilation-unit>
        </java-data>

...the IDE will not be able to set up the classpath when the uncommented classpath declaration is used (<classpath
mode="compile">src/main/java;build/lib/test/'*'</classpath>)

From the command line, this works fine. Ie, if you call javac with the following argument (from one of the package
folders of the test source tree):

$ javac -cp ../../../../../../../build/lib/test/'*' *.java

...then the classpath wildcard expansion works as expected.

(Note: I have also tried without the single quotes around the asterisk (*) in nbproject/project.xml, but without luck)

This limitation is quite irritating when you retrieve dependencies with build tools such as Ivy
(http://ant.apache.org/ivy), since each time you add a new dependency jar file in the ivy.xml file, you will have to add
the path to this jar file in the NB project file as well. The common strategy with tools such as Maven/Ivy is to group
dependencies in configurations such as "compile","test","runtime" (etc), which (eg) means that all dependencies needed
for compiling the test source can be retrieved into a single directory (say, builddeps/test)

If NB could use wildcards for the classpath, you would be able to tell NB something like: "just use whatever jar files
you find in builddeps/test as the classpath for the test source, and whatever jar files you find in builddeps/compile as
the classpath for the main source". That would really make life easier for those who retreieve dependencies with
Ant+Ivy, but unfortunately, it doesn't seem to work right now.
Comment 1 Milan Kubec 2008-07-23 07:59:48 UTC
'.../*.jar' doesn't work for you?
Comment 2 carniz 2008-07-23 10:04:20 UTC
Nope.

Neither does
'build/lib/test/*'
'build/lib/test/*.jar'
'build/lib/test/'*.jar'

And that's at the "hackish" level (modifying the project.xml file in editor)

From Project->Properties->Java Sources Classpath->Add JAR/Folder, there is only the option to choose a directory (where
compiled classes are stored) or individual .jar files. In short, the filechooser also has to support wildcards if we
don't want to require the users to hack the project.xml file to use wildcards.
Comment 3 Milan Kubec 2008-07-24 14:00:45 UTC
Jesse, was the <classpath> element designed to understand wildcards? If not, this is not a defect but RFE.
Comment 4 Jesse Glick 2008-07-24 14:49:25 UTC
No, it is not supported.

You may have better luck using the new experimental

http://wiki.netbeans.org/AutomaticProjects

*** This issue has been marked as a duplicate of 116185 ***