Handle different language and target levels for sources and tests with IntelliJ IDEA

前端 未结 2 1593
广开言路
广开言路 2021-01-02 00:47

I\'m interested if someone has clue how to handle this pom in projects properties of IDEA:


   org.apache.maven.plugins         


        
2条回答
  •  青春惊慌失措
    2021-01-02 01:30

    As already mentioned different language levels for main and test sources are not yet supported by Idea.

    There's a workaround to force Idea to use the language level defined in testSource when importing Maven project. You can create a separate Maven profile only for Idea with different compiler plugin settings:

    
    
        
            default
            
                true
            
            
                
                    
                        org.apache.maven.plugins
                        maven-compiler-plugin
                        3.2
                        
                            1.6
                            1.6
                            1.8
                            1.8
                        
                    
                
            
        
    
        
            ide
            
                false
                
                    idea.maven.embedder.version
                
            
            
                
                    
                        org.apache.maven.plugins
                        maven-compiler-plugin
                        3.2
                        
                            1.8
                            1.8
                            1.8
                            1.8
                        
                    
                
            
        
    
    
    

提交回复
热议问题