You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Martin Porter <ma...@liberica.com> on 2003/02/13 17:47:17 UTC
JAR update="true" bug
I am experiencing problems with updating a JAR file and see in the
archives that it is a bug which is reported to be fixed in the latest
nightly
build but I have just taken that and it still does not work. My task is very
simple:-
<target name="update_framework_server_jar" depends="jar_server_framework">
<jar update="true"
jarfile="${liberica.jarsReg}/FrameworkServer_v1.0.jar">
<fileset dir="${liberica.classesEJB}">
<include name="com/liberica/framework/ejb/**"/>
</fileset>
</jar>
</target>
The error I am getting (unlike some of the other posts) which I have cut
down
for readability is:-
update_framework_server_jar:
[jar] adding entry com/liberica/tools/deploy/LibericaDeploy.class from
E:\Liberica\Deployment\BuildZone\inventix14\jars\reg\FrameworkServer_v1.0.ja
r
[jar] adding entry com/liberica/tools/deploy/LibericaDeployGUI.class
from
E:\Liberica\Deployment\BuildZone\inventix14\jars\reg\FrameworkServer_v1.0.ja
r
[jar] adding entry com/liberica/tools/support/PlatformDetector.class
from
E:\Liberica\Deployment\BuildZone\inventix14\jars\reg\FrameworkServer_v1.0.ja
r
[jar] adding entry
com/liberica/tools/support/RunPlatformDetector.class from
E:\Liberica\Deployment\BuildZone\inventix14\jars\reg\FrameworkServer_v1.0.ja
r
[jar] closing input stream from
E:\Liberica\Deployment\BuildZone\inventix14\jars\reg\FrameworkServer_v1.0.ja
r
[jar] com\liberica\framework\ejb added as com/liberica/framework/ejb
doesn't exist.
[jar] com\liberica\framework\ejb\common added as
com/liberica/framework/ejb/common doesn't exist.
[jar] com\liberica\framework\ejb\common\CommonServicesBean.class added
as com/liberica/framework/ejb/common/CommonServicesBean.class doesn't exist.
[jar] com\liberica\framework\ejb\common\CommonServicesBeanEJB.class
added as com/liberica/framework/ejb/common/CommonServicesBeanEJB.class
doesn't exist.
[jar] com\liberica\framework\ejb\common\CommonServicesBeanHome.class
added as com/liberica/framework/ejb/common/CommonServicesBeanHome.class
doesn't exist.
[jar] com\liberica\framework\ejb\common\LanguageBean.class added as
com/liberica/framework/ejb/common/LanguageBean.class doesn't exist.
[jar] com\liberica\framework\ejb\common\LanguageBeanEJB.class added as
com/liberica/framework/ejb/common/LanguageBeanEJB.class doesn't exist.
[jar] com\liberica\framework\ejb\common\LanguageBeanHome.class added
as com/liberica/framework/ejb/common/LanguageBeanHome.class doesn't exist.
[jar] com\liberica\framework\ejb\common\SecurityBean.class added as
com/liberica/framework/ejb/common/SecurityBean.class doesn't exist.
[jar] com\liberica\framework\ejb\common\SecurityBeanEJB.class added as
com/liberica/framework/ejb/common/SecurityBeanEJB.class doesn't exist.
[jar] com\liberica\framework\ejb\common\SecurityBeanHome.class added
as com/liberica/framework/ejb/common/SecurityBeanHome.class doesn't exist.
[jar] com\liberica\framework\ejb\common\ServerContextBean.class added
as com/liberica/framework/ejb/common/ServerContextBean.class doesn't exist.
[jar] com\liberica\framework\ejb\common\ServerContextBeanEJB.class
added as com/liberica/framework/ejb/common/ServerContextBeanEJB.class
doesn't exist.
[jar] com\liberica\framework\ejb\common\ServerContextBeanHome.class
added as com/liberica/framework/ejb/common/ServerContextBeanHome.class
doesn't exist.
BUILD FAILED
file:///E:/Liberica/Deployment/ApacheAnt/Build/BuildFiles/build-inventIX.xml
:305: Unable to rename old file to temporary file
at org.apache.tools.ant.taskdefs.Zip.executeMain(Zip.java:399)
at org.apache.tools.ant.taskdefs.Zip.execute(Zip.java:323)
at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:227)
at org.apache.tools.ant.Task.perform(Task.java:388)
at org.apache.tools.ant.Target.execute(Target.java:309)
at org.apache.tools.ant.Target.performTasks(Target.java:336)
at org.apache.tools.ant.Project.executeTarget(Project.java:1389)
at org.apache.tools.ant.Project.executeTargets(Project.java:1263)
at org.apache.tools.ant.Main.runBuild(Main.java:611)
at org.apache.tools.ant.Main.start(Main.java:198)
at org.apache.tools.ant.Main.main(Main.java:245)
Looking at the trace it seems to been reading the existing JAR and adding
the new items at
the end of the JAR process but then failing to rename the temporary one.
I have tried running on Windows 2000 and have tried setting both TEMP & TMP
variables
in my script that runs Ant but it does not solve the problem. This is with
the latest
nightly build of ant taken today.
Is this related to the original problem or am I barking up the wrong
tree...?
Thanks
Martin
Re: JAR update="true" bug
Posted by Stefan Bodewig <bo...@apache.org>.
On Fri, 14 Feb 2003, Mark Imel <mi...@imelshire.com> wrote:
> This is why (in my scenario), The jar was previously used in a javac
> command as part of the classpath for the compiler. Therefore, there
> was an existing handle that wasn't released to the jar file.
Ahh, good catch.
This is a known problem with Sun's javac implementation and not
directly related to update="true" at all. We should add some pointer
in the docs as well as the FAQ.
Stefan
Re: JAR update="true" bug
Posted by Mark Imel <mi...@imelshire.com>.
I just came across the same exact scenario.
This is what i discovered...
When i was running ant from within my IDE (IDEA from intellij) this error
wouldn't repro.
But, when i ran ant from a standalone terminal, it did repro...
This is why (in my scenario),
The jar was previously used in a javac command as part of the classpath for
the compiler.
Therefore, there was an existing handle that wasn't released to the jar
file.
To fix this, i added a fork="true" to the previous javac task.
Hope this helps,
--mark
----- Original Message -----
From: "Antoine Levy-Lambert" <le...@tiscali-dsl.de>
To: "Ant Users List" <us...@ant.apache.org>; <ma...@liberica.com>
Sent: Friday, February 14, 2003 8:34 AM
Subject: Re: JAR update="true" bug
> Martin,
> I cannot reproduce your problem. I have run the JarTest
> (org.apache.tools.ant.taskdefs.JarTest) against the build of the 13th of
> Feb, and I do not encounter this problem of locked jar file, which I know
> from some days in January.
>
> Back in Jan, one could see on Win2K updating of a jarfile built in the
same
> ant run was also failing like in your stack trace :
>
>
file:///E:/Liberica/Deployment/ApacheAnt/Build/BuildFiles/build-inventIX.xml
> > :305: Unable to rename old file to temporary file
> > at org.apache.tools.ant.taskdefs.Zip.executeMain(Zip.java:399)
> > at org.apache.tools.ant.taskdefs.Zip.execute(Zip.java:323)
> > at
> > org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:227)
> > at org.apache.tools.ant.Task.perform(Task.java:388)
> > at org.apache.tools.ant.Target.execute(Target.java:309)
> > at org.apache.tools.ant.Target.performTasks(Target.java:336)
> > at org.apache.tools.ant.Project.executeTarget(Project.java:1389)
> > at
org.apache.tools.ant.Project.executeTargets(Project.java:1263)
> > at org.apache.tools.ant.Main.runBuild(Main.java:611)
> > at org.apache.tools.ant.Main.start(Main.java:198)
> > at org.apache.tools.ant.Main.main(Main.java:245)
>
>
> The JarTest test suite was then failing at
> testRecreateWithUpdateAdditionalFiles.
>
> Try this (ant -version) to make sure which version you are using :
>
>
> sample output on my computer :
>
> $ ant -version
> Apache Ant version 1.6alpha compiled on February 10 2003
>
> here my test results (I get the same results with the fresh code from CVS
> and with a build of Feb 10, 2003)
>
> $ ant -Dtestcase=org.apache.tools.ant.taskdefs.JarTest run-single-test
>
> Buildfile: build.xml
> prepare:
> check_for_optional_packages:
> build:
> [copy] Copying 2 files to C:\dev\gnu\ant\build\classes
> compile-tests:
> run-single-test-only:
> [junit] Testsuite: org.apache.tools.ant.taskdefs.JarTest
> [junit] Tests run: 19, Failures: 0, Errors: 1, Time elapsed: 40,759
sec
> [junit] Testcase: test1 took 0,11 sec
> [junit] Testcase: test2 took 0,03 sec
> [junit] Testcase: test3 took 0,07 sec
> [junit] Testcase: test4 took 0,11 sec
> [junit] Testcase: testNoRecreateWithoutUpdate took 2,614 sec
> [junit] Testcase: testNoRecreateWithUpdate took 2,583 sec
> [junit] Testcase: testRecreateWithoutUpdateAdditionalFiles took 2,985
> sec
> [junit] Testcase: testRecreateWithUpdateAdditionalFiles took 2,914 sec
> [junit] Testcase: testRecreateWithoutUpdateNewerFile took 2,614 sec
> [junit] Testcase: testRecreateWithUpdateNewerFile took 2,603 sec
> [junit] Testcase: testManifestStaysIntact took 3,205 sec
> [junit] Caused an ERROR
> [junit] Unable to delete file
> C:\dev\gnu\ant\src\etc\testcases\taskdefs\jartmp\manifest
>
> [junit] file:///C:/dev/gnu/ant/src/etc/testcases/taskdefs/jar.xml:167:
> Unable to delete file
> C:\dev\gnu\ant\src\etc\testcases\taskdefs\jartmp\manifest
>
> [junit] at
> org.apache.tools.ant.taskdefs.Delete.removeDir(Delete.java:537)
> [junit] at
> org.apache.tools.ant.taskdefs.Delete.execute(Delete.java:476)
> [junit] at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:227)
> [junit] at org.apache.tools.ant.Task.perform(Task.java:388)
> [junit] at org.apache.tools.ant.Target.execute(Target.java:309)
> [junit] at org.apache.tools.ant.Target.performTasks(Target.java:336)
> [junit] at
> org.apache.tools.ant.Project.executeTarget(Project.java:1389)
> [junit] at
> org.apache.tools.ant.BuildFileTest.executeTarget(BuildFileTest.java:265)
> [junit] at
> org.apache.tools.ant.taskdefs.JarTest.tearDown(JarTest.java:79)
> [junit] at junit.framework.TestCase.runBare(TestCase.java:143)
> [junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
> [junit] at
junit.framework.TestResult.runProtected(TestResult.java:124)
> [junit] at junit.framework.TestResult.run(TestResult.java:109)
> [junit] at junit.framework.TestCase.run(TestCase.java:131)
> [junit] at junit.framework.TestSuite.runTest(TestSuite.java:173)
> [junit] at junit.framework.TestSuite.run(TestSuite.java:168)
> [junit] at
>
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRu
> nner.java:323)
> [junit] at
>
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask
> .java:861)
> [junit] at
>
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.jav
> a:552)
> [junit] at
>
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.jav
> a:528)
> [junit] at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:227)
> [junit] at org.apache.tools.ant.Task.perform(Task.java:388)
> [junit] at org.apache.tools.ant.Target.execute(Target.java:309)
> [junit] at org.apache.tools.ant.Target.performTasks(Target.java:336)
> [junit] at
> org.apache.tools.ant.Project.executeTarget(Project.java:1389)
> [junit] at
> org.apache.tools.ant.Project.executeTargets(Project.java:1263)
> [junit] at org.apache.tools.ant.Main.runBuild(Main.java:611)
> [junit] at org.apache.tools.ant.Main.start(Main.java:198)
> [junit] at org.apache.tools.ant.Main.main(Main.java:245)
>
> [junit] Testcase: testManifestStaysIntactTestcase:
> testNoRecreateBasedirExcludesWithUpdate took 2,594 sec
> [junit] Testcase: testNoRecreateBasedirExcludesWithoutUpdate took
2,593
> sec
> [junit] Testcase: testNoRecreateZipfilesetExcludesWithUpdate took
2,604
> sec
> [junit] Testcase: testNoRecreateZipfilesetExcludesWithoutUpdate took
> 2,604 sec
> [junit] Testcase: testRecreateZipfilesetWithoutUpdateAdditionalFiles
> took 2,604 sec
> [junit] Testcase: testRecreateZipfilesetWithUpdateAdditionalFiles took
> 2,633 sec
> [junit] Testcase: testRecreateZipfilesetWithoutUpdateNewerFile took
> 2,614 sec
> [junit] Testcase: testRecreateZipfilesetWithUpdateNewerFile took 2,634
> sec
>
>
> BUILD FAILED
>
> file:///C:/dev/gnu/ant/build.xml:1631: Test
> org.apache.tools.ant.taskdefs.JarTest failed
>
>
>
> Total time: 49 seconds
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
Re: JAR update="true" bug
Posted by Antoine Levy-Lambert <le...@tiscali-dsl.de>.
Martin,
I cannot reproduce your problem. I have run the JarTest
(org.apache.tools.ant.taskdefs.JarTest) against the build of the 13th of
Feb, and I do not encounter this problem of locked jar file, which I know
from some days in January.
Back in Jan, one could see on Win2K updating of a jarfile built in the same
ant run was also failing like in your stack trace :
file:///E:/Liberica/Deployment/ApacheAnt/Build/BuildFiles/build-inventIX.xml
> :305: Unable to rename old file to temporary file
> at org.apache.tools.ant.taskdefs.Zip.executeMain(Zip.java:399)
> at org.apache.tools.ant.taskdefs.Zip.execute(Zip.java:323)
> at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:227)
> at org.apache.tools.ant.Task.perform(Task.java:388)
> at org.apache.tools.ant.Target.execute(Target.java:309)
> at org.apache.tools.ant.Target.performTasks(Target.java:336)
> at org.apache.tools.ant.Project.executeTarget(Project.java:1389)
> at org.apache.tools.ant.Project.executeTargets(Project.java:1263)
> at org.apache.tools.ant.Main.runBuild(Main.java:611)
> at org.apache.tools.ant.Main.start(Main.java:198)
> at org.apache.tools.ant.Main.main(Main.java:245)
The JarTest test suite was then failing at
testRecreateWithUpdateAdditionalFiles.
Try this (ant -version) to make sure which version you are using :
sample output on my computer :
$ ant -version
Apache Ant version 1.6alpha compiled on February 10 2003
here my test results (I get the same results with the fresh code from CVS
and with a build of Feb 10, 2003)
$ ant -Dtestcase=org.apache.tools.ant.taskdefs.JarTest run-single-test
Buildfile: build.xml
prepare:
check_for_optional_packages:
build:
[copy] Copying 2 files to C:\dev\gnu\ant\build\classes
compile-tests:
run-single-test-only:
[junit] Testsuite: org.apache.tools.ant.taskdefs.JarTest
[junit] Tests run: 19, Failures: 0, Errors: 1, Time elapsed: 40,759 sec
[junit] Testcase: test1 took 0,11 sec
[junit] Testcase: test2 took 0,03 sec
[junit] Testcase: test3 took 0,07 sec
[junit] Testcase: test4 took 0,11 sec
[junit] Testcase: testNoRecreateWithoutUpdate took 2,614 sec
[junit] Testcase: testNoRecreateWithUpdate took 2,583 sec
[junit] Testcase: testRecreateWithoutUpdateAdditionalFiles took 2,985
sec
[junit] Testcase: testRecreateWithUpdateAdditionalFiles took 2,914 sec
[junit] Testcase: testRecreateWithoutUpdateNewerFile took 2,614 sec
[junit] Testcase: testRecreateWithUpdateNewerFile took 2,603 sec
[junit] Testcase: testManifestStaysIntact took 3,205 sec
[junit] Caused an ERROR
[junit] Unable to delete file
C:\dev\gnu\ant\src\etc\testcases\taskdefs\jartmp\manifest
[junit] file:///C:/dev/gnu/ant/src/etc/testcases/taskdefs/jar.xml:167:
Unable to delete file
C:\dev\gnu\ant\src\etc\testcases\taskdefs\jartmp\manifest
[junit] at
org.apache.tools.ant.taskdefs.Delete.removeDir(Delete.java:537)
[junit] at
org.apache.tools.ant.taskdefs.Delete.execute(Delete.java:476)
[junit] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:227)
[junit] at org.apache.tools.ant.Task.perform(Task.java:388)
[junit] at org.apache.tools.ant.Target.execute(Target.java:309)
[junit] at org.apache.tools.ant.Target.performTasks(Target.java:336)
[junit] at
org.apache.tools.ant.Project.executeTarget(Project.java:1389)
[junit] at
org.apache.tools.ant.BuildFileTest.executeTarget(BuildFileTest.java:265)
[junit] at
org.apache.tools.ant.taskdefs.JarTest.tearDown(JarTest.java:79)
[junit] at junit.framework.TestCase.runBare(TestCase.java:143)
[junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
[junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
[junit] at junit.framework.TestResult.run(TestResult.java:109)
[junit] at junit.framework.TestCase.run(TestCase.java:131)
[junit] at junit.framework.TestSuite.runTest(TestSuite.java:173)
[junit] at junit.framework.TestSuite.run(TestSuite.java:168)
[junit] at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRu
nner.java:323)
[junit] at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask
.java:861)
[junit] at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.jav
a:552)
[junit] at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.jav
a:528)
[junit] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:227)
[junit] at org.apache.tools.ant.Task.perform(Task.java:388)
[junit] at org.apache.tools.ant.Target.execute(Target.java:309)
[junit] at org.apache.tools.ant.Target.performTasks(Target.java:336)
[junit] at
org.apache.tools.ant.Project.executeTarget(Project.java:1389)
[junit] at
org.apache.tools.ant.Project.executeTargets(Project.java:1263)
[junit] at org.apache.tools.ant.Main.runBuild(Main.java:611)
[junit] at org.apache.tools.ant.Main.start(Main.java:198)
[junit] at org.apache.tools.ant.Main.main(Main.java:245)
[junit] Testcase: testManifestStaysIntactTestcase:
testNoRecreateBasedirExcludesWithUpdate took 2,594 sec
[junit] Testcase: testNoRecreateBasedirExcludesWithoutUpdate took 2,593
sec
[junit] Testcase: testNoRecreateZipfilesetExcludesWithUpdate took 2,604
sec
[junit] Testcase: testNoRecreateZipfilesetExcludesWithoutUpdate took
2,604 sec
[junit] Testcase: testRecreateZipfilesetWithoutUpdateAdditionalFiles
took 2,604 sec
[junit] Testcase: testRecreateZipfilesetWithUpdateAdditionalFiles took
2,633 sec
[junit] Testcase: testRecreateZipfilesetWithoutUpdateNewerFile took
2,614 sec
[junit] Testcase: testRecreateZipfilesetWithUpdateNewerFile took 2,634
sec
BUILD FAILED
file:///C:/dev/gnu/ant/build.xml:1631: Test
org.apache.tools.ant.taskdefs.JarTest failed
Total time: 49 seconds