Tôi đang cố sử dụng aspectj-maven-plugin
trong dự án maven. Tại thời gian biên dịch, tôi nhận được:Lỗi cú pháp, chú thích chỉ khả dụng nếu cấp nguồn là 5.0 - AspectJ trong Maven
Syntax error, annotations are only available if source level is 5.0
Syntax error, annotations are only available if source level is 5.0
Syntax error, annotations are only available if source level is 5.0
Tuy nhiên, tôi đặt sau trong pom.xml của tôi:
<project.build.source>1.6</project.build.source>
<project.build.target>1.6</project.build.target>
Tôi có một số phụ thuộc vào:
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.11</version>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
</dependency>
Làm thế nào để giải quyết vấn đề này? Cảm ơn.
Giải pháp
Tôi được thêm vào sau trong pom.xml của tôi và bây giờ nó hoạt động:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
<configuration>
<source>${project.build.source}</source> <- Addition
<target>${project.build.target}</target> <- Addition
</configuration>
</execution>
</executions>
</plugin>
@Paul Không, tôi không làm vậy. Bây giờ nó hoạt động. Nếu bạn tạo một giải pháp, tôi sẽ chấp nhận nó. Cảm ơn. – JVerstry
Chắc chắn, sẽ làm. Chúc mừng. –
Ngoài ra, tôi cũng cần thêm đối số cấu hình conformLevel. Xem thêm tại đây: http://stackoverflow.com/questions/21548548/adding-aspectj-to-pom-xml-changed-java-version-with-maven-why – JoshC13