'Error happened while attempting to execute 'mvn clean package' in Go CD
I have setup a pipeline with one task mvn clean package in Go CD. I have registered an agent with Java and Maven up and running. When I trigger the pipeline, the job fails:
[go] Task: mvn clean package took: 0.14s Error happened while attempting to execute 'mvn clean package'. Please make sure [mvn] can be executed on this agent.
[Debug Information] Environment variable PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-11-openjdk/bin
I have tried all solutions provided on the below post-but nothing works Can't execute "mvn clean package" task in GO CD
Solution 1:[1]
I encountered the same problem? If i execute docker exec -it gocd-agent bash and execute mvn --version,will not tip me error but if i execute docker exec -it gocd-agent sh,will tip me "mvn: command not found" so i feel the problem is bash and sh 'difference.
Solution 2:[2]
Try this.
Run whereis mvn on your agent then copy the path where mvn is installed and use it as the command in GoCD.
For me it was like this:
Command
/opt/apache-maven-3.8.2/bin/mvn
Arguments
clean
package
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | juice orange |
| Solution 2 | Daniel Ezihe |
