我正在尝试在新笔记本电脑上设置Maven,但通过运行mvn clean test
测试一切正常,出现以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:testCompile (default-testCompile) on project test: Compilation failure -> [Help 1]
我已经浏览了其他文章,并根据建议对.pom文件进行了一些更改,但仍然遇到相同的错误。不确定要提供什么其他有用的信息,因此请让我知道对解决此问题有用的其他信息。以下是我的.pom文件:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>matt</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<inherited>true</inherited>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<fork>true</fork>
<executable>C:\Program Files\Java\jdk1.7.0_79\bin\javac</executable>
</configuration>
</plugin>
</plugins>
</build>
这是java -version:
C:\Users\admin\IdeaProjects\test>java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) Client VM (build 25.121-b13, mixed mode, sharing)
这是mvn -version:
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-25T02:41:47+08:00)
Maven home: C:\Automation\Maven\apache-maven-3.6.0\bin\..
Java version: 1.8.0_121, vendor: Oracle Corporation, runtime: C:\Program Files (x86)\Java\jre1.8.0_121
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "x86", family: "windows"
答案 0 :(得分:2)
您的pom文件没有问题。该错误明确指出“编译错误”。 所以可能您缺少某些内容,或者您的源代码中有错别字。
因此,请尝试向您的问题添加更多信息或一些代码段
答案 1 :(得分:0)
尝试从C:\ Users \ User.m2 \ repository \ com \ google删除“ google”文件夹,然后尝试重建。这应该会对您有所帮助。