在Maven中,我们可以使用exec-maven-plugin在构建中执行bash命令。
中央存储库的哪个插件可以执行相同的任务?
我之所以这样问,是因为我必须在一个bash命令之后执行另一个插件,而这个插件只有在exec-maven-plugin之后才需要在同一阶段执行,所以我不能直接在exec-maven-plugin中执行。
我希望在Maven构建中执行的bash命令如下:
cat file1 >> file2 提前谢谢。
发布于 2020-05-01 02:00:45
我设法用<concat>任务解决了maven-antrun-plugin的问题:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>final step</id>
<phase>install</phase>
<configuration>
<target>
<concat destfile="${project.build.directory}/${project.artifactId}-${project.version}.sh" binary="yes">
<fileset file="${project.build.directory}/script/self-installer.sh" />
<fileset file="${project.build.directory}/${project.artifactId}-${project.version}.tar.gz" />
</concat>
<chmod file="${project.build.directory}/${project.artifactId}-${project.version}.sh" perm="+x"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>这相当于bash cat命令。
请记住,如果要连接二进制文件,则必须设置binary="yes",否则Ant任务将破坏最终文件。
无论如何,这仍然不是一个基于bash的解决方案,它只是一个使用Ant例程的技巧,所以它不是真正的exec-maven-plugin等价物
https://stackoverflow.com/questions/61529064
复制相似问题