由于java.io.FileNotFoundException /usr/share/ant/lib/ecj.jar,无法将/home/[...]/ecj.jar复制到/usr/share/ant/lib/ecj.jar(权限被拒绝) )

时间:2016-02-08 03:12:25

标签: ant liferay

虽然ant clean在Liferay IDE中正常工作,但从命令行尝试时我得到:

$ ant clean
Buildfile: /home/nico/myportlet/build.xml
     [copy] Copying 1 file to /usr/share/ant/lib
Attempt to copy /home/nico/liferay-plugins-sdk-6.2-ee-sp14/lib/ecj.jar to /usr/share/ant/lib/ecj.jar using NIO Channels failed due to '/usr/share/ant/lib/ecj.jar (Permission denied)'.  Falling back to streams.

BUILD FAILED
/home/nico/myportlet/build.xml:5: The following error occurred while executing this line:
/home/nico/liferay-plugins-sdk-6.2-ee-sp14/portlets/build-common-portlet.xml:5: The following error occurred while executing this line:
/home/nico/liferay-plugins-sdk-6.2-ee-sp14/build-common-plugin.xml:5: The following error occurred while executing this line:
/home/nico/liferay-plugins-sdk-6.2-ee-sp14/build-common.xml:94: Failed to copy /home/nico/liferay-plugins-sdk-6.2-ee-sp14/lib/ecj.jar to /usr/share/ant/lib/ecj.jar due to java.io.FileNotFoundException /usr/share/ant/lib/ecj.jar (Permission denied)

Total time: 2 seconds

如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

只需以root身份手动复制文件。

完成后,蚂蚁会很高兴并且无需抱怨就可以执行任务。

以下是在Linux / Mac上的操作方法:

sudo cp /home/nico/liferay-plugins-sdk-6.2-ee-sp14/lib/ecj.jar /usr/share/ant/lib/

答案 1 :(得分:1)

或者为了不搞乱系统库,我们可以将文件夹引用到ant,如:

ant clean -lib /home/nico/liferay-plugins-sdk-6.2-ee-sp14/lib