想用Ant直接向ftp傳輸更新后的jar文件,就采用ftp task,按照
http://ant.apache.org/manual/OptionalTasks/ftp.html
的說(shuō)明:
<target name="ftp update">
<ftp server="xxx.xxx.xxx.xxx" remotedir="/upload/test" userid="anonymous" password="test@test.com">
<fileset dir="${jar-dist}" />
</ftp>
</target>
運(yùn)行就出錯(cuò)build failed:
java.lang.NoClassDefFoundError org/apache/commons/net/ftp/FTPClient
根據(jù)http://ant.apache.org/manual/install.html#commons-net提示,ftp task需要
jakarta-oro-xxx.jar和commons-net-xxx.jar。下載后放到ant的home目錄下lib中。
本以為這樣就可以了,但是還是出原來(lái)的錯(cuò)。重起Eclipse也沒(méi)用。
最后在Preferences->Ant->Runtime->Classpath中Add External Jar,增加這兩個(gè)jar后正常。
也就是說(shuō),雖然這兩個(gè)包放到ant/lib了,但是它默認(rèn)不加載,可能它默認(rèn)只加載ant-*.jar。
http://ant.apache.org/manual/OptionalTasks/ftp.html
的說(shuō)明:
<target name="ftp update">
<ftp server="xxx.xxx.xxx.xxx" remotedir="/upload/test" userid="anonymous" password="test@test.com">
<fileset dir="${jar-dist}" />
</ftp>
</target>
運(yùn)行就出錯(cuò)build failed:
java.lang.NoClassDefFoundError org/apache/commons/net/ftp/FTPClient
根據(jù)http://ant.apache.org/manual/install.html#commons-net提示,ftp task需要
jakarta-oro-xxx.jar和commons-net-xxx.jar。下載后放到ant的home目錄下lib中。
本以為這樣就可以了,但是還是出原來(lái)的錯(cuò)。重起Eclipse也沒(méi)用。
最后在Preferences->Ant->Runtime->Classpath中Add External Jar,增加這兩個(gè)jar后正常。
也就是說(shuō),雖然這兩個(gè)包放到ant/lib了,但是它默認(rèn)不加載,可能它默認(rèn)只加載ant-*.jar。