通过命令行运行时的 Maven 编译错误 - Cucumber Maven Project

2022-01-22 00:00:00 cucumber eclipse maven

从命令行运行的 mvn clean test 说,在这个环境中没有提供编译器,也许你是在 JRE 而不是 JDK 上运行.

mvn clean test running from command line says , No Compiler is provided in this environment , perhaps you are running on JRE rather than a JDK.

在首选项中选择安装的 JRE 作为最新的 JDK,仍然出现上述错误.运行单个功能文件时,正在执行旧代码(即,虽然我从场景中注释掉了几个步骤,但它们正在被执行)

Selected Installed JRE's as latest JDK in preferences, still am getting the above error. When running single feature file , the old code is being executed (i.e. though i comment out few steps from the scenario , they are being executed)

使用 Jenkins 构建时相同的代码运行良好.

Same code when building with Jenkins is working fine.

推荐答案

假设 windows 和您的实际目录可能不同,请确保:

Assuming windows and your actual directories may vary, make sure :

1) 你的 JAVA_HOME 环境变量设置为 .../jdk1.8/目录

1) Your JAVA_HOME environment variable is set to .../jdk1.8/ directory

2) 您的 M2_HOME 设置为您的 ../apache-maven-3.... 目录

2) Your M2_HOME is set to your ../apache-maven-3.... directory

3) %JAVA_HOME%/bin &%M2_HOME%/bin 在你的路径中

3) %JAVA_HOME%/bin & %M2_HOME%/bin are in your path

4) 使用 mvn -version 进行检查,您应该会看到如下内容:

4) Check this with mvn -version, you should see something like:

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00)
Maven home: C:opensourceapache-maven-3.3.9
Java version: 1.8.0_92, vendor: Oracle Corporation
Java home: C:PROGRA~1Javajdk1.8.0_92jre
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"

相关文章