Java Maven exec插件pom.xml定义:激活字符的shell解释
我使用Maven插件exec,并在pom.xml的概要文件中定义了它,如下所示:Java Maven exec插件pom.xml定义:激活字符的shell解释,java,shell,plugins,maven,character,Java,Shell,Plugins,Maven,Character,我使用Maven插件exec,并在pom.xml的概要文件中定义了它,如下所示: <profile> <id>optimizepng</id> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <ar
<profile>
<id>optimizepng</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>optipng</executable>
<arguments>
<argument>src/main/webapp/images/*.png</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
优化PNG
org.codehaus.mojo
execmaven插件
准备包装
执行官
optipng
src/main/webapp/images/*.png
现在,如果我将我在这个代码示例中定义的参数设置为-h
,那么终端调用mvn org.codehaus.mojo:exec-maven plugin:exec-p optimizepng
将按预期工作,并输出optipng的帮助
我发现,星号可能不会被解释为shell字符。这可能是原因吗?如果是这样,是否有一个标记可以应用于任何地方来切换shell解释
首先,关于我的计划的其他信息:
我想使用optpng优化src/main/webapp/images/文件夹中的所有png文件。我将使用的shell命令是
optpng src/main/webapp/images/*.png
好的,现在很快。我想,我可以直接启动shell,让它解释我想要执行的终端调用
<configuration>
<executable>sh</executable>
<arguments>
<argument>-c</argument>
<argument>optipng src/main/webapp/images/*.png</argument>
</arguments>
</configuration>
嘘
-c
optipng src/main/webapp/images/*.png
这个代码示例是我必须修复的,所以这就完成了工作