使用 pom.xml 执行 windows powershell 脚本
execute windows powershell script using pom.xml
我想用 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
没有任何其他选项,所以在批处理文件中写下行
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>
我想用 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
没有任何其他选项,所以在批处理文件中写下行
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>