1

从 Cygwin shell 使用 Maven 构建时(在 Windows 上通过 Cygwin 进行 bash),/usr/bin 的路径无法正确解析。

让我解释。Cygwin 附带 Python,可作为 /usr/bin 的符号链接访问。Maven 应该可以访问这个符号链接,因为它的位置在 PATH 环境变量中。Cygwin 将 /usr/bin 添加到 PATH 环境变量中。但是,Maven 无法找到 Python。例如

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default) on project cloud-devcloud: Command execution failed. Cannot run program "python" (in directory "C:\cygwin\home\myuser\incubator-cloudstack\tools\devcloud"): CreateProcess error=2, The system cannot find the file specified -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

但是 Python 在那里:

$ which python
/usr/bin/python

尽管作为符号链接。

$ ls -al /usr/bin/python
lrwxrwxrwx 1 donall Domain Users 13 Sep 19 11:38 /usr/bin/python -> python2.6.exe

Python是符号链接的问题吗?或者 Maven 无法访问 /usr/bin 中的文件?

4

1 回答 1

3

It seems like maven is running as a regular Windows-native application, not a "cygwin-aware application" (if such thing exists :-) )

This is indicated by the path used internally, which is printed in the log: C:\cygwin\home\myuser\incubator-cloudstack\tools\devcloud

For this reason the call from Maven will not recognize the cygwin path when locating the python executable. One possible solution is to add the directory containing python.exe to the system PATH (which means, the Windows PATH variable)

于 2012-10-25T14:09:46.877 回答