Java 9 HttpClient java.lang.NoClassDefFoundError: jdk/incubator/http/HttpClient

后端 未结 2 692
南旧
南旧 2020-12-17 22:50

I am trying to use the HttpClient from incubator in Java 9 maven project. I am not getting any Compilation issue. The project builds successfully. But when I try to run the

2条回答
  •  [愿得一人]
    2020-12-17 23:47

    If the accepted answer still did not work for you then..

    The missing secret is to also include the maven-surefire-plugin with the same compiler arg.

    
            
                
                    org.apache.maven.plugins
                    maven-compiler-plugin
                    3.7.0
                    
                        10
                        10
                        --add-modules=jdk.incubator.httpclient
                    
                
                
                    org.apache.maven.plugins
                    maven-surefire-plugin
                    2.21.0
                    
                        --add-modules=jdk.incubator.httpclient
                    
                
            
        
    

提交回复
热议问题