Running JDK8 for aspectj

后端 未结 3 969
隐瞒了意图╮
隐瞒了意图╮ 2021-01-04 22:25

I am trying to run aspectj-maven plugin with JDK8. But it is giving errors like \"The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from requir

3条回答
  •  有刺的猬
    2021-01-04 23:04

    I had to achieve the same and I drove crazy trying to figure out this, fortunately I could solve it and here I give you what I did:

    To use aspectj-maven-plugin with Java 8 you need version aspectj-maven-plugin 1.7 (Note that aspectj-maven-plugin 1.6 works for Java 7).

    So, the maven plugin configuration needs to be:

            
            
                org.codehaus.mojo
                aspectj-maven-plugin
                1.7-SNAPSHOT
                
                    1.8
                    1.8
                    1.8
                
                
                    
                        
                            compile
                            test-compile
                        
                    
                
            
    

    By the way, the aspectJ jars needed are:

        
        
            org.aspectj
            aspectjrt
            1.8.1
        
        
            org.springframework
            spring-aop
            1.8.1
        
        
            org.aspectj
            aspectjweaver
            1.8.1
        
    

    And the most important thing I've struggled was that you need to install the aspectj-maven-plugin 1.7 jar manually into your pom.xml since this jar aren't on maven repo yet.

    You can get it from Haus Jira (look at the Attachment section):

    https://jira.codehaus.org/browse/MASPECTJ-131
    

    Btw, once you download it an copy it to your repo you need to create your own aspectj-maven-plugin-1.7-SNAPSHOT.pom file within the corresponding directory. You can copy it from version 1.6 BUT ensure you modify the following content:

     1.7-SNAPSHOT
    
     
        1.8.1
        2.2.1
        2.9
     
    

    That's all here you go, hope to help.

提交回复
热议问题