【发布时间】:2016-10-28 19:05:20
【问题描述】:
我编写了一个使用 AspectJ 的 maven 模块,并且正在使用 AspectJ 编译器插件对其进行编译。我编写了一些使用 Java 8 谓词的单元测试,当我运行 mvn clean install 时,测试失败并出现以下错误:
error: lambda expressions are not supported in -source 1.5
奇怪的是,当我包含标准编译器插件和 aspectj 编译器时,它的构建没有问题。我不愿意同时使用这两个插件,因为我认为它们应该是互斥的?
编译器设置如下:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.8</version>
<configuration>
<complianceLevel>1.8</complianceLevel>
<source>1.8</source>
<target>1.8</target>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
【问题讨论】:
-
添加
1.8 1.8 1.8 并使用 aspectj 运行时版本 1.9.2 和插件版本 1.11 工作