本文介绍了JUnit 5,Java 9和Gradle:如何传递--add-modules?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从Java 8迁移到Java9.运行测试时,我得到有关javax.xml.bind.JAXBContext的CNFE.因此,似乎需要"--add-modules java.xml.bind".我试图扩展我的GRADLE_OPTS env变量,但错误仍然存​​在.任何提示表示赞赏.

I want to migrate from Java 8 to Java 9. When running my tests I get a CNFE regarding javax.xml.bind.JAXBContext. Therefore, "--add-modules java.xml.bind" seems to be required. I tried to extend my GRADLE_OPTS env variable, but the error remains. Any hint is appreciated.

推荐答案

根据艾伦·贝特曼(Alan Bateman),我在build.gradle中添加了以下几行,以便gradle bootRun也可以使用:

According to Alan Bateman, I added the following lines to build.gradle so that gradle bootRun also works:

runtime('org.glassfish.jaxb:jaxb-runtime:2.3.0', 'javax.activation:activation:1.1.1')

这篇关于JUnit 5,Java 9和Gradle:如何传递--add-modules?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 17:44