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.
[ BUILD # : 200710050000 ] [ JDK VERSION : 1.6.0_03 ] We have JAR files that we are using in our J2SE project in the src folder. This may not be recommended, but is still legal AFAIK (was common usage in the NB 3.x days). Now, when NB tries to create a JAR of the app at the end of the build process, it tries to read the JAR files from the root of the filesystem (D:\ in my case), not from the real location, resulting in an error and not including any JAR files at all in the resulting app JAR. NB 5.x works correct here, so it's a regression. Error message in the build console: D:\activation.jar is a directory or can't be read. Not copying the libraries.
please include the complete build output. A sample project demonstrating the problem would help as well. I didn't understand how your project is setup, especially the part about putting jar files in the src directory. The reference to 3.x setup is irrelevant.
I cannot reproduce it in a small sample project, so I am attaching the project files from our real app. This is the complete build output: init: deps-jar: Compiling 1 source file to D:\P2plus\Trunk\AppServer\P2Java compile: D:\activation.jar is a directory or can't be read. Not copying the libraries. Building jar: D:\P2plus\Trunk\AppServer\dist\AppServerTrunk.jar Not copying the libraries. To run this application from the command line without Ant, try: D:\jdk6.0/bin/java -jar "D:\P2plus\Trunk\AppServer\dist\AppServerTrunk.jar" jar: BUILD SUCCESSFUL (total time: 28 seconds)
Created attachment 50266 [details] project files
the properties files content looks ok. I noticed you have edited the build-impl.xml and are keeping a backup around. Why? The problem seems to be somewhere in property resolution. The value from private.properties (file.reference.activation.jar=D:\\P2plus\\Trunk\\AppServer\\P2Java\\activation.jar) should be taken first. Do you have such file on your computer? Can you try running your app's build with Ant verbosity level set to "debug" and attach the output to the issue? The verbosity level is set in the Tools/Options dialog under Miscelaneous/Ant Thanks a lot.
I have made a backup when I switched from NB 5.5.1 to NB 6.0 but I have not manually edited build-impl.xml. The file "D:\P2plus\Trunk\AppServer\P2Java\activation.jar" exists. Now I see that the JAR files actually are being added to the resulting AppServer.jar, so it works as expected. AFAIR this was not the case with Beta 1. However I still get that strange warning "D:\activation.jar is a directory or can't be read. Not copying the libraries.". Actually, it does not have to copy the JAR files to some sub folder of \dist, because they are in the classpath and so are being added to the JAR as all other files in the classpath. But ant or NB does not seem to recognize this correctly. Attaching ant debug output.
Created attachment 51567 [details] Ant debug output.
the relevant portion of the build output: -do-jar-with-libraries: Setting project property: build.classes.dir.resolved -> D:\P2plus\Trunk\AppServer\P2Java Set property run.classpath.without.build.classes.dir = \activation.jar;\axis.jar;\commons-discovery.jar;\commons-httpclient.jar;\commons-logging.jar;\comwrapper.jar;\icemh.jar;\izmcomjni.jar;\jaxrpc.jar;\js.jar;\log4j.jar;\mail.jar;\saaj.jar;\simultan.jar;\simultan70.jar;\simultan80.jar;\svnjavahl.jar;\swing-layout.jar;\tools.jar;\Una2000.jar;\varial.jar;\varial245.jar;\varial250.jar;\varial270.jar;\webdavlib.jar;\wsdl4j.jar;\xalan.jar;\xercesImpl.jar;\xmlParserAPIs.jar;\jdom.jar;\rome-0.9.jar;\css.jar;\jtds.jar;\commons-io-1.3.2.jar;\mysql-connector-java-5.0.7-bin.jar;\junit.jar;\apcommon.jar; Setting project property: run.classpath.without.build.classes.dir -> \activation.jar;\axis.jar;\commons-discovery.jar;\commons-httpclient.jar;\commons-logging.jar;\comwrapper.jar;\icemh.jar;\izmcomjni.jar;\jaxrpc.jar;\js.jar;\log4j.jar;\mail.jar;\saaj.jar;\simultan.jar;\simultan70.jar;\simultan80.jar;\svnjavahl.jar;\swing-layout.jar;\tools.jar;\Una2000.jar;\varial.jar;\varial245.jar;\varial250.jar;\varial270.jar;\webdavlib.jar;\wsdl4j.jar;\xalan.jar;\xercesImpl.jar;\xmlParserAPIs.jar;\jdom.jar;\rome-0.9.jar;\css.jar;\jtds.jar;\commons-io-1.3.2.jar;\mysql-connector-java-5.0.7-bin.jar;\junit.jar;\apcommon.jar; Set property jar.classpath = lib/activation.jar lib/axis.jar lib/commons-discovery.jar lib/commons-httpclient.jar lib/commons-logging.jar lib/comwrapper.jar lib/icemh.jar lib/izmcomjni.jar lib/jaxrpc.jar lib/js.jar lib/log4j.jar lib/mail.jar lib/saaj.jar lib/simultan.jar lib/simultan70.jar lib/simultan80.jar lib/svnjavahl.jar lib/swing-layout.jar lib/tools.jar lib/Una2000.jar lib/varial.jar lib/varial245.jar lib/varial250.jar lib/varial270.jar lib/webdavlib.jar lib/wsdl4j.jar lib/xalan.jar lib/xercesImpl.jar lib/xmlParserAPIs.jar lib/jdom.jar lib/rome-0.9.jar lib/css.jar lib/jtds.jar lib/commons-io-1.3.2.jar lib/mysql-connector-java-5.0.7-bin.jar lib/junit.jar lib/apcommon.jar Setting project property: jar.classpath -> lib/activation.jar lib/axis.jar lib/commons-discovery.jar lib/commons-httpclient.jar lib/commons-logging.jar lib/comwrapper.jar lib/icemh.jar lib/izmcomjni.jar lib/jaxrpc.jar lib/js.jar lib/log4j.jar lib/mail.jar lib/saaj.jar lib/simultan.jar lib/simultan70.jar lib/simultan80.jar lib/svnjavahl.jar lib/swing-layout.jar lib/tools.jar lib/Una2000.jar lib/varial.jar lib/varial245.jar lib/varial250.jar lib/varial270.jar lib/webdavlib.jar lib/wsdl4j.jar lib/xalan.jar lib/xercesImpl.jar lib/xmlParserAPIs.jar lib/jdom.jar lib/rome-0.9.jar lib/css.jar lib/jtds.jar lib/commons-io-1.3.2.jar lib/mysql-connector-java-5.0.7-bin.jar lib/junit.jar lib/apcommon.jar Finding class org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs Loaded from D:\Program Files\NetBeans 6.0 Beta 2\java1\ant\extra\org-netbeans-modules-java-j2seproject-copylibstask.jar org/netbeans/modules/java/j2seproject/copylibstask/CopyLibs.class Class org.apache.tools.ant.taskdefs.Jar loaded from parent loader (parentFirst) Class org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs loaded from ant loader (parentFirst) Class java.lang.Object loaded from parent loader (parentFirst) Class java.lang.Throwable loaded from parent loader (parentFirst) Class java.lang.AssertionError loaded from parent loader (parentFirst) Class java.lang.ClassNotFoundException loaded from parent loader (parentFirst) Class java.io.IOException loaded from parent loader (parentFirst) Class org.apache.tools.ant.BuildException loaded from parent loader (parentFirst) Class java.io.Writer loaded from parent loader (parentFirst) Class java.io.FileWriter loaded from parent loader (parentFirst) Class java.util.ResourceBundle loaded from parent loader (parentFirst) Class java.io.File loaded from parent loader (parentFirst) Class java.lang.Class loaded from parent loader (parentFirst) +Datatype copylibs org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs Class org.apache.tools.ant.types.Path loaded from parent loader (parentFirst) Class java.lang.StringBuffer loaded from parent loader (parentFirst) D:\activation.jar is a directory or can't be read. Not copying the libraries. fileset: Setup scanner in dir D:\P2plus\Trunk\AppServer\P2Java with patternSet{ includes: [] excludes: [] } reassigning to tzezula.
I've found what is the problem. The project builds into the same folder where the jar files are located, the Ant <pathcovert> uses prefix to match the path element, it removes the build path even from libraries. I doubt there is a general nice solution using Ant on JDK 5.0 without script engine. Anyway the build finishes correctly, only the Class-Path attribute in the jar files has wrong paths, in the NB 3.x there was no such a feature. Anyway there is quite easy fix you can do if you are using JDK 6. You have to override the "-do-jar-with-libraries" target (copy it into build.xml form build-impl.xml) and change the first <pathconvert> to: <pathconvert property="run.classpath.without.build.classes.dir"> <path path="${run.classpath}"/> <scriptmapper language="javascript"> if (!source.equals(project.getProperty("build.classes.dir.resolved"))) { self.addMappedName(source); } </scriptmapper> </pathconvert> When the NetBeans will come with some script engine I will put it into the build-impl.
Try: <pathconvert property="run.classpath.without.build.classes.dir"> <path path="${run.classpath}"/> <regexpmapper from="^\Q${build.classes.dir.resolved}\E$|(.*)" to="\1"/> </pathconvert>
Note that this style will not work for Windows users who have folder names beginning with a capital 'E'. Such is the pleasure of Ant.
Work fine on Linux, but as it doesn't work on Windows when the folder name satarts with 'E' I am not going to add it into the NB 6.0.
Resolving all issues with milestone "future" as LATER. If you feel strongly that it should be implemented please reopen and set the target milestone to "next".
NetBeans.org Migration: changing resolution from LATER to WONTFIX