Jenkins构建失败求助:exec-maven-plugin执行出错
Hey there, let's walk through how to debug this frustrating issue—since you haven't changed any project code, the problem is almost certainly tied to your Jenkins environment or the external command the exec plugin is running. Here's what to check step by step:
1. Get the Full Error Stack Trace First
The current log only tells you the exec plugin failed with exit code 1, which is way too vague. Re-run your Jenkins build with the Maven -e flag added to the build arguments. This will print the full stack trace, which should show exactly where the command failed and why (e.g., a missing tool, permission error, or deployment target issue).
2. Identify the Exact Command the Exec Plugin is Running
The app-deploy execution in the exec-maven-plugin is calling an external command—you need to see what that command is. Open your project's pom.xml and look for the plugin configuration, it should look something like this:
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <executions> <execution> <id>app-deploy</id> <goals> <goal>exec</goal> </goals> <configuration> <executable><!-- This is the command being run --></executable> <arguments><!-- These are the command arguments --></arguments> </configuration> </execution> </executions> </plugin>
Once you have the full command, run it manually on your Jenkins build node (or a local environment that matches Jenkins' setup). This will let you see the raw error output from the command itself, which is often more detailed than what Maven captures.
3. Check for Jenkins Environment Changes
Even if your code didn't change, the Jenkins environment might have shifted:
- Tool versions: Did the JDK, Maven, or the deployment tool (e.g., a CLI, script) on the build node get updated or corrupted?
- Environment variables: Are any required variables (like deployment credentials, path variables, or target server addresses) missing or incorrect now?
- Target environment issues: Is the server you're deploying to down, have permissions changed, or is it out of storage?
- Jenkins plugins: Did the Maven Plugin or Exec Plugin get auto-updated recently? Sometimes plugin updates introduce compatibility issues with older plugin versions (you're using exec-maven-plugin 1.2.1, which is pretty old).
4. Verify Jenkins Job Configuration
Double-check if anyone modified the job's settings recently:
- Were build arguments changed?
- Did the build node get switched to a different server?
- Are there new pipeline steps or post-build actions that might be interfering?
5. Compare with a Successful Build Log
Pull up the log from your last successful build and compare it line by line with the failed one. Look for differences like:
- Different tool versions being used
- Variations in environment variable values
- Any warnings that turned into errors
- Changes in the deployment command's output before the failure
Once you have more details from the full stack trace or manual command run, you'll be able to narrow down the exact cause.
内容的提问来源于stack exchange,提问作者devops

