Home java How to run a test with maven?

How to run a test with maven?

Author

Date

Category

Hello, I’m trying to run the test with the command

mvn clean test site

but maven throws an error:

[INFO] Scanning for projects ...
[INFO]
[INFO] ----------------------------------------------- -------------------------
[INFO] Building TestWebDriver 0.0.1-SNAPSHOT
[INFO] ----------------------------------------------- -------------------------
[INFO]
[INFO] --- maven-clean-plugin: 2.5: clean (default-clean) @ TestWebDriver ---
[INFO] Deleting C: \ eclipse-workspace \ TestWebDriver \ target
[INFO]
[INFO] --- maven-resources-plugin: 2.6: resources (default-resources) @ TestWebDri
ver ---
[WARNING] Using platform encoding (Cp1251 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin: 3.6.1: compile (default-compile) @ TestWebDriver
---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1251, i.e. b
uild is platform dependent!
[INFO] Compiling 1 source file to C: \ eclipse-workspace \ TestWebDriver \ target \ clas
ses
[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: 2.138 s
[INFO] Finished at: 2017-07-16T16: 53: 53 + 03: 00
[INFO] Final Memory: 11M / 114M
[INFO] ----------------------------------------------- -------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins: maven-compiler-plugin: 3.
6.1: compile (default-compile) on project TestWebDriver: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on
a JRE rather than a JDK?
[ERROR]
[ERROR] - & gt; [Help 1]
[ERROR]
 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
 [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 rea
 d the following articles:
 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption

as I understand that he needs jdk, but how to specify it in the box, I wrote the address, but another one appears

[INFO] Scanning for projects ...
[INFO]
[INFO] ----------------------------------------------- -------------------------
[INFO] Building TestWebDriver 0.0.1-SNAPSHOT
[INFO] ----------------------------------------------- -------------------------
[INFO]
[INFO] --- maven-clean-plugin: 2.5: clean (default-clean) @ TestWebDriver ---
[INFO] Deleting C: \ eclipse-workspace \ TestWebDriver \ target
[INFO]
[INFO] --- maven-resources-plugin: 2.6: resources (default-resources) @ TestWebDri
 ver ---
[WARNING] Using platform encoding (Cp1251 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin: 3.6.1: compile (default-compile) @ TestWebDriver
---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1251, i.e. b
uild is platform dependent!
[INFO] Compiling 1 source file to C: \ eclipse-workspace \ TestWebDriver \ target \ clas
ses
[INFO] ----------------------------------------------- -------------------------
[INFO] BUILD FAILURE
[INFO] ----------------------------------------------- -------------------------
[INFO] Total time: 2.851 s
[INFO] Finished at: 2017-07-16T17: 09: 44 + 03: 00
[INFO] Final Memory: 11M / 114M
[INFO] ----------------------------------------------- -------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins: maven-compiler-plugin: 3.
6.1: compile (default-compile) on project TestWebDriver: Compilation failure - & gt; [
Help 1]
 [ERROR]
 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
 ch.
 [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 rea
 d the following articles:
 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption

Answer 1, authority 100%

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

Maven cannot find the installed version of jdk on local machine.

Try changing the JAVA_HOME variable.

On Linux

export JAVA_HOME = / usr / java / jdk1.5.0_07 / bin / java

In Windows, through the command line, do (naturally change the path to your java):

set JAVA_HOME = "C: \ Java \ jdk7"

Alternative Windows

Taken from here – & gt; https://www.java.com/en/download/help/path. xml

Windows 10 and Windows 8

  1. In the “Search” line, search for: System (Control Panel)

  2. Click on the Advanced system settings link.

  3. Click
    Environment Variables. In the Environment Variables section, select the variable
    environment PATH. Click Change. If the PATH variable does not exist,
    click Create.
  4. In the Modify System Variable (or New
    system variable) set the value of the PATH environment variable.
    Click OK. Close the rest of the open windows by clicking OK.
  5. Reopen the Command Prompt window and run the java code.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions