Maven Groovy and Java + Lombok

前端 未结 2 1700
孤独总比滥情好
孤独总比滥情好 2020-12-09 10:23

I am trying to add groovy to an existing Java Maven project that leverages Lombok. Unfortunately when I enable the groovy-maven-eclipse compiler with the pom fragment below,

2条回答
  •  醉话见心
    2020-12-09 10:32

    @Todd: The groovy-eclipse-compiler is the best choice if you don't need to developp maven plugin with some groovy tooling (see http://groovy.codehaus.org/Groovy-Eclipse+compiler+plugin+for+Maven).

    @Ambience: you reached the issue related at http://jira.codehaus.org/browse/GRECLIPSE-1293. This bug is now fixed with latest groovy-eclipse-compiler 2.6.1-01-SNAPSHOT.

    Note: The latest version available is now 2.9.1-01, see http://docs.groovy-lang.org/latest/html/documentation/tools-groovyeclipse.html

    You have to modify your pom like this:

    
        maven-compiler-plugin
        3.1
        
          groovy-eclipse-compiler
          true   
          true 
          
            lombok.launch.Agent
          
        
        
            
                org.codehaus.groovy
                groovy-eclipse-compiler
                2.9.1-01
            
            
            
                org.codehaus.groovy
                groovy-eclipse-batch
                2.3.7-01
            
            
                org.projectlombok
                lombok
                1.16.4
            
        
    
    

    The mandatory parts:

    true
    
    
        lombok.launch.Agent
    
    

    The added dependency on lombok inside the maven-compiler-plugin

    Edit: update versions

提交回复
热议问题