代码之家  ›  专栏  ›  技术社区  ›  Gab是好人

maven依赖版本的继承

  •  1
  • Gab是好人  · 技术社区  · 7 年前

    在我的pom中。xml我定义了这样一个依赖项

      <dependencies>
         <dependency>
          <groupId>org.springframework.data</groupId>
          <artifactId>spring-data-jpa</artifactId>
        </dependency>
      </dependencies>
    

    没有明确指定此依赖项的版本。然而,它是有效的,我得到了这个版本 1.8.2.RELEASE .

    我知道这可能是因为继承和 mvn help:effective-pom spring-data-jpa . 但是我检查了父pom,没有找到任何版本号的定义 春季数据jpa .

    其中POM文件 maven选择了 什么时候进入pom继承树?有maven命令吗?

    mvn依赖:树输出如下:

    [INFO] +- org.hibernate:hibernate-envers:jar:4.2.18.Final:provided
    [INFO] +- org.springframework.data:spring-data-jpa:jar:1.8.2.RELEASE:compile
    [INFO] |  +- org.springframework.data:spring-data-commons:jar:1.10.2.RELEASE:compile
    [INFO] |  +- org.springframework:spring-orm:jar:4.0.9.RELEASE:compile
    [INFO] |  |  \- org.springframework:spring-jdbc:jar:4.0.9.RELEASE:compile
    [INFO] |  +- org.springframework:spring-aop:jar:4.1.7.RELEASE:compile
    [INFO] |  |  \- aopalliance:aopalliance:jar:1.0:compile
    [INFO] |  +- org.springframework:spring-tx:jar:4.0.9.RELEASE:compile
    [INFO] |  +- org.aspectj:aspectjrt:jar:1.8.6:compile
    [INFO] |  \- org.slf4j:jcl-over-slf4j:jar:1.7.12:runtime
    [INFO] +- org.springframework.data:spring-data-envers:jar:1.0.8.RELEASE:compile
    [INFO] |  \- joda-time:joda-time:jar:2.8.2:compile
    

    1 回复  |  直到 7 年前
        1
  •  0
  •   Jens    7 年前

    运行: mvn dependency:tree 在命令行上,您将看到树中的所有依赖项,因此您知道依赖项来自何处

    [INFO] [dependency:tree]
    2.[INFO] org.apache.maven.plugins:maven-dependency-plugin:maven-plugin:2.0-alpha-5-SNAPSHOT
    3.[INFO] +- org.apache.maven.reporting:maven-reporting-impl:jar:2.0.4:compile
    4.[INFO] |  \- commons-validator:commons-validator:jar:1.2.0:compile
    5.[INFO] |     \- commons-digester:commons-digester:jar:1.6:compile
    6.[INFO] |        \- (commons-collections:commons-collections:jar:2.1:compile - omitted for conflict with 2.0)
    7.[INFO] \- org.apache.maven.doxia:doxia-site-renderer:jar:1.0-alpha-8:compile
    8.[INFO]    \- org.codehaus.plexus:plexus-velocity:jar:1.1.3:compile
    9.[INFO]       \- commons-collections:commons-collections:jar:2.0:compile
    

    documentation