jdk11 使用 maven 编译会卡住

2023-07-09 18:06:39 +08:00
 bqdong

请教大家一个问题,jdk8 升 jdk11 ,这个项目编译会卡住,这问题在哪里?不知道如何排查

项目地址: https://github.com/bqdong/mwe-jdk11

1341 次点击
所在节点    问与答
9 条回复
yyyxxx109876
2023-07-09 18:25:36 +08:00
无法重现:

[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.mycompany.app.AppTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.018 s - in com.mycompany.app.AppTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- jar:3.3.0:jar (default-jar) @ my-app ---
[INFO] Building jar: /Users/bozhang/Projects/mwe-jdk11/target/my-app-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.663 s
[INFO] Finished at: 2023-07-09T20:24:42+10:00
[INFO] ------------------------------------------------------------------------
hhjswf
2023-07-09 18:43:16 +08:00
专业点,至少提供一下 maven 版本
bqdong
2023-07-09 19:13:18 +08:00
@yyyxxx109876 谢谢回复。我用的是 JDK11 ,Maven 3.6.3 ,命令是下面的,执行完就卡在 search path for classes file

JDK11, maven 3.6.3

- 执行 mvn clean package

[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.mycompany.app:my-app >----------------------
[INFO] Building my-app 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ my-app ---
[INFO] Deleting /home/bqdong/temp/java/my-app/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ my-app ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/bqdong/temp/java/my-app/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ my-app ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/bqdong/temp/java/my-app/target/classes
[parsing started SimpleFileObject[/home/bqdong/temp/java/my-app/src/main/java/com/mycompany/app/App.java]]
[parsing completed 23ms]
[loading /modules/java.xml/module-info.class]
[loading /modules/jdk.localedata/module-info.class]
[loading /modules/jdk.internal.opt/module-info.class]
[loading /modules/jdk.jdwp.agent/module-info.class]
[loading /modules/jdk.internal.vm.compiler/module-info.class]
[loading /modules/java.management/module-info.class]
[loading /modules/jdk.jcmd/module-info.class]
[loading /modules/jdk.httpserver/module-info.class]
[loading /modules/jdk.management/module-info.class]
[loading /modules/java.instrument/module-info.class]
[loading /modules/jdk.aot/module-info.class]
[loading /modules/jdk.unsupported.desktop/module-info.class]
[loading /modules/jdk.internal.ed/module-info.class]
[loading /modules/jdk.scripting.nashorn/module-info.class]
[loading /modules/java.prefs/module-info.class]
[loading /modules/jdk.crypto.cryptoki/module-info.class]
[loading /modules/java.rmi/module-info.class]
[loading /modules/jdk.accessibility/module-info.class]
[loading /modules/java.management.rmi/module-info.class]
[loading /modules/jdk.pack/module-info.class]
[loading /modules/jdk.jlink/module-info.class]
[loading /modules/jdk.jdeps/module-info.class]
[loading /modules/jdk.management.jfr/module-info.class]
[loading /modules/jdk.internal.vm.compiler.management/module-info.class]
[loading /modules/jdk.internal.le/module-info.class]
[loading /modules/jdk.dynalink/module-info.class]
[loading /modules/jdk.security.jgss/module-info.class]
[loading /modules/jdk.charsets/module-info.class]
[loading /modules/jdk.internal.jvmstat/module-info.class]
[loading /modules/jdk.jartool/module-info.class]
[loading /modules/jdk.jdi/module-info.class]
[loading /modules/java.smartcardio/module-info.class]
[loading /modules/jdk.jfr/module-info.class]
[loading /modules/java.logging/module-info.class]
[loading /modules/jdk.management.agent/module-info.class]
[loading /modules/java.naming/module-info.class]
[loading /modules/jdk.editpad/module-info.class]
[loading /modules/jdk.unsupported/module-info.class]
[loading /modules/jdk.naming.rmi/module-info.class]
[loading /modules/java.scripting/module-info.class]
[loading /modules/jdk.internal.vm.ci/module-info.class]
[loading /modules/jdk.scripting.nashorn.shell/module-info.class]
[loading /modules/jdk.sctp/module-info.class]
[loading /modules/jdk.crypto.ec/module-info.class]
[loading /modules/jdk.naming.dns/module-info.class]
[loading /modules/java.compiler/module-info.class]
[loading /modules/java.base/module-info.class]
[loading /modules/java.se/module-info.class]
[loading /modules/java.sql/module-info.class]
[loading /modules/jdk.net/module-info.class]
[loading /modules/java.security.jgss/module-info.class]
[loading /modules/jdk.javadoc/module-info.class]
[loading /modules/java.net.http/module-info.class]
[loading /modules/jdk.compiler/module-info.class]
[loading /modules/jdk.jconsole/module-info.class]
[loading /modules/java.security.sasl/module-info.class]
[loading /modules/jdk.rmic/module-info.class]
[loading /modules/java.datatransfer/module-info.class]
[loading /modules/java.xml.crypto/module-info.class]
[loading /modules/jdk.xml.dom/module-info.class]
[loading /modules/jdk.jstatd/module-info.class]
[loading /modules/java.transaction.xa/module-info.class]
[loading /modules/jdk.hotspot.agent/module-info.class]
[loading /modules/jdk.security.auth/module-info.class]
[loading /modules/jdk.zipfs/module-info.class]
[loading /modules/jdk.jshell/module-info.class]
[loading /modules/jdk.jsobject/module-info.class]
[loading /modules/java.desktop/module-info.class]
[loading /modules/jdk.attach/module-info.class]
[loading /modules/java.sql.rowset/module-info.class]
[search path for source files: /home/bqdong/temp/java/my-app/src/main/java,/home/bqdong/temp/java/my-app/target/generated-sources/annotations]
[search path for class files: /home/bqdong/.bin/jdk-11.0.0.1/lib/modules,/home/bqdong/temp/java/my-app/target/classes,/home/bqdong/.m2/repository/com/dingtalk/open/taobao-sdk-java-auto/0.0.1/taobao-sdk-java-auto-0.0.1.jar,.]

- 然后就一直卡在这里不动了
bqdong
2023-07-09 19:14:11 +08:00
@hhjswf 老哥,已经补充上了,github 的 readme 中也有写重现步骤
mmdsun
2023-07-09 23:33:59 +08:00
项目很大吗?把 maven 内存设置大点改 JVM 参数。
bqdong
2023-07-10 09:07:53 +08:00
@mmdsun 不大,就 github 里的那个项目,是一个示例。我感觉可能是依赖问题,本地装了个 jar 依赖
retanoj
2023-07-10 09:21:32 +08:00
我猜是因为慢 ;( 可以开 top/htop 看一下进程占用资源情况
Biluesgakki
2023-07-10 09:31:20 +08:00
用啥 maven 源
bqdong
2023-07-10 21:10:06 +08:00
@Biluesgakki 中央仓库或者阿里云都试过,就是那个依赖 taobao-sdk-java-auto 导致的问题,但是不知道为什么

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/955298

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX