我想用Maven执行windows powershell脚本。这是我试过的:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<id>some-execution</id>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>D:\Projects\test.ps1</executable>
</configuration>
</plugin>
但它只是在执行pom时打开powershell脚本
mvn exec:exec
答案 0 :(得分:0)
没有任何其他选项,所以在批处理文件中写下以下行
PowerShell -NoProfile -ExecutionPolicy unrestricted -Command D:\Projects\Test.ps1
并使用exec插件调用批处理文件,该文件将执行powershell脚本。
喜欢
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<id>some-execution</id>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>D:\Projects\test1.bat</executable>
</configuration>
</plugin>