Maven 2 Maven exec插件问题

Maven 2 Maven exec插件问题,maven-2,maven-plugin,unzip,Maven 2,Maven Plugin,Unzip,我在Mac10.6.6上使用Maven 3.0.3。打包war之后,我想执行一个解压命令(我想这样做是因为我使用的是一个Grails插件,它删除了分解的war目录)。所以我在pom.xml中有这个 <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.1.1

我在Mac10.6.6上使用Maven 3.0.3。打包war之后,我想执行一个解压命令(我想这样做是因为我使用的是一个Grails插件,它删除了分解的war目录)。所以我在pom.xml中有这个

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.1.1</version>
    <configuration>
        <executable>unzip</executable>
        <arguments>
            <argument>-d target/jx-1.0-SNAPSHOT target/jx-1.0-SNAPSHOT.war</argument>
        </arguments>
    </configuration>
    <executions>
        <execution>
            <phase>verify</phase>
            <goals>
                <goal>exec</goal>
            </goals>
        </execution>
    </executions>
</plugin>

知道我做错了什么吗?谢谢,-Dave

您正在将多个参数打包到一个
中。

正如Ryan所写,您需要这样:

<argument>-d</argument>
<argument>target/jx-1.0-SNAPSHOT</argument>
<argument>target/jx-1.0-SNAPSHOT.war</argument>
-d
目标/jx-1.0-SNAPSHOT
目标/jx-1.0-SNAPSHOT.war
而且,您正在硬编码许多应该使用maven变量实现的东西。所以这里有一个更好的版本:

<argument>-d</argument>
<argument>${project.build.directory}/${project.build.finalName}</argument>
<argument>${project.build.directory}/${project.build.finalName}.${project.packaging}</argument>
-d
${project.build.directory}/${project.build.finalName}
${project.build.directory}/${project.build.finalName}.${project.packaging}

为什么不使用maven依赖插件并使用它,而不是调用外部程序(这使得构建不可移植!)。
<argument>-d</argument>
<argument>${project.build.directory}/${project.build.finalName}</argument>
<argument>${project.build.directory}/${project.build.finalName}.${project.packaging}</argument>