AspectJ Maven Plugin cannot compile my project

前端 未结 5 1301
难免孤独
难免孤独 2021-02-18 18:19

I try to use aspectj maven plugin for compile project with aspectj compiler and then I try to package classes into \"war\" file. Unfortunately, it doesn\'t work with following c

5条回答
  •  名媛妹妹
    2021-02-18 19:23

    Update: While the things I said about AspectJ Maven configuration in this answer are all correct, the root cause of the concrete problem at hand - bad Maven dependency management - is described in my other answer. It would be better if that one was the accepted answer and not this one.


    • User codelion's hint makes sense, please change your tag (typo?) - to .
    • There is no need to downgrade to plugin version 1.6, you can keep 1.7.
    • There is also no need to specify the configuration again within the section, the one at plugin level is enough.
    • Please note that the default AspectJ version in plugin 1.7 is 1.8.2, so maybe your runtime dependency on 1.7.4 works, but if I were you I would upgrade that one too, optimally in sync with the plugin version. It is no hard requirement, but I think it makes sense.
    • Maybe you even want to upgrade to the current version AspectJ 1.8.4, in the plugin as well as the runtime. This can also be achieved by adding a dependency to the desired aspectjtools version to the plugin configuration:
        
            UTF-8
            1.8
            1.8.4
        
    
        
            
                 
                    
                        org.codehaus.mojo
                        aspectj-maven-plugin
                        1.7
                        
                            true
                            ${java.source-target.version}
                            ${java.source-target.version}
                            ignore
                            ${java.source-target.version}
                            UTF-8
                            true
                        
                        
                            
                                
                                process-sources
                                
                                    compile
                                    test-compile
                                
                            
                        
                        
                            
                                org.aspectj
                                aspectjtools
                                ${aspectj.version}
                            
                        
                    
                
            
    
            
                
                    org.codehaus.mojo
                    aspectj-maven-plugin
                
            
        
    
        
            
                
                    org.aspectj
                    aspectjrt
                    ${aspectj.version}
                    runtime
                
            
        
    
        
            
                org.aspectj
                aspectjrt
            
        
    

提交回复
热议问题