2

我有一个简单的雷神脚本,可以将资源从我的项目中的子模块复制到目标目录。我已将 Exec Maven 插件配置为在编译阶段运行脚本。

<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <executable>thor</executable>
                <arguments>
                    <argument>build:task</argument>
                </arguments>
            </configuration>
</plugin>

我的 thor 脚本在使用thor build:task从 shell 执行时运行良好,但由于某种原因,我的mvn 编译失败并出现以下错误:

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default) on project imsprocess: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default) on project imsprocess: Command execution failed.
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)

在错误消息之前,我可以看到我的脚本打印消息,它似乎工作正常。构建在没有 exec 插件的情况下完成。

4

1 回答 1

7

似乎由于某种原因,我的 thor 脚本总是返回 1。我将这些属性放入 Maven Exec 插件的配置中,现在构建顺利进行。

<successCodes>
    <successCode>0</successCode>
    <successCode>1</successCode>
</successCodes>
于 2013-06-13T10:51:53.563 回答