1
resposta

Erro ao excutar o "clean package" no Jenkis

Pessoal boa noite estou este erro:

Erro ao excutar o "clean package" na aba build no Jenkis, conforme a video aula, poderia me ajudar por favor ?

segue o erro:

Iniciado pelo usuário admin
Construindo no workspace C:\Program Files (x86)\Jenkins\workspace\argentum-web
 > git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git.exe config remote.origin.url https://github.com/alura-cursos/argentum-web.git # timeout=10
Fetching upstream changes from https://github.com/alura-cursos/argentum-web.git
 > git.exe --version # timeout=10
 > git.exe fetch --tags --progress https://github.com/alura-cursos/argentum-web.git +refs/heads/*:refs/remotes/origin/*
 > git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
 > git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
Checking out Revision e1c09b7b6dc948b66c633bf950b6eebe7c630136 (refs/remotes/origin/master)
 > git.exe config core.sparsecheckout # timeout=10
 > git.exe checkout -f e1c09b7b6dc948b66c633bf950b6eebe7c630136
Commit message: "Update index.xhtml"
 > git.exe rev-list e1c09b7b6dc948b66c633bf950b6eebe7c630136 # timeout=10
[argentum-web] $ cmd.exe /C "mvn clean package && exit %%ERRORLEVEL%%"
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building argentum-web 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ argentum-web ---
[INFO] Deleting C:\Program Files (x86)\Jenkins\workspace\argentum-web\target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.439 s
[INFO] Finished at: 2017-12-06T00:18:49-02:00
[INFO] Final Memory: 9M/220M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project argentum-web: Failed to clean project: Failed to delete C:\Program Files (x86)\Jenkins\workspace\argentum-web\target -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Build step 'Chamar alvos Maven de alto nível' marked build as failure
Finished: FAILURE
1 resposta

Oi Diogo, tudo bom?

O Windows prende um arquivo para ser apagado quando está sendo utilizado por outros programas, então tem algumas possibilidades pra a pasta /target não ter sido removida:

  • está aberta em algum lugar (terminal ou sistema de arquivos) -> no Jenkins não parece ser essa opção
  • o servidor está em pé ainda -> como o curso pediu no video anterior para subir o servidor manualmente, essa parece uma opção bem válida
  • tem outro job rodando no mesmo momento

Se conseguir identificar onde algum dos arquivos da pasta /target está sendo usado, tenta parar esse processo. Se não encontrar o que está sendo usado, dá pra colocar a opção -Dmaven.clean.failOnError=false junto com as fases do Maven para ele continuar executando o processo de build.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software