1
殼解釋我使用Maven插件Exec和在我的pom.xml的這樣的一個配置文件定義它:現在Maven的高管,插件的pom.xml定義:激活字符
<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>
,如果我設置我在此代碼示例中定義的參數爲<argument>-h</argument>
,終端調用mvn org.codehaus.mojo:exec-maven-plugin:exec -P optimizepng
按預期工作並打印出optipng的幫助。
我發現的是,星號可能不會被解釋爲shell字符。這可能是它的原因嗎?如果是這樣,是否有標籤可以在任何地方應用以切換shell解釋?
關於我的計劃的其他信息: 我想使用optipng優化src/main/webapp/images /文件夾中的所有png文件。我將用作shell命令的是optipng src/main/webapp/images/*.png
。