4

I've just finished intergration of my web-projects with AspectJ and come across with the following issue:

I have two projects: api (containning aspects), web-app, where web-app depends on api. I'm using Java 7 and declare the following plugins in the api projects:

<plugin>
   <artifactId>maven-compiler-plugin</artifactId>
      <configuration>
          <source>1.7</source>
          <target>1.7</target>
          <encoding>UTF-8</encoding>
      </configuration>
</plugin>
<plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>aspectj-maven-plugin</artifactId>
   <version>1.7</version>
   <configuration>
      <outxml>true</outxml>
      <XterminateAfterCompilation>true</XterminateAfterCompilation>
   </configuration>
   <executions>
       <execution>
           <id>compile</id>
           <goals>
                <goal>compile</goal>
           </goals>
       </execution>
    </executions>
</plugin>

The web-app project contains the following:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    <version>1.7</version>
    <configuration>
        <outxml>true</outxml>
        <XterminateAfterCompilation>true</XterminateAfterCompilation>
        <aspectLibraries>
            <aspectLibrary>
                <groupId>ua.com.winforce</groupId>
                <artifactId>casino_aspect</artifactId>
            </aspectLibrary>
        </aspectLibraries>
     </configuration>

     <executions>
         <execution>
             <goals>
                  <goal>compile</goal>
             </goals>
         </execution>
      </executions>
</plugin>

And the issue is when I try to run mvn instal rigth after performing mvn clean it fails with multiple errors like that:

 Syntax error, annotations are only available 
 if source level is 1.5 or greater

But the second mvn install works just fine. Is that a bug of AspectJ plugin?

user3663882
  • 6,957
  • 10
  • 51
  • 92

1 Answers1

3

Try adding the source level to your aspectj maven plugin:

<configuration> <source>1.7</source> <target>1.7</target> <complianceLevel>1.7</complianceLevel> </configuration>

Fran Montero
  • 1,679
  • 12
  • 24