AspectJ没有编译

问题描述 投票:3回答:1

我正在尝试使用metrics-aspectj库(https://github.com/astefanutti/metrics-aspectj)来获取在我的Dropwizard应用程序中使用的带注释的指标,但我在启动时看到以下异常:

[ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.8:compile (default) on project app: AJC compiler errors:
[ERROR] error Missing message: configure.incompatibleComplianceForSource in: org.aspectj.ajdt.ajc.messages
[ERROR] error no sources specified
[ERROR] abort AspectJ Compiler 1.8.7

这是我的pom文件中的内容:

<dependency>
  <groupId>io.astefanutti.metrics.aspectj</groupId>
  <artifactId>metrics-aspectj</artifactId>
  <version>1.2.0</version>
</dependency>
<dependency>
  <groupId>org.aspectj</groupId>
  <artifactId>aspectjrt</artifactId>
  <version>1.8.10</version>
</dependency>

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    <version>1.8</version>
    <configuration>
      <source>1.8</source>
      <target>1.8</target>
      <aspectLibraries>
        <aspectLibrary>
          <groupId>io.astefanutti.metrics.aspectj</groupId>
          <artifactId>metrics-aspectj</artifactId>
        </aspectLibrary>
      </aspectLibraries>
    </configuration>
    <executions>
      <execution>
        <goals>
          <goal>compile</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

应用详情

  • Java 8
  • Dropwizard
  • 多模块设置
java maven java-8 aspectj dropwizard
1个回答
3
投票

[ERROR]错误消息:configure.incompatibleComplianceForSource in:org.aspectj.ajdt.ajc.messages

将通过添加修复

<complianceLevel>1.8</complianceLevel>

除了<source/><target/>

<complianceLevel/>默认为1.5<source/> 1.8不向后兼容1.5

© www.soinside.com 2019 - 2024. All rights reserved.