[
http://jira.codehaus.org/browse/MEXEC-88?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=247468#action_247468
]
Michael Mraz commented on MEXEC-88:
-----------------------------------
The use of success codes worked when introduced in 1.1.1.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<id>stopmcshield</id>
<phase>process-resources</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>cmd.exe</executable>
<workingDirectory>/tmp</workingDirectory>
<arguments>
<argument>/c net stop mcshield</argument>
</arguments>
<!-- Even if the stop fails we don't want to fail the build -->
<successCodes>
<successCode>2</successCode>
<successCode>1</successCode>
<successCode>0</successCode>
</successCodes>
</configuration>
</plugin>
Changing the version to 1.2 causes failure:
[INFO] [exec:exec {execution: stopmcshield}]
The McAfee McShield service is not started.
More help is available by typing NET HELPMSG 3521.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Command execution failed.
Embedded error: Process exited with an error: 2(Exit value: 2)
> ExecMojo: SuccessCodes config seems not to be recognized by commons exec
> framework
> ----------------------------------------------------------------------------------
>
> Key: MEXEC-88
> URL: http://jira.codehaus.org/browse/MEXEC-88
> Project: Maven 2.x Exec Plugin
> Issue Type: Bug
> Components: exec
> Affects Versions: 1.2
> Reporter: Daniel Strassenburg
> Priority: Blocker
>
> I used the successCodes config to tell the exec-mojo not to fail in case of
> error codes e.g. 0,1,2,3. Unfortunately, the maven build fails with the
> exception below.
> Excerpt from mojo config:
> {noformat}
> [DEBUG] (f) basedir = build/basedir
> [DEBUG] (f) classpathScope = runtime
> [DEBUG] (f) executable = path/to/executable
> [DEBUG] (f) longClasspath = false
> [DEBUG] (f) project = MavenProject: <my-maven-project>\pom.xml
> [DEBUG] (f) session = org.apache.maven.execution.mavensess...@dab859
> [DEBUG] (f) skip = false
> [DEBUG] (s) successCodes = [0, 1, 2, 3]
> [DEBUG] -- end configuration --
> {noformat}
> I had a look at the plugin's source code ({{ExecMojo}}) and suppose that the
> underlying framework (commons exec) is not configured with these success
> codes. The commons exec framework throws an {{ExecuteException}}, see stack
> trace
> {noformat}
> org.apache.maven.lifecycle.LifecycleExecutionException: Command execution
> failed.
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
> at
> org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
> at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
> at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
> at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Caused by: org.apache.maven.plugin.MojoExecutionException: Command execution
> failed.
> at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:345)
> at
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
> ... 17 more
> Caused by: org.apache.commons.exec.ExecuteException: Process exited with an
> error: 2(Exit value: 2)
> at
> org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:346)
> at
> org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:149)
> at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:589)
> at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:335)
> ... 19 more
> {noformat}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email