aspectj-maven-plugin, declare soft how to compile

后端 未结 1 800
终归单人心
终归单人心 2020-12-21 23:35

Is it possible to compile project with softened Exceptions (e.g.: declare soft: Exception : execution(* *.*());) aspects in it using only aspectj-maven-plugin ?

1条回答
  •  一生所求
    2020-12-22 00:24

    Actually I think there is a bug in Maven Compiler Plugin 3.0 and 3.1 because for me it works with plugin version 2.5.1. It seems that incremental compilation is broken or the corresponding switch useIncrementalCompilation is somehow accidentally reversed in its meaning since it was introduced in 3.1. Funnily, setting its value to false fixes the situation for me. Downgrading to 2.5.1 also does. In both cases I need to change the phase for the AspectJ Maven Plugin to process-sources as described in the question linked to by user @Gus.

    Solution A:

    
    4.0.0
    
        de.scrum-master.stackoverflow
        aspectj-soft-exceptions
        1.0-SNAPSHOT
    
    
        UTF-8
        1.8.0
    
    
    AspectJ sample with declare soft
    Demonstrates how to build an AspectJ project using "declare soft" with Maven
    
        
            
                maven-compiler-plugin
                3.1
                
                    1.7
                    1.7
                    
                    false
                
            
            
                org.codehaus.mojo
                aspectj-maven-plugin
                1.6
                
                    true
                    1.7
                    1.7
                    ignore
                    1.7
                    UTF-8
                    true
                
                
                    
                        
                        process-sources
                        
                            compile
                            test-compile
                        
                    
                
                
                    
                        org.aspectj
                        aspectjtools
                        ${aspectj.version}
                    
                
            
        
    
    
    
        
            org.aspectj
            aspectjrt
            ${aspectj.version}
            runtime
        
    
    
    
    

    Solution B:

    
    4.0.0
    
        de.scrum-master.stackoverflow
        aspectj-soft-exceptions
        1.0-SNAPSHOT
    
    
        UTF-8
        1.8.0
    
    
    AspectJ sample with declare soft
    Demonstrates how to build an AspectJ project using "declare soft" with Maven
    
        
            
                maven-compiler-plugin
                
                2.5.1
                
                    1.7
                    1.7
                
            
            
                org.codehaus.mojo
                aspectj-maven-plugin
                1.6
                
                    true
                    1.7
                    1.7
                    ignore
                    1.7
                    UTF-8
                    true
                
                
                    
                        
                        process-sources
                        
                            compile
                            test-compile
                        
                    
                
                
                    
                        org.aspectj
                        aspectjtools
                        ${aspectj.version}
                    
                
            
        
    
    
    
        
            org.aspectj
            aspectjrt
            ${aspectj.version}
            runtime
        
    
    
    
    

    0 讨论(0)
提交回复
热议问题