Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AspectJ not compiling

I'm trying to use the metrics-aspectj library (https://github.com/astefanutti/metrics-aspectj) to get annotated metrics working in my Dropwizard app, but I am seeing the following exception on startup:

[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

This is what's in my pom file:

<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>

App Details

  • Java 8
  • Dropwizard
  • Multi Module Setup
like image 947
user2158382 Avatar asked Aug 20 '26 00:08

user2158382


1 Answers

[ERROR] error Missing message: configure.incompatibleComplianceForSource in: org.aspectj.ajdt.ajc.messages

Will be fixed by adding

<complianceLevel>1.8</complianceLevel>

in addition to the <source/> & <target/>

<complianceLevel/> defaults to 1.5 and <source/> 1.8 is not backwards compatible to 1.5.

like image 173
pirho Avatar answered Aug 22 '26 19:08

pirho