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

Problema em: Maven > Update Project

Não estou conseguindo fazer o update. Após tentar aparecem os seguintes erros:

Building Workspace:

Errors occurred during the build.
Errors running builder 'Maven Project Builder' on project 'projeto-jpa-2'.
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6

Updating Maven Project

Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6

No arquivo pom.xml, o aparece sublinhado em vermelho com a seguinte anotação:

Multiple annotations found at this line:
    - CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for 
     org.apache.maven.plugins:maven-compiler-plugin:jar:3.3: ArtifactResolutionException: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:3.3 from/to central (https://
     repo.maven.apache.org/maven2): Connection reset
    - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.3:testCompile (execution: default-testCompile, phase: test-compile)
    - CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for 
     org.apache.maven.plugins:maven-compiler-plugin:jar:3.3: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:3.3 from https://repo.maven.apache.org/
     maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact 
     org.apache.maven.plugins:maven-compiler-plugin:pom:3.3 from/to central (https://repo.maven.apache.org/maven2): Connection reset
    - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (execution: default-compile, phase: compile)

E no começo do arquivo pom fica um "x" vermelho com esta anotação:

Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the 
 update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central (https://
 repo.maven.apache.org/maven2): Connection reset

Como resolver?

11 respostas

Apaga sua pasta .m2 e recompila o projeto

Então, apaguei o .m2 e o projeto, baixei e importei de novo e continua com erros.

Aparece como erro "Connection reset"

E o console Maven no update mostrou (entre outros):

21/08/2019 10:51:02 BRT: [INFO] Downloaded https://repo.maven.apache.org/maven2/javax/javaee-web-api/7.0/javaee-web-api-7.0-sources.jar
21/08/2019 10:51:02 BRT: [ERROR] Could not download sources for javax:javaee-web-api:7.0
21/08/2019 10:51:05 BRT: [INFO] Downloaded https://repo.maven.apache.org/maven2/org/hibernate/hibernate-validator/5.2.1.Final/hibernate-validator-5.2.1.Final-sources.jar
21/08/2019 10:51:05 BRT: [ERROR] Could not download sources for org.hibernate:hibernate-validator:5.2.1.Final

No sublinhado do plugins:

Multiple annotations found at this line:
    - CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for 
     org.apache.maven.plugins:maven-compiler-plugin:jar:3.3: ArtifactResolutionException: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:3.3 from/to central (https://
     repo.maven.apache.org/maven2): Connection reset
    - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.3:testCompile (execution: default-testCompile, phase: test-compile)
    - CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for 
     org.apache.maven.plugins:maven-compiler-plugin:jar:3.3: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:3.3 from https://repo.maven.apache.org/
     maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact 
     org.apache.maven.plugins:maven-compiler-plugin:pom:3.3 from/to central (https://repo.maven.apache.org/maven2): Connection reset
    - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (execution: default-compile, phase: compile)

O que achei mais estranho é que não encontro as jar que diz que foi baixado... na .m2 só tem arquivos "LASTUPDATED" e "PROPERTIES", todos com 1KB cada, mas nada das JAR propriamente ditas.

Qual versão do Java e do Maven você está usando?

Faz upload do seu projeto no github, vou tentar buildar ele aqui

java version "1.8.0_144" Java(TM) SE Runtime Environment (build 1.8.0_144-b01) Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

Eclipse IDE for Enterprise Java Developers. Version: 2019-06 (4.12.0) Build id: 20190614-1200

Maven eu não sei porque ainda não consegui usar.

Não sei se fiz certo porque ainda não tinha usado o Github, mas basicamente é o arquivo base do curso. (Não consegui exportar o jar)

https://github.com/Noriller/Primeiro

Consegui buildar o projeto sem problemas,

faz via linha de comando, entra pelo terminal no diretório do projeto (onde fica o pom.xml) e roda:

mvn clean install

Deve ser problema no computador mesmo... porque baixei, instalei e fiz isso e mesmo assim deu erro.

Faz um teste da sua máquina, tenta baixar o jar desse link: https://repo.maven.apache.org/maven2/javax/javaee-web-api/7.0/javaee-web-api-7.0-sources.jar

o download é concluído com sucesso ou é barrado?

Pelo browser? Sim. Pelo Eclipse/Maven que é o problema.

Para resolver, eu baixei tudo na minha máquina pessoal (estou no trabalho) e fiz por lá, então copiei a pasta .m2 e consegui fazer o update como "offline".

Tenta clicar com o botão direito em seu Projeto -> Maven -> Update Project.

Nessa caixa de diálogo, marque a caixa de seleção Force Update of Snapshots / Releases e clique em OK

Veja se resolve

solução!

Não funcionou.

Mas consegui finalmente fazer funcionar.

Primeiro: o Maven não estava usando as configurações de proxy do Eclipse, então fiz o arquivo .m2\settings.xml e configurei o proxy:

<?xml version="1.0" encoding="UTF-8"?>
<settings
 xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
 <pluginGroups/>
 <proxies>
  <!-- Proxy for HTTP -->
  <proxy>
   <id>optional</id>
   <active>true</active>
   <protocol>http</protocol>
   <username>username</username>
   <password>password</password>
   <host>localhost</host>
   <port>80</port>
   <nonProxyHosts>local.net</nonProxyHosts>
  </proxy>

 </proxies>

 <servers/>
 <mirrors/>
 <profiles/>
</settings>

Depois, como ainda estava dando um erro de nesting, exclui a pasta src e ele conseguiu fazer o update.

Obrigado por tudo.

Perfeito Bruno, então era configurar o proxy no eclipse para resolver :)

Bons estudos!