【问题标题】:on the order problems in the classpath with IDEA && Spring Boot && Maven关于 IDEA && Spring Boot && Maven 的类路径中的顺序问题
【发布时间】:2019-09-04 10:17:46
【问题描述】:
/u~u/.rc-ubuntu/.rc-bins/.jdk/bin/java 
    -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:38537,suspend=y,server=n 
    -XX:TieredStopAtLevel=1 
    -noverify 
    -Dspring.output.ansi.enabled=always 
    -Dcom.sun.management.jmxremote 
    -Dcom.sun.management.jmxremote.port=42079 
    -Dcom.sun.management.jmxremote.authenticate=false 
    -Dcom.sun.management.jmxremote.ssl=false 
    -Djava.rmi.server.hostname=localhost 
    -Dspring.liveBeansView.mbeanDomain 
    -Dspring.application.admin.enabled=true 
    -javaagent:/home/zhangle/ileler/bins/ideaj/idea-IU-181.4203.550/lib/rt/debugger-agent.jar=file:/tmp/capture.props 
    -Dfile.encoding=UTF-8 
    -classpath /u~u/.rc-ubuntu/.rc-bins/.jdk/jre/....jar:/u~u/.../target/classes:/repo/a.jar:/repo/b.jar

以上是Spring-Boot项目运行时IDEAJ中的输出命令。 我现在有一个关于类路径顺序的问题。(-classpath /u~u/.rc-ubuntu/.rc-bins/.jdk/jre/....jar:/u~u/.../target/classes:/repo/a.jar:/repo/b.jar)

关于:/repo/a.jar:/repo/b.jar

我的项目使用 ma​​ven 来管理依赖

现在想知道他们两个的顺序是怎么定义的:a.jar && b.jar

因为当两个包有同名的类时,顺序很重要。

我尝试更改 pom.xml 中的顺序。没有效果。

好像和pom.xml中的parent有关,所以想问问具体的答案。

【问题讨论】:

标签: maven spring-boot intellij-idea jetbrains-ide


【解决方案1】:

这最终是由于 ma​​ven 解析 依赖项顺序

自己的依赖(重复,包括依赖)优先于从父继承的依赖。

IDEAJ启动应用或者spring-boot运行应用,它们的classpath顺序取决于maven提供的解析顺序。

【讨论】:

    猜你喜欢
    • 2010-10-22
    • 2012-02-15
    • 2020-05-30
    • 2012-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-13
    相关资源
    最近更新 更多