用ant 编译java程序报错:Fail to copy ... to ... due to null.请问这是什么原因?谢谢!

jjggww2000 2004-12-18 09:01:24
该java程序用javac ,java可以顺利编译并且运行!
...全文
243 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
launch401 2004-12-18
  • 打赏
  • 举报
回复
<copy todir="${srcRbeDir}" filtering="on" preservelastmodified="true">
<fileset dir="${tpcwDir}/${rbeDir}" casesensitive="yes">
<include name="**/*.java"/>
</fileset>
</copy>
出错应该在这部分,或许是目标目录中的文件没有清空,或是目录访问权限不够。
jjggww2000 2004-12-18
  • 打赏
  • 举报
回复
<!-- Build the class files for the servlets and the database populate class -->
<target name="build" depends="mksrc" description="Build the *.class files from source.">
<javac srcdir="${srcServDir}" destdir="${buildServDir}">
<classpath>
<pathelement path="${classpath}"/>
<pathelement path="${srcServDir}"/>
<pathelement location="${cpServ}"/>
</classpath>
</javac>
<javac srcdir="${srcDir}" destdir="${buildRbeDir}" includes="rbe/**">
<classpath>
<pathelement path="${classpath}"/>
<pathelement path="${srcRbeDir}"/>
<pathelement location="${cpServ}"/>
</classpath>
</javac>
<javac srcdir="${srcDbDir}" destdir="${buildDbDir}">
<classpath>
<pathelement path="${classpath}"/>
<pathelement path="${srcDbDir}"/>
<pathelement location="${cpServ}"/>
</classpath>
</javac>
</target>

<!-- Documentation -->
<target name="docs" depends="mksrc" description="Build the javadoc for the servlets.">
<javadoc destdir="${docDir}/api">
<classpath>
<pathelement path="${classpath}"/>
<pathelement path="${srcServDir}"/>
<pathelement path="${srcRbeDir}"/>
<pathelement location="${cpServ}"/>
</classpath>
<fileset dir="${srcServDir}">
<include name="**/*.java" />
</fileset>
<fileset dir="${srcRbeDir}">
<include name="**/*.java" />
</fileset>
</javadoc>
</target>

<!-- Distribution -->
<target name="checkDist">
<uptodate property="war.notNeeded" targetfile="${distDir}/tpcw.war">
<srcfiles dir="${buildServDir}" includes="**/*.class"/>
</uptodate>
<uptodate property="rbe.notNeeded">
<srcfiles dir="${srcRbeDir}" includes="**/*.java"/>
<mapper type="glob" from="*.java" to="${basedir}${file.separator}${distDir}${file.separator}${rbeDir}${file.separator}*.class"/>
</uptodate>
<uptodate property="db.notNeeded" srcfile="${buildDbDir}/TPCW_populate.class" targetfile="${buildDbDir}/TPCW_populate.class"/>
<uptodate property="dbImages.notNeeded" srcfile="${srcDbDir}/populate_images" targetfile="${distDir}/populate_images"/>
<condition property="dist.notNeeded">
<and>
<isset property="war.notNeeded"/>
<isset property="rbe.notNeeded"/>
<isset property="db.notNeeded"/>
<isset property="dbImages.notNeeded"/>
</and>
</condition>
</target>
<target name="dist" depends="build, checkDist" unless="dist.notNeeded" description="Build the *.war file from *.class files.">
<war destfile="${distDir}/tpcw.war" webxml="tpcw.xml">
<classes dir="${buildServDir}"/>
</war>
<copy todir="${distDir}" preservelastmodified="true">
<fileset dir="${buildDbDir}" casesensitive="yes">
<include name="**/*.class"/>
<include name="**/populate_images"/>
</fileset>
<fileset dir="${srcDbDir}" casesensitive="yes">
<include name="populate_images"/>
</fileset>
<fileset dir="${buildRbeDir}" casesensitive="yes">
<include name="**/*.class"/>
</fileset>
</copy>
<copy file="${tpcwDir}/${rbeDir}/README" tofile="${docDir}/readme-rbe.txt" preservelastmodified="true"/>
<copy file="${tpcwDir}/README" tofile="${docDir}/readme-tpcw.txt" preservelastmodified="true"/>
<copy file="${tpcwDir}/runtpcw" tofile="${distDir}/runtpcw" preservelastmodified="true"/>
<copy file="${basedir}/rbe.sh" tofile="${distDir}/rbe.sh" preservelastmodified="true"/>
<copy file="${tpcwDir}/COPYRIGHT" tofile="${distDir}/copyright" preservelastmodified="true"/>
</target>

<!-- Installation -->
<target name="inst" depends="dist" description="Copy war file to desired directory.">
<delete file="${webappDir}/tpcw.war"/>
<copy file="${distDir}/tpcw.war" todir="${webappDir}"/>
</target>

<!-- DB generation -->
<target name="gendb" depends="dist" description="Generate Database data.">
<java classname="TPCW_Populate" fork="true">
<classpath>
<pathelement path="${classpath}"/>
<pathelement path="${srcDbDir}"/>
<pathelement path="${distDir}"/>
<pathelement location="${cpJDBC}"/>
</classpath>
</java>
</target>

<!-- Image generation -->
<target name="genimg" depends="dist" description="Generate the images for the items.">
<copy todir="${imagesDir}">
<fileset dir="${tpcwDir}/images" casesensitive="yes">
<include name="**/*.gif"/>
</fileset>
</copy>
<exec dir="${tpcwDir}/ImgGen/ImgFiles" executable="make" output="make_img-gen.txt" failonerror="true"/>
<exec dir="${distDir}" executable="${perlPath}" output="populate_images.txt" failonerror="true">
<arg line="populate_images"/>
</exec>
</target>

<!-- Clean Up -->
<target name="clean" depends="init" description="Remove all generated files and directories (except installed *.war).">
<delete dir="${srcDir}" />
<delete dir="${buildDir}" />
<delete dir="${distDir}" />
</target>

</project>
报错信息如下:
build.xml:81: Failed to copy /usr/local/tpcw/apache-ant-1.6.2/bin/tpcw/rbe/RBE.java to /usr/local/tpcw/apache-ant-1.6.2/bin/src/rbe/RBE.java
jjggww2000 2004-12-18
  • 打赏
  • 举报
回复
build.xml太长,各位老大辛苦了!
build.xml内容如下:
<?xml version="1.0"?>

<!--
build.xml for Ant to build and install the TPC-W Java implementation.
Copyright 2003 by Jan Kiefer.

This file is distributed "as is". It comes with no warranty and the
author takes no responsibility for the consequences of its use.

Usage, distribution and modification is allowed to everyone, as long
as reference to the author(s) is given and this license note is included.
-->

<project name="TPC-W Servlets" default="genimg" basedir=".">

<!-- Set needed properties -->
<target name="init">
<tstamp/>

<!-- This file contains important properties
you might want to change according to your needs -->
<property file="main.properties"/>

<!-- Filter file for some settings needed,
change the contents according to your needs -->
<property name="tpcwFilter" value="tpcw.properties"/>

<!-- Directory structure used, this doesn't have to be changed -->
<!-- ./src/servlets
./src/populate
./build/servlets
./build/populate
./dist/doc
./dist/doc/api -->
<property name="servDir" value="servlets"/>
<property name="dbDir" value="populate"/>
<property name="rbeDir" value="rbe"/>
<property name="tpcwDir" value="tpcw"/>
<property name="imagesGenDir" value="../${tpcwDir}/ImgGen"/>

<property name="srcDir" value="src"/>
<property name="buildDir" value="build"/>
<property name="distDir" value="dist"/>

<property name="srcServDir" value="${srcDir}/${servDir}"/>
<property name="srcDbDir" value="${srcDir}/${dbDir}"/>
<property name="srcRbeDir" value="${srcDir}/${rbeDir}"/>
<property name="buildServDir" value="${buildDir}/${servDir}"/>
<property name="buildDbDir" value="${buildDir}/${dbDir}"/>
<property name="buildRbeDir" value="${buildDir}/${rbeDir}"/>

<property name="docDir" value="${distDir}/doc"/>
</target>

<!-- Prepare directories -->
<target name="prepare" depends="init">
<mkdir dir="${srcServDir}" />
<mkdir dir="${srcDbDir}" />
<mkdir dir="${srcRbeDir}" />
<mkdir dir="${buildServDir}" />
<mkdir dir="${buildDbDir}" />
<mkdir dir="${buildRbeDir}" />
<mkdir dir="${distDir}" />
<mkdir dir="${docDir}"/>
</target>

<!-- Copy source files and replace tokens according to the filter files -->
<target name="mksrc" depends="prepare" description="Replace tokens in src with values from properties in filter files.">
<filter filtersFile="${tpcwFilter}"/>
<filter filtersFile="${sqlFilter}"/>
<copy todir="${srcServDir}" filtering="on" preservelastmodified="true">
<fileset dir="${tpcwDir}/${servDir}" casesensitive="yes">
<include name="**/*.java"/>
</fileset>
</copy>
<copy tofile="${srcServDir}/TPCW_Database.java" filtering="on" preservelastmodified="true">
<fileset dir="${basedir}" casesensitive="yes">
<include name="TPCW_Database.${dbName}.java"/>
</fileset>
</copy>
<copy todir="${srcRbeDir}" filtering="on" preservelastmodified="true">
<fileset dir="${tpcwDir}/${rbeDir}" casesensitive="yes">
<include name="**/*.java"/>
</fileset>
</copy>
<filter token="images.path" value="${imagesDir}"/>
<filter token="imagesGen.path" value="${imagesGenDir}"/>
<copy todir="${srcDbDir}" filtering="on" preservelastmodified="true">
<fileset dir="${tpcwDir}/${dbDir}" casesensitive="yes">
<include name="**/*.java"/>
<include name="populate_images"/>
</fileset>
</copy>
</target>

due to null
launch401 2004-12-18
  • 打赏
  • 举报
回复
你把build.xml贴出来看看
jjggww2000 2004-12-18
  • 打赏
  • 举报
回复
但是同样的设置,ant编译其他程序就好使啊!
classjava 2004-12-18
  • 打赏
  • 举报
回复
ant设置问题

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧