Annotation processor output in maven

后端 未结 2 1230
悲哀的现实
悲哀的现实 2021-01-11 12:10

I\'m using JSR 269 as a way to analyze code during compilation and to fail it if needed. I\'m having troubles with displaying output of my annotation processor in maven (Ant

2条回答
  •  借酒劲吻你
    2021-01-11 12:54

    I think you are running into a Maven bug or better a bug in the compiler plugin - MCOMPILER-66. When it comes to annotation processing the compiler plugin has several problems, eg also MCOMPILER-62. Really the best option imo is to disable annotation processing for the compiler plugin and use the maven-processor-plugin. In this blog post you can see how to use it. It looks like this:

       
        
            maven-compiler-plugin
            
                1.6
                1.6
                -proc:none
            
        
        
            org.bsc.maven
            maven-processor-plugin
            1.3.7
            
                
                    process
                    
                        process
                    
                    process-sources
                
            
            
                
                    org.hibernate
                    hibernate-jpamodelgen
                    1.1.0.Final
                    compile
                
            
        
    

    Note also how the annotation processor dependency is nicely scoped to the plugin only.

提交回复
热议问题