This is from Ant User...someone is running ant in their own bat file, with a classpath containing entries like \\PC03\jclasses\lib\ant-1.7.0.jar on the classpath. Ant is failing while trying to create the URI of the file java.lang.IllegalArgumentException: URI has an authority component at java.io.File.<init>(Unknown Source) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.apache.tools.ant.launch.Locator.fromURI(Locator.java:165) at org.apache.tools.ant.launch.Locator.getResourceSource(Locator.java:119) at org.apache.tools.ant.launch.Locator.getClassSource(Locator.java:90) at org.apache.tools.ant.Project.setAntLib(Project.java:313) at org.apache.tools.ant.Project.initProperties(Project.java:309) at org.apache.tools.ant.Project.init(Project.java:295) at org.apache.tools.ant.Main.runBuild(Main.java:663) at org.apache.tools.ant.Main.startAnt(Main.java:199) at org.apache.tools.ant.Main.start(Main.java:161) at org.apache.tools.ant.Main.main(Main.java:250)
This is related to Java bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5086147 new File(file1.toURI().toString()) fails if file1 is a network file. this is seemingly fixed in Java1.6, though I can still get our (new) test to fail on java1.6
*** Bug 42422 has been marked as a duplicate of this bug. ***
Believe this is fixed in Ant1.7.1; re-open if this is not the case.
doing \\somesystem\ant\bin\ant -version -using 2/14/08 nightly (1.8.0alpha) java.lang.ClassNotFoundException: org.apache.tools.ant.Main at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:255) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
...yes, I can confirm this too. C:\Documents and Settings\slo>\\morzine\slo\Java\Apache\ant\bin\ant.bat -version java.lang.ClassNotFoundException: org.apache.tools.ant.Main at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:255) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) -debug, -verbose, -diagnostics options don't get a look in
A bit more logging on failures and we see what is going on : C:\>\\morzine\slo\Java\Apache\ant\bin\ant.bat Unable to locate tools.jar. Expected to find it in C:\Java\lib\tools.jar Failed to locateorg.apache.tools.ant.Main ant.home\\morzine\slo\Java\Apache\ant\bin\.. Classpath: \\morzine\slo\Java\Apache\ant\bin\..\lib\ant-launcher.jar Launcher JAR: C:\morzine\slo\Java\Apache\ant\lib\ant-launcher.jar launcher Directory: C:\morzine\slo\Java\Apache\ant\lib C:\> We are failing to correctly determine the path to the launcher JAR, and hence to ANT_HOME
More logging shows that the URL is being correct C:\>\\morzine\slo\Java\Apache\ant\bin\ant.bat org/apache/tools/ant/launch/Launcher.class is in jar:file://morzine/slo/Java/Apa che/ant/lib/ant-launcher.jar!/org/apache/tools/ant/launch/Launcher.class This puts the bug in fromURIJava13
Fixed in Ant1.8; leave it to kevin to see if he wants to add it to ant 1.7
*** Bug 45846 has been marked as a duplicate of this bug. ***
An apparently related bug: using a basic <import> in a project located on a UNC share works in 1.7.0 and 1.8 dev but not in 1.7.1. See http://www.netbeans.org/nonav/issues/show_bug.cgi?id=146948 for details. SVN logs confusingly has two entries for this bug: ------------------------------------------------------------------------ r631263 | stevel | 2008-02-26 10:52:51 -0500 (Tue, 26 Feb 2008) | 1 line Bug 42275 running ant off a network share can cause Ant to fail ------------------------------------------------------------------------ r533082 | stevel | 2007-04-27 08:45:53 -0400 (Fri, 27 Apr 2007) | 9 lines Bug 42275: ant doesnt run from a network share, because of an error when trying to work out where we loaded from. 1. this exception is still raised, but caught and causes ant to skip setting ant.lib. 2. we now have a test class for Locator 3. I've split out the java1.3 support and made it public, so we can test it separately. One of the tests is failing, showing the problem is still there. We need to decide what to do about it (ignore, switch to java1.3 code...) ------------------------------------------------------------------------
I fixed the import issue in 1.7.1 (as reported in Bug 45846) by using dirname to get the base path of the importing file, e.g. <dirname property="masterbuild.basedir" file="${ant.file.masterbuild}"/> <import file="${masterbuild.basedir}/build-utils.xml"/> This shows that the dirname task at least can work where things are on the file system. HTH
The minimal fix for the UNC import problem in Ant 1.7.1 (which I think should be merged to a 1.7.2 if one is created, since this is a serious regression), borrowed from SVN r631263: Index: src/main/org/apache/tools/ant/launch/Locator.java =================================================================== --- src/main/org/apache/tools/ant/launch/Locator.java (revision 700534) +++ src/main/org/apache/tools/ant/launch/Locator.java (working copy) @@ -275,7 +275,8 @@ path = decodeUri(uri); String cwd = System.getProperty("user.dir"); int posi = cwd.indexOf(":"); - if ((posi > 0) && path.startsWith(File.separator)) { + if ((posi > 0) && path.startsWith(File.separator) + /* #42275: UNC */ && !path.startsWith("\\\\")) { path = cwd.substring(0, posi + 1) + path; } } catch (UnsupportedEncodingException exc) {
the fix svn revision is 42275
sorry, 631263 http://svn.eu.apache.org/viewvc?view=rev&revision=631263
FYI - for NetBeans 6.5 we are just shipping the Locator.java minipatch shown above.