How to ignore the Java Source directory during Maven Compilation?

前端 未结 5 2015
傲寒
傲寒 2020-12-13 19:59

I am trying to use the Lombok Maven Plugin to ensure the correct creation of Javadocs when using Lombok.

Lombok Maven introduces a new code generation goal, just pri

5条回答
  •  鱼传尺愫
    2020-12-13 20:45

    I tried to use the solutions from the other answers, but IntelliJ would still mark my source files from src/main/java as duplicated. So I just decided to get rid of the delombok's content after compilation. In the end that folder only server as an intermediary stage for compilation (in my case it was required to use lombok with AspectJ compiler) and there's no real need to keep it. I did it by configuring an additional execution of the clean plugin which would specifically target the delombok folder.

    Your POM should contain

    
    
        ${project.build.directory}/generated-sources/delombok
    
        
            
            
                org.projectlombok
                lombok-maven-plugin
                1.16.16.0
                
                    
                        generate-sources
                        
                            delombok
                        
                    
                
                
                    false
                    src/main/java
                
            
    
            
    
            
                maven-clean-plugin
                
                    
                        delombok-removal
                        compile
                        
                            clean
                        
                        
                            true
                            
                                
                                    ${project.build.sourceDirectory}/com 
                                
                            
                        
                    
                
            
        
    
    

提交回复
热议问题