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 9527 - Ant module uses internal classpath for compilation
Summary: Ant module uses internal classpath for compilation
Status: CLOSED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 3.x
Hardware: Sun Solaris
: P2 major (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-02-09 13:46 UTC by Milan Kubec
Modified: 2003-06-30 14:45 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 Milan Kubec 2001-02-09 13:46:00 UTC
When running compilation inside IDE, ant module probably uses internal classpath
settings and ignores settings from build.xml.

Reproduction:
- Mount all source base for NetBeans.
- Get all needed binaries
- open file nbbuild/build.xml
- Set Run compilation (Tools/Option/Execution Settings) to false
- run target bootstrap - should be succesfull
- run target real-clean
- comment out pathelement <pathelement
location="${binroot}/core/release/lib/ext/regexp.jar"/> from bootstrap
- run target bootstrap - it's still succesfull
- run target bootstrap from command line - it fails
Comment 1 Jesse Glick 2001-02-09 14:19:59 UTC
As far as I know, by default Ant places the Java system classpath at the end of
the classpath used during compilation. For example, in Ant 1.3 for <javac> there
are attributes includeAntRuntime (default true), includeJavaRuntime (default
false I guess). You can override these on a particular <javac> target, or you
can I guess set build.sysclasspath to something else. Its default is equivalent
to "last", meaning append Ant classpath automatically to all classpaths. You can
also set it to "first", "only", or "ignore"; "ignore" is probably the sane one,
meaning any required entries must be explicitly listed in the build file. If you
fix this, hopefully the script will run the same way with or without the IDE,
and even on command-line it will be more reliable because you will not be
affected by the developer's classpath.
Comment 2 Milan Kubec 2001-03-12 11:29:29 UTC
Reopened, see:

My Proposal:
http://www.netbeans.org/www-nbusers/msg04694.html

Jesse's response:
http://www.netbeans.org/www-nbusers/msg04704.html

Verified that setting property build.sysclasspath to ignore works.

I'd vote for setting this property in IDE by default to ignore.
Comment 3 Jesse Glick 2001-03-26 14:07:01 UTC
Fixed in release32, will merge to trunk too. However note that due to an Ant bug
(or possible bug), if there is no <classpath/> element at all, it has no effect
and the IDE's classpath will still be used. Explicit classpath will work
correctly.

Patrick, CCing you since this might have a (small) docs impact for Ant module in
usersguide: users should not expect anything in particular in their classpath
when invoking Ant scripts from the IDE. If they want something there, it should
be added (a direct path to a library, or use of ${netbeans.class.path}, or set
<property name="build.sysclasspath" value="last"/> or similar).
Comment 4 Build Virtual User 2001-03-27 10:31:55 UTC
[build13] If I use ${netbeans.library.path} (as classpath element) in order to
build ant extensions I get:

IOException getting canonical path for [here is ${netbeans.library.path}]
File name too long.

And the compilation fail.

Also if I set property ${build.sysclasspath} to "last" inside the build script
as top level element in project element scope the property is overiden and is
set to ignore in folowing target. Setting this property in Tools|Options sets
this property correctly, but the compilation still fails. In ohter words I
cannot build IDE inside IDE.

Default setting of the property build.sysclasspath could be listed in
Tools|Options|Ant Settings|Properties along with e.g. build.compiler.emacs. IMHO
all properties set by ant module by deafult should be listed in this file. There
shouldn't be any hiden properties.
Comment 5 Jesse Glick 2001-03-27 14:36:16 UTC
Fixed in the trunk.
Comment 6 Jesse Glick 2001-03-27 15:48:06 UTC
Sorry, did not see your later comments before marking fixed. But I think it
should still be OK, reopen if necessary:

IOException getting canonical path for [here is ${netbeans.library.path}]
File name too long.
==> perhaps you are using <pathelement location="${netbeans.library.path}"/>
rather than the correct <pathelement path="${netbeans.library.path}"/>?

value overridden... ==> you are right, setting it in the build script will not
have any effect because properties set externally are considered "user"
properties and will override those set in the build script. So you should remove
the override, or change it to the one you want.

...but the compilation still fails. ==> because of the first item above??

...hidden properties. ==> it is not hidden, it is listed among the other global
properties as you suggested. The change was merely to include this one property
setting among the defaults provided by the module.
Comment 7 Build Virtual User 2001-03-28 10:07:39 UTC
Canonical path problem is fixed using path in pathelement. The property
build.sysclasspath is not hiden really :-) But if I set this property in
Tools|Optins|Ant Settings to last I'm still not able to compile sources which
depends on netbeans.library.path. Or isn't this path supposed to be added to
compilation classpath when build.sysclasspath is set to last?
Comment 8 Jesse Glick 2001-03-28 13:25:15 UTC
As far as I can tell, the module is working correctly. If you set
${build.sysclasspath} to last in Ant Settings | Global Properties, the <javac>
task will include in its classpath whatever was in the VM's classpath. This does
*not* include ant.jar (that is part of modules/ext/ and thus not part of
${java.class.path}). org.apache.tools.ant.types.Path interprets the "system
classpath" as the VM's startup classpath. It might be possible to override this
to include ${netbeans.library.path} as well when running inside the IDE; but I
think direct use of this variable by the user, when desired, is clearer and
safer.

If you wish to have ant.jar be included in the classpath for bootstrap, you must
include it somehow. Either a direct reference to ant.jar's location (best), or
${netbeans.library.path}. I have just asked Michal Zlamal to add ant.jar
directly to the classpath for the trunk version of nbbuild, by the way, as
ant.jar is now included in a known location (nbbuild/lib/ant.jar) via nbbinaries
for dev builds.
Comment 9 Quality Engineering 2003-06-30 14:45:47 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.