我试图运行一个简单的beanshell脚本打印'Hello‘后,构建war文件。我是这的推荐人。然而,我不断地得到“没有项目被选择执行”。运行mvn后,干净安装。我不确定错误是否来自文件的目录,或者在构建war文件之后,我无法只打印“Hello”。
+- project folder/
+- buildTargetWarFileFolder/
+- python/
+- folder/
| +-helloWolrd.bsh <plugin>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<debug>true</debug>
<projectsDirectory>project folder</projectsDirectory>
<postBuildHookScript>python/folder/helloWorld.bsh</postBuildHookScript>
</configuration>
<executions>
<execution>
<id>print Hello World</id>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>发布于 2022-03-19 00:32:59
我建议直接使用exec:exec目标,绑定到maven构建的集成测试阶段(尝试您的python脚本)。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<executable>python</executable>
<arguments>
<argument>-c</argument>
<argument>print('Hello world')</argument>
</arguments>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>这与创建war后在命令行上运行以下命令相同:
python -c "print('Hello world')"https://stackoverflow.com/questions/65140225
复制相似问题