Pergunta

I have a simple thor script that copies resources to target directory from a submodule in my project. I have configured Exec Maven plugin to run the script at compile phase.

<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>

My thor script runs fine when executed from a shell with thor build:task but for some reason my mvn compile fails with following error:

[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)

Before the error message I can see my script printing messages and it seems to be working fine. Build completes without the exec plugin.

Foi útil?

Solução

It seems that for some reason my thor script always returns with 1. I put these properties to Maven Exec plugin's configuration and now the build goes through without errors.

<successCodes>
    <successCode>0</successCode>
    <successCode>1</successCode>
</successCodes>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top