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.
I have an ant script from an existing project, so I tried creating a Free Form Java Application. I can run it from the command line and it builds fine. When I try to build from within netbeans it gives me some errors related to xslt transformation that is used in out ant script. I am assuming it has something to do with the xslt libraries that ship with Netbeans. I can get around this problem if I can launch the ant target in a new process (like in fork). That way Netbeans' libraries wont impact the ant script. I cant find a way to do this.
Reassigning to "java".
Can you please provide error message and the related part of build script?
This is part of the build.xml This works fine on an ant instance outside Netbeans ( using ant 1.7.0 or 1.7.1 ), but not from within Netbeans. --------- <target name="genHbm" depends="checkMappingDependencies, compile-schema, copy-schemas" unless="hbmBuild.notRequired"> <mkdir dir="${build.ddl}/tmp" /> <ac:for list="${schemaFileList}" param="filename"> <sequential> <echo message="-----------------------------" /> <echo message="FILENAME = @{filename}" /> <copy toFile="${build.ddl}/tmp/@{filename}.preexpand" file="${build.schema}/@{filename}.xml" /> <switch value="@{filename}"> <case value="core"> <expandNamespaces filename="@{filename}" expression="www.core." /> </case> <case value="testSchema"> <expandNamespaces filename="@{filename}" expression="www.test." /> </case> <case value="qaSchema"> <expandNamespaces filename="@{filename}" expression="www.qatest." /> </case> </switch> <xslt style="${src.root}/schema/src/schemaToHbmPass1.xslt" in="${build.ddl}/tmp/@{filename}.postexpand" out="${build.ddl}/tmp/@{filename}.postxslt1" classpathref="saxonpath"/> </sequential> </ac:for>
Here is the error I see in the ant instance run through netbeans: -- Processing /home/navneet/src-tree/try-ant/some-component/build/ddl/tmp/core.preexpand to /home/navneet/src-tree/try-ant/some-component/build/ddl/tmp/core.postexpand Loading stylesheet /home/navneet/src-tree/try-ant/some-component/schema/src/expandNamespaces.xslt Processing /home/navneet/src-tree/try-ant/some-component/build/ddl/tmp/core.postexpand to /home/navneet/src-tree/try-ant/some-component/build/ddl/tmp/core.postxslt1 Loading stylesheet /home/navneet/src-tree/try-ant/some-component/schema/src/schemaToHbmPass1.xslt : Warning! file:/home/navneet/src-tree/try-ant/some-component/schema/src/schemaToHbmPass1.xslt: line 199: Attribute 'not-null' outside of element. : Warning! file:/home/navneet/src-tree/try-ant/some-component/schema/src/schemaToHbmPass1.xslt: line 199: Attribute 'not-null' outside of element. : Warning! file:/home/navneet/src-tree/try-ant/some-component/schema/src/schemaToHbmPass1.xslt: line 199: Attribute 'not-null' outside of element. : Warning! file:/home/navneet/src-tree/try-ant/some-component/schema/src/schemaToHbmPass1.xslt: line 199: Attribute 'not-null' outside of element. : Warning! file:/home/navneet/src-tree/try-ant/some-component/schema/src/schemaToHbmPass1.xslt: line 199: Attribute 'not-null' outside of element. : Warning! file:/home/navneet/src-tree/try-ant/some-component/schema/src/schemaToHbmPass1.xslt: line 293: Attribute 'shortName' outside of element. : Error! Error checking type of the expression 'funcall(tokenize, [variable-ref(translatedInput/string), literal-expr(,)])'. : Fatal Error! Could not compile stylesheet Failed to process /home/navneet/src-tree/try-ant/some-component/build/ddl/tmp/core.postexpand
Removing the incomplete keyword since i've added the xml and the result from netbeans.
Did you install any extensions to command line Ant? Or did you install any extensions to JDK itself?
Setting INCOMPLETE again until there are some answers to questions in last comment.
I did not install any extensions. I just set the ant location from the options dialog.
I tried to reproduce your use case and it works for me. I've created simple freeform with build.xml just with xsl transformation and changed Ant location in Tools | Options to external Ant and it still works for me. Doesn't your script rely on something that is set via CLASSPATH system variable. What 'saxonpath' reference refers to? Doesn't seem to be NetBeans problem rather some environment specific setting.
If that is the case, why does running the same ant script from commandline using the same ant installation work ?
Well, there probably is some issue with XML related libraries used by Ant when running inside IDE. navneet, what contains your CLASSPATH system variable? Jesse, do you have any idea how to override NetBeans XML related libraries for running freeform Ant script?
I have nothing specific added on my machine. Whatever is used is for the build process and thats happening from within the chain of ant files that are running for the build to complete.
XML-related libraries are notoriously finicky in this regard. The way implementations are found in various class loaders (by JAXP and to some extent by impls themselves) is complex, poorly standardized, and prone to all kinds of environmental failures. Generally you get it working by trial and error. Not a P2 since the XSLT processor could be run by forking a process. Most simply, launch the Ant main class with the appropriate args and ${ant.core.lib} in CP. INCOMPLETE until a complete, self-contained, reproducible test case is supplied.
Created attachment 87115 [details] Sample that recreates the bug
Attaching a sample that works from the commandline on ant 1.7.1 but does not work from within Netbeans, even if Netbeans has been configured to use the same ant installation.
Will look at it when I have some time. Not an immediate priority since it's unlikely there's anything to be done about on NB's side anyway.
If you add <factory name="net.sf.saxon.TransformerFactoryImpl"/> (to override the Xalan-XSLTC transformer which is the default in the Sun JDK) and use a build of Ant 1.8.0, it works fine from either the command line or NetBeans. (There are various problems with class loading from bundled tasks in Ant 1.7.1 that will be fixed in 1.8.0.)