6
respostas

Problema ao tentar dar Build no projeto

Eu criei um projeto e ao tentar dar um build no mesmo, deu o seguinte erro:

[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------< br.com.clarobr:equipments >----------------------
[INFO] Building equipments 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.5:prepare-agent (jacoco-prepare-agent) @ equipments ---
[INFO] argLine set to "-javaagent:C:\\Users\\Felipe Lima\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.5\\org.jacoco.agent-0.8.5-runtime.jar=destfile=C:\\Users\\Felipe Lima\\Desktop\\Nova pasta (2)\\equipments\\target\\jacoco.exec,excludes=**/config/**:**/error/**:**/exception/**:**/correlation/**:**/observability/**:**/test/**:**/models/**:**/*Application.java:pom.xml"
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ equipments ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ equipments ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 25 source files to C:\Users\Felipe Lima\Desktop\Nova pasta (2)\equipments\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:  3.062 s
[INFO] Finished at: 2021-08-03T14:57:21-03:00
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "pom.xml" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project equipments: 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

Desde já agradeço pela ajuda

6 respostas

Oi Felipe

Pela mensagem de erro você não está com a JDK instalada na sua máquina, talvez tenha instalado a JRE.

[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

No seu terminal, rode o comando

javac -version

se não retornar a versão é porque o JDK não está instalado na sua máquina

Fala Otavio,

Eu fiz isso e reconheceu que eu tenho o jdk instalado. Mando abaixo um print da tela de CLI.

Insira aqui a descrição dessa imagem para ajudar na acessibilidade

Ainda sim o problema persiste.... :(

Oi Felipe,

Voce esta com o Java 11 instalado, mas o maven esta referenciando o Java 8, que no caso é a JRE e nao o JDK.

Voce precisa atualizar a variavel de ambiente JAVA_HOME no seu sistema para apontar para o diretorio do Java 11.

Aqui tem um exemplo de como fazer isso: https://confluence.atlassian.com/confbr1/configurando-a-variavel-java_home-no-windows-933709538.html

Obrigado Rodrigo, agora apareceu essa seguinte mensagem:

[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------< br.com.clarobr:equipments >----------------------
[INFO] Building equipments 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ equipments ---
[INFO] Deleting C:\Users\Felipe Lima\Desktop\Nova pasta (2)\equipments\target
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.5:prepare-agent (jacoco-prepare-agent) @ equipments ---
[INFO] argLine set to "-javaagent:C:\\Users\\Felipe Lima\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.5\\org.jacoco.agent-0.8.5-runtime.jar=destfile=C:\\Users\\Felipe Lima\\Desktop\\Nova pasta (2)\\equipments\\target\\jacoco.exec,excludes=**/config/**:**/error/**:**/exception/**:**/correlation/**:**/observability/**:**/test/**:**/models/**:**/*Application.java:pom.xml"
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ equipments ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ equipments ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 25 source files to C:\Users\Felipe Lima\Desktop\Nova pasta (2)\equipments\target\classes
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ equipments ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory C:\Users\Felipe Lima\Desktop\Nova pasta (2)\equipments\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ equipments ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\Felipe Lima\Desktop\Nova pasta (2)\equipments\target\test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ equipments ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running br.com.clarobr.EquipmentsApplicationTests
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.011 s <<< FAILURE! - in br.com.clarobr.EquipmentsApplicationTests
[ERROR] br.com.clarobr.EquipmentsApplicationTests  Time elapsed: 0.01 s  <<< ERROR!
java.lang.NoSuchMethodError: org.springframework.util.ReflectionUtils$MethodFilter.and(Lorg/springframework/util/ReflectionUtils$MethodFilter;)Lorg/springframework/util/ReflectionUtils$MethodFilter;

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   EquipmentsApplicationTests » NoSuchMethod org.springframework.util.ReflectionU...
[INFO] 
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  7.722 s
[INFO] Finished at: 2021-08-04T15:29:39-03:00
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "pom.xml" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.0:test (default-test) on project equipments: There are test failures.
[ERROR] 
[ERROR] Please refer to C:\Users\Felipe Lima\Desktop\Nova pasta (2)\equipments\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[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

Oi Felipe

Você rodou mvn clean install e deu essa mensagem de erro acima? Como está seu pom.xml e EquipmentsApplicationTests.java?

Ola Otavio,

Sim, eu rodei o mvn clean install (pelo Eclipse) e deu esse erro.

pom.xml: https://gist.github.com/Askanin/d066d1025a53882f45669cd721fedd5b.js

EquipmentsApplicationTests.java:

package br.com.clarobr;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class EquipmentsApplicationTests {

    @Test
    void contextLoads() {
    }

}