我正在尝试使用java 8运行mvn clean compile
,之前我正在使用正常工作的java 7。
使用java 8获取以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.
1:compile (default-compile) on project orion2-core: Fatal error compiling: Could
not find groovy-eclipse-batch artifact. Must add this artifact as an explicit d
ependency the pom. -> [Help 1]
在Pom中进行以下更改以使用java 8运行maven构建: -
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
<source>1.8</source>
<target>1.8</target>
<verbose>true</verbose>
<fork>true</fork>
<compilerArguments>
<javaAgentClass>lombok.core.Agent</javaAgentClass>
</compilerArguments>
</configuration>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>0.12.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.9.0-01-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>2.3.4-01</version>
</dependency>
</dependencies>
</plugin>
答案 0 :(得分:0)
将依赖项放在插件标记之外。
<plugin>
</plugin>
<dependencies> ... </dependencies>
答案 1 :(得分:0)
这对我有用:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerId>groovy-eclipse-compiler</compilerId>
<verbose>true</verbose>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>3.3.0-01</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>2.5.6-02</version>
</dependency>
</dependencies>
</plugin>
不确定龙目岛。我注意到这很脆弱。并非所有这些JAR版本都能很好地协同工作(例如,编译器3.1不喜欢groovy-eclipse-compiler 3.3)。如果出现错误,请尝试其他版本。
使用Maven Central的搜索表查找所有可能的版本:https://search.maven.org/search?q=a:groovy-eclipse-compiler