小编Jan*_* S.的帖子

如何使用JDK10(jigsaw)和Maven3来运行JUnit5?

我和一些朋友一起使用jdk 10应用程序,它使用jigsk功能集(在jdk9中引入)和junit5和maven作为构建管理.

但总是如果我们尝试使用Maven运行测试,我们会得到一个InaccessibleObjectException异常,例如:

[ERROR] resourceSchedule  Time elapsed: 0.001 s  <<< ERROR!
java.lang.reflect.InaccessibleObjectException: Unable to make de.truncated.framework.shared.resources.ResourceManagerTest() accessible: module de.truncated.framework.shared does not "opens de.truncated.framework.shared.resources" to unnamed module @ed7f8b4
Run Code Online (Sandbox Code Playgroud)

我现在谷歌搜索...在jdk9它可以简单地使用--permit-illegal-access,但这在jdk10中是不可能的,因为这个标志被删除了.来自junit5的jdk10代码示例和github上的其他代码不会使用拼图看起来如何.

所以看起来我错过了maven,module或jvm args config中的一些主要内容.如果有人可以就此事提供帮助,那将是非常好的.

非常感谢你!

项目的一些额外信息可能会有所帮助:

  • 主代码由模块信息文件配置,该文件导出(不打开)给每个人(它的代码库之类的框架)
  • 测试代码没有模块化
  • 目前没有应用jvm args

二手版本:

<properties>
   <java.version>10</java.version>
   <maven.compiler.version>3.7.0</maven.compiler.version>
   <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   <surefire.version>2.21.0</surefire.version>
   <asm.version>6.1.1</asm.version>
   <junit.jupiter.version>5.2.0</junit.jupiter.version>
   <junit.platform.version>1.2.0</junit.platform.version>
</properties>
Run Code Online (Sandbox Code Playgroud)

depencies:

    <!--
    junit 5 dependency
    -->
    <dependency>
        <groupId>org.junit.platform</groupId>
        <artifactId>junit-platform-launcher</artifactId>
        <version>${junit.platform.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>${junit.jupiter.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>${junit.jupiter.version}</version>
        <scope>test</scope>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

构建插件:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven.compiler.version}</version> …
Run Code Online (Sandbox Code Playgroud)

java maven-3 java-platform-module-system java-10 junit5

5
推荐指数
1
解决办法
797
查看次数

如何升级到新安装的 gitlab runner 版本?

我尝试将我的单个 gitlab runner 从 11.0 更新到 11.3.1 并按照 gitlab doc上的说明进行操作。

sudo apt-get install gitlab-runner将确认我安装了新版本:

gitlab-runner 已经是最新版本(11.3.1)。

像 10.* 到 11.0 这样的最后更新工作得很好,但这次运行程序仍然停留在 11.0(在 -help 和 gitlab-ci web ui 中)。

跑步者的重新启动不会改变任何东西,所以看起来我错过了更新的主要步骤。

找出我做错了什么会很棒,提前致谢。:-)

操作系统:Ubuntu 18.04.1

(我在 linux 和 gitlab 世界中相对较新,所以它可能是显而易见的)

使用的更新命令:

# For Debian/Ubuntu/Mint
sudo apt-get update
sudo apt-get install gitlab-runner
Run Code Online (Sandbox Code Playgroud)

gitlab gitlab-ci gitlab-ci-runner

3
推荐指数
1
解决办法
6051
查看次数