Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two Maven Errors - 'Type Cannot Be Resolved' + aspect weaver.1.8.0.M1 missing

I have two errors on an existing mvm project I am trying to build and not sure how to get these resolved.

First the main one:

[ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.5:compile (default) on project ws: Compiler errors:
The type java.util.Comparator cannot be resolved. It is indirectly referenced from required .class files

This one is bugging me a bit, I mean this is from the main JRE so I am not sure what this error means. I am building this from the command line and not through Eclipse or other IDEs at this stage. Most answers on the web seem to be based on putting the JRE on the project build path within eclipse.

I have Java 1.8 installed, running on OSX. My Java Source+Target version is 1.7.

The second is a warning, which I am not too fussed but I would like to remove it if I can:

[WARNING] The POM for org.aspectj:aspectjweaver:jar:1.8.0.M1 is missing, no dependency information available

Now I believe this is coming from Spring-Aspects-4.0 which I have dependency on, I have set an explicit decency on the POM to 1.7.4 (stable).

Anyway I can remove this warning, or do I need to put a dependency on the 1.8.0.M1 on my POM which I do not want to do.

like image 435
iQ. Avatar asked Dec 15 '22 20:12

iQ.


1 Answers

Right so after much tinkering, it seems the issue was that the environment it was being built on, had a JDK 8 installed and the aspectjweaver version was not compatible with it.

Therefore two solutions:

  1. Install JDK7 and set that as the JAVA_HOME before building.

or

  1. Set source/target to 1.8, set aspectjweaver to 1.8.1 version and that works.

The error message wasn't clear but it's sorted now.

like image 163
iQ. Avatar answered Dec 17 '22 11:12

iQ.