ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davy Toch <davy.t...@gmail.com>
Subject ANT 1.6.5 : problem <jar> task to include files with path lengths exceeding 260 characters.
Date Sat, 15 Dec 2007 16:15:33 GMT
Hi,

There is a known issue in the JDK 1.4 and older versions on Windows 
platforms to read/write files with paths exceeding 260 characters. As a 
consequence this causes a problem in the ANT <jar> task, e.g.:

$echo %JAVA_HOME%
d:\devtools\j2sdk1.4.2_15

$cd
D:\projects\spffin\IPP_EX2006-3_VIEW\XX_Implementation\modules\CalculationWebService

$dir
 Volume in drive D is DATA
 Volume Serial Number is 0046-7936

 Directory of 
D:\projects\spffin\IPP_EX2006-3_VIEW\XX_Implementation\modules\CalculationWebService

15/12/2007  16:46    <DIR>          .
15/12/2007  16:46    <DIR>          ..
15/12/2007  16:41               159 build.xml
               1 File(s)            159 bytes

$dir 
target\generated\main\classes\be\fgov\minfin\calculipp\presentation\calculationwebservice\impl
 Volume in drive D is DATA
 Volume Serial Number is 0046-7936

 Directory of 
D:\projects\spffin\IPP_EX2006-3_VIEW\XX_Implementation\modules\CalculationWebService\target\generated\main\classes\be\fgov\minfin\calculipp\presentation\calculationwebservice\impl

15/12/2007  16:46    <DIR>          .
15/12/2007  16:46    <DIR>          ..
15/12/2007  16:41             6,271 
RequestEnrolementManuelTypeImpl$IdentificationImpl$PartnerImpl.class
15/12/2007  16:41             4,782 
RequestEnrolementManuelTypeImpl$IdentificationImpl$PreviousExerciseSeparatedImpl.class
               2 File(s)         11,053 bytes
               2 Dir(s)  35,246,559,232 bytes free

The total path of the second file in the previous listing exceeds 260 
positions.

The ANT buildfile build.xml contains :

    <project default="test" basedir=".">
          <target name="test">
                <jar destfile="test.jar" 
basedir="target/generated/main/classes"/>
          </target>
    </project>

Now if I execute this target I get:

Apache Ant version 1.6.5 compiled on June 2 2005
Buildfile: build.xml
Detected Java version: 1.4 in: d:\devtools\j2sdk1.4.2_15\jre
Detected OS: Windows XP
parsing buildfile 
D:\projects\spffin\IPP_EX2006-3_VIEW\XX_Implementation\modules\CalculationWebService\build.xml

with URI = 
file:///D:/projects/spffin/IPP_EX2006-3_VIEW/XX_Implementation/modules/CalculationWebService/build.xml
Project base dir set to: 
D:\projects\spffin\IPP_EX2006-3_VIEW\XX_Implementation\modules\CalculationWebService
Build sequence for target(s) `test' is [test]
Complete build sequence is [test, ]

test:
      [jar] Building jar: 
D:\projects\spffin\IPP_EX2006-3_VIEW\XX_Implementation\modules\CalculationWebService\test.jar
      [jar] adding directory META-INF/
      [jar] adding entry META-INF/MANIFEST.MF
      [jar] adding directory be/
      [jar] adding directory be/fgov/
      [jar] adding directory be/fgov/minfin/
      [jar] adding directory be/fgov/minfin/calculipp/
      [jar] adding directory be/fgov/minfin/calculipp/presentation/
      [jar] adding directory 
be/fgov/minfin/calculipp/presentation/calculationwebservice/
      [jar] adding directory 
be/fgov/minfin/calculipp/presentation/calculationwebservice/impl/
      [jar] adding entry 
be/fgov/minfin/calculipp/presentation/calculationwebservice/impl/RequestEnrolementManuelTypeImpl$IdentificationImpl$PartnerImpl.class

BUILD SUCCESSFUL
Total time: 0 seconds



So the second .class file isn't included! If I were to redo the 
procedure with JAVA_HOME set to point to a JDK 1.5, it would work, so 
the problem is clearly caused by the used JDK.

QUESTION

Is there a way in ANT to make the target execution fail if long files 
are detected or when the JDK version is <= 1.4? I know the actual bug is 
in the JDK, not in ANT, but now ANT silently ignores the problem and 
continues. E.g. is there a way in the ANT script build.xml to define a 
prerequirement for the JDK version on which ANT will run?

Best regards,
Davy Toch

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message