我正试图在eclipse03-2020中使用gradle6.6和openjre11.0.2构建一个java项目。在构建使用jrt-fs.jar中的类的项目时,我面临编译问题;e、 g.“太阳网。www.protocol.http.handler“,它位于openjre 11中。
public class Manager extends sun.net.www.protocol.https.Handler{
(package sun.net.www.protocol.https is declared in module java.base, which
does not export it)
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
以下是my build.gradle:
apply plugin: 'java'
apply plugin: 'application'
allprojects {
apply plugin: 'java'
sourceCompatibility = '11.0.2'
targetCompatibility = JavaVersion.VERSION_11
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'lib', include: '*.jar')
compile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
compile group: 'junit', name: 'junit', version: '4.10'
compile group: 'jmock', name: 'jmock', version: '1.0.1'
compile group: 'com.google.code.findbugs',name: 'findbugs', version: '1.3.9'
compile group: 'cglib', name: 'cglib', version: '2.1'
testCompile group: 'junit', name: 'junit', version: '4.10'
}
另外,如何避免通过gradle构建测试类?
1条答案
按热度按时间oug3syen1#
正如@dave\u thompson\u085所建议的,这个问题是由于sun.net.*包的模块化限制(jdk-1.9以后的版本)造成的,因为它们是jdk的内部包。在jdk-1.8中可以访问上述包。我们需要修正我们的代码