-
1. Re: Ant Build Failed - failed to copy ~ drools-templates.jar due to java.io.FileNotFoundException
rgoytacaz Aug 24, 2009 1:46 AM (in response to rgoytacaz)BUILD FAILED
/home/rgoytacaz/workspace/myproject/build.xml:303: Failed to copy /home/rgoytacaz/workspace/myproject/exploded-archives/myproject.ear/lib/drools-templates.jar to /srv/jboss-5.1.0.GA/server/default/deploy/myproject.ear/lib/drools-templates.jar due to java.io.FileNotFoundException /srv/jboss-5.1.0.GA/server/default/deploy/myproject.ear/lib/drools-templates.jar (Not a directory)this is the full error message.
-
2. Re: Ant Build Failed - failed to copy ~ drools-templates.jar due to java.io.FileNotFoundException
erimag Aug 24, 2009 7:46 AM (in response to rgoytacaz)Sounds like there is a problem with the ant script in that it uses a
todir
attribute on the copy-task when it should be using atofile
attribute. Alternatively, it should be pointing thetodir
attribute to the destination directory instead of the whole file path name.If this is the seam-gen ant script I would suggest filing an issue against the
Build
component in the Seam JIRA: https://jira.jboss.org/jira/browse/JBSEAMIt should be relatively straight forward to fix it yourself in your local ant file given a little ant knowledge, though: http://ant.apache.org/manual/CoreTasks/copy.html
-
3. Re: Ant Build Failed - failed to copy ~ drools-templates.jar due to java.io.FileNotFoundException
v.lukoyanov Aug 24, 2009 11:00 AM (in response to rgoytacaz)Try ant explode instead of ant deploy.
-
4. Re: Ant Build Failed - failed to copy ~ drools-templates.jar due to java.io.FileNotFoundException
rgoytacaz Aug 24, 2009 5:18 PM (in response to rgoytacaz)this happens on the auto build from the eclipse ide
-
5. Re: Ant Build Failed - failed to copy ~ drools-templates.jar due to java.io.FileNotFoundException
kyazici Nov 24, 2009 1:09 AM (in response to rgoytacaz)Here is the thing I figured out after one week. When I checked out the deploy folder of the jboss AS I have, I saw there is the ear file that was copied by the deploy target. Then I deleted it and executed the explode command. There was the answer of my one week time; explode command creates a directory with the same name. So the problem is, when you try to deploy after an explode, ant tries to replace the directory created by explode with an ear file, or vice versa if you execute explode after deploy. Since both have the same name the OS (for me it is windows Vista) gives error that it cannot replace a directory with a file that have the same name. So, I solve the problem by changing the deploy target in build.xml.
I changed the
<target name="deploy" depends="archive,datasource" description="Deploy the packaged archive"> <fail unless="jboss.home">jboss.home not set</fail> <copy todir="${deploy.dir}" file="${dist.dir}/${project.name}.ear"/> </target>
lines with
<target name="deploy" depends="archive,datasource" description="Deploy the packaged archive"> <fail unless="jboss.home">jboss.home not set</fail> <antcall target="explode"/> </target>
So instead of copying the ear file that is generated by
archive
target I simply call the explode command in the deploy target. Another solution can be, checking the deploy directory and if there is a file named ${project.name}.ear deleting it before explode is called, by adding<delete file="${dist.dir}/${project.name}.ear"> </delete>
command to the explode like<target name="explode" depends="stage,datasource" description="Deploy the exploded archive"> <fail unless="jboss.home">jboss.home not set</fail> <delete file="${dist.dir}/${project.name}.ear"> </delete> <copy todir="${ear.deploy.dir}"> <fileset dir="${ear.dir}"> <include name="**/*"/> <exclude name="${project.name}_jar/**"/> <exclude name="${project.name}_war/**"/> </fileset> </copy> <copy todir="${jar.deploy.dir}"> <fileset dir="${jar.dir}"/> </copy> <copy todir="${war.deploy.dir}"> <fileset dir="${war.dir}"/> </copy> </target>
I did not add the condition but it still works. Actually I am not that experienced at ant. If someone could add a
deploy.directory.exists
condition I would appreciate it. So I hope this saves others time. Cheers. -
6. Re: Ant Build Failed - failed to copy ~ drools-templates.jar due to java.io.FileNotFoundException
kyazici Nov 24, 2009 1:37 AM (in response to rgoytacaz)Sorry last one should be
<target name="explode" depends="stage,datasource" description="Deploy the exploded archive"> <fail unless="jboss.home">jboss.home not set</fail> <delete file="${deploy.dir}/${project.name}.ear"> </delete> <copy todir="${ear.deploy.dir}"> <fileset dir="${ear.dir}"> <include name="**/*"/> <exclude name="${project.name}_jar/**"/> <exclude name="${project.name}_war/**"/> </fileset> </copy> <copy todir="${jar.deploy.dir}"> <fileset dir="${jar.dir}"/> </copy> <copy todir="${war.deploy.dir}"> <fileset dir="${war.dir}"/> </copy> </target> </target>