先说说情况:
Eclipse下创建了一个工程 里面有对外部包的引用,我没有把这些包直接考到工程lib文件夹下,而直接在工程中build path添进去了,现在我要用ant来 compile, 这个classpath不和如何写了,
当然一种情况:就是建一个path连接,然后在里面用fileset来包含我的这个引用包的文件,然后再用classpath标签来用引,应该可以实现,
但是我想测试一下,直接利用当前工程下的classpath文件来实现compile,因为eclipse就能编译,它能做到,我也要做到,
达人请帮我解答一下
Eclipse下创建了一个工程 里面有对外部包的引用,我没有把这些包直接考到工程lib文件夹下,而直接在工程中build path添进去了,现在我要用ant来 compile, 这个classpath不和如何写了,
当然一种情况:就是建一个path连接,然后在里面用fileset来包含我的这个引用包的文件,然后再用classpath标签来用引,应该可以实现,
但是我想测试一下,直接利用当前工程下的classpath文件来实现compile,因为eclipse就能编译,它能做到,我也要做到,
达人请帮我解答一下
<target name="..."> <getEclipseClasspath pathId="myClasspath"
workspace="${basedir}/.."
projectName="myProject" /> ... <javac classpathref="myClasspath"
destdir="${classes}" >
<src refid="mySourcepath"/>
</javac> </target>
<project basedir="." name="EJBTest">
<property name="src.dir" value="${basedir}\src"/>
<property environment="env"/>
<property name="jboss.home" value="${env.JBOSS_HOME}"/>
<property name="jboss.server.config" value="default"/>
<property name="build.dir" value="${basedir}\build"/>
<path id="build.classpath">
<fileset dir="${jboss.home}\client">
<include name="*.jar"/>
</fileset>
<pathelement location="${build.dir}"/>
</path>
<target name="prepare">
<delete dir="${build.dir}"/>
<mkdir dir="${build.dir}"/>
</target>
<target name="complie" depends="prepare" description="缂栬瘧">
<javac srcdir="${src.dir}" destdir="${build.dir}">
<classpath refid="build.classpath"/>
</javac>
</target>
<target name="ejbjar" depends="complie" description="鍒涘缓EJB鍙戝竷鍖?>
<jar destfile="${basedir}\${ant.project.name}.jar">
<fileset dir="${build.dir}">
<include name="**/*.class"/>
</fileset>
</jar>
</target>
<target name="deploy" depends="ejbjar" description="鍙戝竷ejb">
<copy file="${basedir}\${ant.project.name}.jar" todir="${jboss.home}\server\${jboss.server.config}\deploy"></copy>
</target>
<target name="undeplay" description="鍗歌浇ejb">
<delete file="${jboss.home}\server\${jboss.server.config}\deploy\${ant.project.name}.jar"></delete>
</target>
</project>