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 146082 - free form ant projects -- sometimes only build with command line ant
Summary: free form ant projects -- sometimes only build with command line ant
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Module System (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on: 70576 147082 199284
Blocks: 41925
  Show dependency tree
 
Reported: 2008-09-03 18:43 UTC by emiddio
Modified: 2011-06-22 13:53 UTC (History)
2 users (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 emiddio 2008-09-03 18:43:14 UTC
lots of times i have to build a free-form ant project from the command line. something goes wrong if trying to build
from within netbeans. i have seen this with sun j2ee 1.4 asant projects -- which would build with just ant -- but would
not build from within netbeans - as a free form project.

most recently building apache axis 1 -- http://www.urlstructure.com/apache/ws/axis/1_4/axis-src-1_4.zip -- some of it
will build within netbeans - but all of it builds by invoking ant from the command line.

can someone explain why/how this happens -- or if there is a way to make build.xml scripts work from withing netbeans
just like they  work outside of netbeans?
Comment 1 Jesse Glick 2008-09-05 14:58:07 UTC
First thing I notice is that

        <!ENTITY properties SYSTEM "file:xmls/properties.xml">
        <!ENTITY paths  SYSTEM "file:xmls/path_refs.xml">
        <!ENTITY taskdefs SYSTEM "file:xmls/taskdefs.xml">
        <!ENTITY targets SYSTEM "file:xmls/targets.xml">

is wrong; should be

        <!ENTITY properties SYSTEM "xmls/properties.xml">
        <!ENTITY paths  SYSTEM "xmls/path_refs.xml">
        <!ENTITY taskdefs SYSTEM "xmls/taskdefs.xml">
        <!ENTITY targets SYSTEM "xmls/targets.xml">

Same in test.xml, as Ant itself says:

test:
Warning: 'file:../xmls/properties.xml' in /tmp/axis-1_4/tools/test.xml should be expressed simply as
'../xmls/properties.xml' for compliance with other XML tools
Warning: 'file:../xmls/path_refs.xml' in /tmp/axis-1_4/tools/test.xml should be expressed simply as
'../xmls/path_refs.xml' for compliance with other XML tools
Warning: 'file:../xmls/taskdefs.xml' in /tmp/axis-1_4/tools/test.xml should be expressed simply as
'../xmls/taskdefs.xml' for compliance with other XML tools
Warning: 'file:../xmls/taskdefs_post_compile.xml' in /tmp/axis-1_4/tools/test.xml should be expressed simply as
'../xmls/taskdefs_post_compile.xml' for compliance with other XML tools
Warning: 'file:../xmls/targets.xml' in /tmp/axis-1_4/tools/test.xml should be expressed simply as '../xmls/targets.xml'
for compliance with other XML tools


Then trying to build in NB 6.5 on JDK 6 I get

.../axis-1_4/src/org/apache/axis/i18n/ProjectResourceBundle.java:363: clearCache() in
org.apache.axis.i18n.ProjectResourceBundle cannot override clearCache() in java.util.ResourceBundle; overridden method
is static final
    public static void clearCache()

which I also get from the command line. If I delete this (apparently unused) method, the build completes in NB.
Comment 2 Jesse Glick 2008-09-06 00:08:57 UTC
Reporter says that the problem is in the samples target:


Buildfile: buildSamples.xml

BUILD FAILED
XML parser factory has not been configured correctly: Provider org.netbeans.core.startup.SAXFactoryImpl not found


This is not actually a problem with the Ant module per se; core.startup sets two custom parser factories which some
class loaders cannot "see". Probably the solution would be to turn off these factories after startup is somehow
complete? Do we even have reason to believe that these factories actually improve startup performance any? They have
certainly been the cause of endless problems and I would be happy to delete them.

[BTW next time please insert comments directly into IZ - do not use personal email.]
Comment 3 Jesse Glick 2008-09-10 22:56:57 UTC
I will try to check whether the very old hack in issue #41925 can be deleted, or at least suppressed after startup is
complete.
Comment 4 Jesse Glick 2008-09-11 00:48:31 UTC
Really a problem with core, not the Ant module.
Comment 5 Jesse Glick 2008-09-11 01:02:07 UTC
Can fix while greatly simplifying code: core-main #0306dee3c170
Comment 6 Quality Engineering 2008-09-11 17:49:31 UTC
Integrated into 'main-golden', will be available in build *200809111401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/0306dee3c170
User: Jesse Glick <jglick@netbeans.org>
Log: #146082: get rid of the old custom XML factories used to fix #41925.
They have been a source of numerous bugs for four years now and counting.
If the only goal is to make requests to get XML factories use the JRE versions
rather than those from e.g. libs.xerces, that can be easily done in the system class loader.
(The original patch was also trying to delegate certain functions to Xerces and others to Crimson.
That motivation became obsolete when we dropped JDK 1.4 support.)
Comment 7 emiddio 2008-09-12 17:34:41 UTC
also -- ant 1.7.0 sources will not build in netbeans 6.1 -- the default target main; will build with ant1.7.0;

but i had problems initially building with command line ant also - ant-1.7.0-bin; and via trial/n/error i got to build
by copying the netbeans provided junit-3.8.2.jar, junit-4.1.jar files into the ant-1.7.0-bin/lib directory.

Comment 8 Jesse Glick 2008-09-12 17:38:43 UTC
There are indeed problems building Ant sources in NB 6.1 which AFAIK are resolved in NB 6.5. (Had to do with old version
of JSch shipped with NB 6.1; workaround is to add newer version to Ant CP in Options.) Additionally, Ant 1.7.x sources
fail to compile out of the box because they expect junit.jar to be in the classpath; this is fixed in Ant trunk (i.e.
1.8) sources.
Comment 9 emiddio 2008-09-12 17:51:42 UTC
please explain how to "...workaround is to add newer version to Ant CP in Options"

also -- "...they expect junit.jar to be in the classpath" -- junit.jar is provided -- can i somehow
add junit.jar to the "classpath"? -- instead of getting the 1.8 sources?

thanks

Comment 10 Jesse Glick 2008-09-12 17:53:43 UTC
Download new JSch, open Ant Settings in Options, add JAR to Ant Classpath.

To work around the junit.jar issue you could also add that to Ant Classpath.
Comment 11 Quality Engineering 2008-09-17 06:10:51 UTC
Integrated into 'main-golden', will be available in build *200809170201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/772e850e28f2
User: Jesse Glick <jglick@netbeans.org>
Log: #147082: refine fix of #146082 to work around a JAXP bug.
Comment 12 emiddio 2008-12-23 19:42:50 UTC
prev -- i got information to modify build.xml scripts to use import task -- <import ..> i believe, to not
use entities references for ant scripts.

i believe that most of my debugging issues are related to use of entities; but i am working with old code
from places like dev.java.net.

is there no way to make debugging work with entity references ? -- to set breakpoints in the tasks/code in the
files referenced by entities;

would it work to maybe have a little program to xml process the build script into one that "includes" the entities
"inline" and then use the new file as the build file ?

Comment 13 Jesse Glick 2009-01-06 02:09:57 UTC
"is there no way to make debugging work with entity references?" - _running_ the Ant script should work. Not sure
offhand about debugging the Ant script; if you can reproduce with a minimal self-contained test case you can file a
separate bug, but I doubt this would be given much priority since all Ant scripts since 1.6 should be using <import> anyway.

Regarding preprocessing the script, this might be a usable workaround for you.