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

Aula 5.1 erro com Run As Maven e

Bom dia Pessoal,

fiz tudo certinho e revizei todos os passos, mas acontece esse error:

[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for br.com.caelum:livraria-maven:war:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.primefaces:primefaces:jar -> duplicate declaration of version 6.2 @ line 66, column 15
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Livraria Alura 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ livraria-maven ---
[INFO] Deleting C:\Users\cidev\Documents\WorkSpaces\livraria-maven\target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ livraria-maven ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ livraria-maven ---------------------------
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 20 source files to C:\Users\cidev\Documents\WorkSpaces\livraria-maven\target\classes
[INFO] -----------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] ------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.745 s
[INFO] Finished at: 2018-05-28T11:14:59-03:00
[INFO] Final Memory: 9M/243M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project livraria-maven: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] -> [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/MojoFailureException

usei o pom.xml da aula e um mais atual, o erro persiste.

Agradeco muito a ajuda!!

2 respostas
solução!

Oi Cid,

Esse erro geralmente ocorre quando no eclipse o Java está instalado como JRE e não como JDK.

Mas é necessário utilizar o JDK, pois nele é que se encontra o compilador Java.

Faz o seguinte, vai no menu superior: Window > Preferences > Java > Installed JREs

E modifica o seu Java apontando para o diretório JDK de onde ele estiver instalado.

no eclipse Window > Preference > Installed JREs

Verifique se se aparece o arquivo jre 1.8.0_161

Clique em Edit. Perceba em: JRE home está como jre. No final. Clique em Directory e mude para jdk.