Tôi đang sử dụng maven trên Win 7 để xây dựng một ứng dụng. Tôi sử dụng plugin exec để gọi một kịch bản python.Trình cắm trình quản lý Maven - Thực thi một tập lệnh python
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>create-dir</id>
<phase>process-classes</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>src/main/upgrade/create.py</executable>
<arguments>
<argument>ChangeSet.txt</argument>
</arguments>
</configuration>
</plugin>
Tôi gặp lỗi dưới đây khi tôi tạo dự án.
Embedded error: Cannot run program "pathToScript/create.py" CreateProcess error=193, %1 is not a valid Win32 application
Tôi đã cài đặt và thêm python vào biến% PATH.
Làm cách nào để khắc phục sự cố sao cho nó hoạt động độc lập với nền tảng hệ điều hành?
.: - EDIT- :.
LÀM VIỆC ĐOẠN MÃ
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<configuration>
<executable>python</executable>
<workingDirectory>src/main/upgrade/</workingDirectory>
<arguments>
<argument>createChangeSet.py</argument>
</arguments>
</configuration>
<id>python-build</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
Câu hỏi đặt ra là tại sao bạn cần phải chạy một kịch bản python? Bạn cần phải xác định intepreter python trên Windows trên Linux dòng shebang là quan trọng. – khmarbaise
Tôi sử dụng cách tiếp cận của bạn để chạy tập lệnh python tốn thời gian ở giai đoạn cài đặt maven, kịch bản lệnh python hoạt động nhưng với bảng điều khiển hỗn loạn, đầu ra đến từ python nằm trong một số thứ tự sai. Bạn có vấn đề tương tự? – yorkw