Maven 在构建期间执行sh脚本
我在pom.xml中有这个插件Maven 在构建期间执行sh脚本,maven,plugins,Maven,Plugins,我在pom.xml中有这个插件 <plugin> <artifactId>exec-maven-plugin</artifactId> <groupId>org.codehaus.mojo</groupId> <executions> <execution><!-- Run our ver
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution><!-- Run our version calculation script -->
<id>Version Calculation</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<workingDirectory>${basedir}/target/process.properties</workingDirectory>
<executable>${basedir}/Scripts.sh</executable>
</configuration>
</execution>
</executions>
</plugin>
Scripts.sh
#!/bin/bash
sed 's/Downloads_Item/Downloads_Item_NiteVate/g' Process.properties
我试图通过执行Scripts.sh
来替换标志link.process.run
的值
我试过了,但没有成功。这应该在进行构建时发生。
我找不到问题出在哪里
如果引用现有目录,我想您引用了一个文件。maven是否产生错误或输出是什么?在构建过程中,您不需要脚本来替换文件中的值,maven可以通过现成的方式为您执行此操作,因为Process.properties是一个属性文件。我不能在那里添加变量。实际上,我必须在构建时替换一个值。我没有得到任何错误,构建成功。但变化没有发生,你做错了。听@A.DiMatteo。Maven的方法是过滤您的属性。你为什么不能那样做?您可以筛选.properties
文件。
#!/bin/bash
sed 's/Downloads_Item/Downloads_Item_NiteVate/g' Process.properties