【问题标题】:Build failure with Exec Maven plugin running a thor script使用运行雷神脚本的 Exec Maven 插件构建失败
【发布时间】:2013-06-08 11:51:52
【问题描述】:

我有一个简单的 thor 脚本,可以将资源从我项目中的子模块复制到目标目录。我已将 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 build:task 从 shell 执行时,我的 thor 脚本运行良好,但由于某种原因,我的 mvn compile 失败并出现以下错误:

[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 插件的情况下完成。

【问题讨论】:

    标签: maven thor exec-maven-plugin


    【解决方案1】:

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

    <successCodes>
        <successCode>0</successCode>
        <successCode>1</successCode>
    </successCodes>
    

    【讨论】:

    • 你能告诉我这个标签是否有助于“错误失败”机制吗?
    猜你喜欢
    • 2016-01-31
    • 2017-06-13
    • 1970-01-01
    • 2012-12-08
    • 1970-01-01
    • 2014-12-31
    • 2017-01-07
    • 2011-03-29
    相关资源
    最近更新 更多