【发布时间】:2019-12-13 08:43:37
【问题描述】:
enter image description here我正在尝试执行一个简单的 python cmd 命令,例如
C:\Users> python swaggerpythonfile.py < Documents/inputfile/swagger.yaml > Documents/outputfile/doc.html 作为 maven 项目中的 python 脚本。此命令 simpy 需要一个 .yaml 文件并通过执行 python 文件 swaggerpythonfile.py 将其转换为 html 文件,并且可以在我的 cmd 中正常工作。但是,我需要将它作为一个 python 脚本放在一个 maven 项目中,所以我尝试遵循 exec-maven-plugin 文档a link! .但我收到一个错误。
[ERROR] 命令执行失败。 java.io.IOException: Cannot run program "python" (in directory "D:\DocAuth\modules\subjectstore"): CreateProcess error=2, 系统找不到指定的文件
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<configuration>
<executable>python</executable>
<workingDirectory>${basedir}</workingDirectory>
<arguments>
<argument>swagger-yaml-to-html.py</argument>
<argument>generated/inputfile/swagger-ui/swagger.yaml</argument>
<argument>target/outputfile/doc.html</argument>
</arguments>
</configuration>
<id>python_build</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
[错误] 无法在项目上执行目标 org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (python_build)
【问题讨论】:
-
我已经解决了这个错误。而不是
python 我们需要提供 python.exe 文件的路径,例如C:/users/../python.exe 然后它才能工作。
标签: python maven-plugin exec-maven-plugin