1

For some reason IntelliJ doesn't pick up the AspectJ dependency so when I try to use any AspectJ library it does not recognize it even though the AspectJ jar is installed in my repository.

My pom.xml has the following:

...
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>1.6.11</version>
        </dependency>
...
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>aspectj-maven-plugin</artifactId>
                    <version>1.4</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>compile</goal>
                            </goals>
                            <configuration>
                                <source>1.5</source>
                                <target>1.5</target>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
...

So when I have any library such as these:

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;

they are not recognized and not available in the external libraries.

crayon_box
  • 61
  • 1
  • 7
  • Does the project compile/run fine when run using command line? – Harshil Sharma Jan 05 '17 at 03:49
  • @HarshilSharma Yes everything is fine using the command line.. – crayon_box Jan 05 '17 at 05:16
  • JDK version? Maven version? Why do you still use AspectJ 1.6.11 (six years old, current is 1.8.10)? Why the outdated AspectJ Maven plugin 1.4 (current is 1.9)? Why Java language level 1.5? BTW, with the latest AJ and AJ Maven versions I can easily compile level 1.5 on my JDK 8, but I have problems using such outdated AJ and AJ Maven versions with Maven 3 and JDK 8. For me it works fine in both Eclipse and IntelliJ IDEA. P.S.: Have you installed AspectJ support in IntelliJ? – kriegaex Jan 05 '17 at 09:42
  • @kriegaex I was copying examples and left the outdated versions in, but I have now updated AspectJ to 1.8.10, AspectJ Maven Plugin to 1.9 and Java Language Level to 1.8 but issue still remains. My JDK version is 1.8.0_65 and Maven version is 3.3.9. No I have not installed AspectJ support, isn't that only for IntelliJ enterprise edition? I have community edition. – crayon_box Jan 05 '17 at 18:51

1 Answers1

1

I got it to work, I closed the project and re-imported it and now the AspectJ dependencies show up. I believe something was wrong with IntelliJ where it wasn't updating the dependencies that are in the repository.

crayon_box
  • 61
  • 1
  • 7