Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Finished: Failure

Olá, não tenho experiência com Jenkins e nem com Java, então não sei qual arquivo tem de ser o raiz lá no meu repositório. Referencio o arquivo que foi disponibilizado pra ser baixado com o sistema leilao.

output do build:

Started by user Breno Santana Bruno
Running as SYSTEM
Building in workspace /var/jenkins_home/workspace/jenkins-test-java
[jenkins-test-java] $ mvn clean test
FATAL: command execution failed
java.io.IOException: error=2, No such file or directory
    at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
    at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:340)
    at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
Caused: java.io.IOException: Cannot run program "mvn" (in directory "/var/jenkins_home/workspace/jenkins-test-java"): error=2, No such file or directory
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
    at hudson.Proc$LocalProc.<init>(Proc.java:254)
    at hudson.Proc$LocalProc.<init>(Proc.java:223)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:997)
    at hudson.Launcher$ProcStarter.start(Launcher.java:509)
    at hudson.Launcher$ProcStarter.join(Launcher.java:520)
    at hudson.tasks.Maven.perform(Maven.java:369)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:818)
    at hudson.model.Build$BuildExecution.build(Build.java:199)
    at hudson.model.Build$BuildExecution.doRun(Build.java:164)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:526)
    at hudson.model.Run.execute(Run.java:1899)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
    at hudson.model.ResourceController.execute(ResourceController.java:107)
    at hudson.model.Executor.run(Executor.java:449)
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE

Atualizando. Coloquei Branch errada.

Started by user Breno Santana Bruno
Running as SYSTEM
Building in workspace /var/jenkins_home/workspace/jenkins-test-java
The recommended git tool is: NONE
No credentials specified
 > git rev-parse --resolve-git-dir /var/jenkins_home/workspace/jenkins-test-java/.git # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://github.com/LinuxLoverCoder/test-application-java-with-jenkins.git # timeout=10
Fetching upstream changes from https://github.com/LinuxLoverCoder/test-application-java-with-jenkins.git
 > git --version # timeout=10
 > git --version # 'git version 2.30.2'
 > git fetch --tags --force --progress -- https://github.com/LinuxLoverCoder/test-application-java-with-jenkins.git +refs/heads/*:refs/remotes/origin/* # timeout=10
Seen branch in repository origin/main
Seen 1 remote branch
 > git show-ref --tags -d # timeout=10
Checking out Revision 16605f8540cc87f026ff5658d99c8a5e9bc1144a (origin/main)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 16605f8540cc87f026ff5658d99c8a5e9bc1144a # timeout=10
Commit message: "Initial commit"
First time build. Skipping changelog.
[jenkins-test-java] $ mvn clean test
FATAL: command execution failed
java.io.IOException: error=2, No such file or directory
    at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
    at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:340)
    at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
Caused: java.io.IOException: Cannot run program "mvn" (in directory "/var/jenkins_home/workspace/jenkins-test-java"): error=2, No such file or directory
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
    at hudson.Proc$LocalProc.<init>(Proc.java:254)
    at hudson.Proc$LocalProc.<init>(Proc.java:223)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:997)
    at hudson.Launcher$ProcStarter.start(Launcher.java:509)
    at hudson.Launcher$ProcStarter.join(Launcher.java:520)
    at hudson.tasks.Maven.perform(Maven.java:369)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:818)
    at hudson.model.Build$BuildExecution.build(Build.java:199)
    at hudson.model.Build$BuildExecution.doRun(Build.java:164)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:526)
    at hudson.model.Run.execute(Run.java:1899)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
    at hudson.model.ResourceController.execute(ResourceController.java:107)
    at hudson.model.Executor.run(Executor.java:449)
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE
2 respostas

O maven acredito que já esteja instalado. Estou rodando o jenkins via docker.

solução!
FROM jenkins/jenkins:lts
# if we want to install via apt
USER root
RUN apt-get update && apt-get install -y maven
# drop back to the regular jenkins user - good practice
USER jenkins
services:
  jenkins:
    build: .
    ports:
      - "8080:8080"
      - "5000:5000"
    volumes:
      - ./.:/var/jenkins_home

esse volume ai q eu coloquei de qualquer jeito, mas vou testar, acredito que agora ele funcione. Funcionando aviso aqui

Atualizando. Build feito com sucesso.