V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
bqdong
V2EX  ›  问与答

jdk11 使用 maven 编译会卡住

  •  
  •   bqdong · 2023-07-09 18:06:39 +08:00 · 1305 次点击
    这是一个创建于 501 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

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

    第 1 条附言  ·  2023-07-09 19:10:24 +08:00
    重现步骤以及软件版本都在 github 仓库 README 中

    - Maven:


    Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
    Maven home: /home/bqdong/.bin/apache-maven-3.6.3
    Java version: 11.0.0.1, vendor: Oracle Corporation, runtime: /home/bqdong/.bin/jdk-11.0.0.1
    Default locale: en_US, platform encoding: UTF-8
    OS name: "linux", version: "6.2.0-23-generic", arch: "amd64", family: "unix"

    - Java:

    openjdk version "11.0.0.1" 2023-05-09
    OpenJDK Runtime Environment 18.9 (build 11.0.0.1+3-5)
    OpenJDK 64-Bit Server VM 18.9 (build 11.0.0.1+3-5, mixed mode)
    第 2 条附言  ·  2023-07-09 19:19:07 +08:00
    用的是 OpenJDK11 ,下载地址: https://jdk.java.net/java-se-ri/11-MR2
    第 3 条附言  ·  2023-07-09 19:31:57 +08:00
    mvn install:install-file \
    -Dtaobao-sdk-java-auto.jar \
    -DgroupId=com.dingtalk.open \
    -DartifactId=taobao-sdk-java-auto \
    -Dversion=0.0.1 \
    -Dpackaging=jar

    主要是项目中引入了这个依赖:
    <dependency>
    <groupId>com.dingtalk.open</groupId>
    <artifactId>taobao-sdk-java-auto</artifactId>
    <version>0.0.1</version>
    </dependency>

    所以才卡住了,不知道是不是依赖本身有什么问题
    9 条回复    2023-07-10 21:10:06 +08:00
    yyyxxx109876
        1
    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
        2
    hhjswf  
       2023-07-09 18:43:16 +08:00 via Android
    专业点,至少提供一下 maven 版本
    bqdong
        3
    bqdong  
    OP
       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
        4
    bqdong  
    OP
       2023-07-09 19:14:11 +08:00
    @hhjswf 老哥,已经补充上了,github 的 readme 中也有写重现步骤
    mmdsun
        5
    mmdsun  
       2023-07-09 23:33:59 +08:00
    项目很大吗?把 maven 内存设置大点改 JVM 参数。
    bqdong
        6
    bqdong  
    OP
       2023-07-10 09:07:53 +08:00 via Android
    @mmdsun 不大,就 github 里的那个项目,是一个示例。我感觉可能是依赖问题,本地装了个 jar 依赖
    retanoj
        7
    retanoj  
       2023-07-10 09:21:32 +08:00
    我猜是因为慢 ;( 可以开 top/htop 看一下进程占用资源情况
    Biluesgakki
        8
    Biluesgakki  
       2023-07-10 09:31:20 +08:00
    用啥 maven 源
    bqdong
        9
    bqdong  
    OP
       2023-07-10 21:10:06 +08:00
    @Biluesgakki 中央仓库或者阿里云都试过,就是那个依赖 taobao-sdk-java-auto 导致的问题,但是不知道为什么
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5585 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 01:37 · PVG 09:37 · LAX 17:37 · JFK 20:37
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.