You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用ModiTect进行Jlink时无法找到当前模块的问题

使用ModiTect为Java应用执行Jlink操作的配置分享

我最近在给我的Java应用做Jlink打包,选用了ModiTect工具来完成这个工作。参考了官方README文档,还有undertow和vert.x的示例项目后,我在项目的pom.xml中添加了以下执行配置:

<execution>
  <id>create-runtime-image</id>
  <phase>package</phase>
  <goals>
    <goal>create-runtime-image</goal>
  </goals>
  <configuration>
    <modulePath>
      <path>${project.build.directory}/modules</path>
    </modulePath>
    <modules>
      <module>tech.dashman.dashman</module>
      <!-- 省略其他需打包的模块配置 -->
    </modules>
  </configuration>
</execution>

简单说下这段配置的几个关键部分:

  • 执行时机与目标:绑定到Maven的package阶段,执行ModiTect的create-runtime-image目标,确保打包完成后自动生成运行时镜像
  • 模块路径配置:指定${project.build.directory}/modules作为模块查找路径,ModiTect会从这里读取需要打包的模块文件
  • 待打包模块:明确列出要包含进运行时镜像的主模块tech.dashman.dashman,后续可以补充其他依赖模块

内容的提问来源于stack exchange,提问作者Pablo Fernandez

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 08:54:08