-1

我需要为project.version. 对的引用${project.version}将在我的依赖项管理部分中的一个依赖项的 pom 中。换句话说,依赖org.apache.gora:gora-core:0.2.1已经参数化了它的依赖版本。只是我没有设置 gora-core 作为一个简单的依赖project.version项,因此这些间接依赖项都没有包含在我的构建中。

Maven 文档并没有太大帮助。

4

1 回答 1

1

使用 Maven 3.0.4 为我工作

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>a</groupId>
  <artifactId>b</artifactId>
  <version>1-SNAPSHOT</version>
  <dependencies>
    <dependency>
      <groupId>org.apache.gora</groupId>
      <artifactId>gora-core</artifactId>
      <version>0.2.1</version>
    </dependency>
  </dependencies>
</project>

当我问 Maven 的依赖是什么时:

$ mvn dependency:tree
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building b 1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ b ---
[INFO] a:b:jar:1-SNAPSHOT
[INFO] \- org.apache.gora:gora-core:jar:0.2.1:compile
[INFO]    +- org.apache.hadoop:hadoop-core:jar:1.0.1:compile
[INFO]    |  +- commons-cli:commons-cli:jar:1.2:compile
[INFO]    |  +- xmlenc:xmlenc:jar:0.52:compile
[INFO]    |  +- commons-httpclient:commons-httpclient:jar:3.0.1:compile
[INFO]    |  |  +- junit:junit:jar:3.8.1:compile
[INFO]    |  |  \- commons-logging:commons-logging:jar:1.0.3:compile
[INFO]    |  +- commons-codec:commons-codec:jar:1.4:compile
[INFO]    |  +- org.apache.commons:commons-math:jar:2.1:compile
[INFO]    |  +- commons-configuration:commons-configuration:jar:1.6:compile
[INFO]    |  |  +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO]    |  |  +- commons-digester:commons-digester:jar:1.8:compile
[INFO]    |  |  |  \- commons-beanutils:commons-beanutils:jar:1.7.0:compile
[INFO]    |  |  \- commons-beanutils:commons-beanutils-core:jar:1.8.0:compile
[INFO]    |  +- commons-net:commons-net:jar:1.4.1:compile
[INFO]    |  +- org.mortbay.jetty:jetty:jar:6.1.26:compile
[INFO]    |  |  \- org.mortbay.jetty:servlet-api:jar:2.5-20081211:compile
[INFO]    |  +- org.mortbay.jetty:jetty-util:jar:6.1.26:compile
[INFO]    |  +- tomcat:jasper-runtime:jar:5.5.12:compile
[INFO]    |  +- tomcat:jasper-compiler:jar:5.5.12:compile
[INFO]    |  +- org.mortbay.jetty:jsp-api-2.1:jar:6.1.14:compile
[INFO]    |  |  \- org.mortbay.jetty:servlet-api-2.5:jar:6.1.14:compile
[INFO]    |  +- org.mortbay.jetty:jsp-2.1:jar:6.1.14:compile
[INFO]    |  |  \- ant:ant:jar:1.6.5:compile
[INFO]    |  +- commons-el:commons-el:jar:1.0:compile
[INFO]    |  +- net.sf.kosmosfs:kfs:jar:0.3:compile
[INFO]    |  \- oro:oro:jar:2.0.8:compile
[INFO]    +- org.apache.cxf:cxf-rt-frontend-jaxrs:jar:2.5.2:compile
[INFO]    |  +- org.apache.cxf:cxf-common-utilities:jar:2.5.2:compile
[INFO]    |  |  +- org.apache.ws.xmlschema:xmlschema-core:jar:2.0.1:compile
[INFO]    |  |  \- org.codehaus.woodstox:woodstox-core-asl:jar:4.1.1:runtime
[INFO]    |  |     \- org.codehaus.woodstox:stax2-api:jar:3.1.1:runtime
[INFO]    |  +- org.apache.cxf:cxf-api:jar:2.5.2:compile
[INFO]    |  |  +- org.apache.neethi:neethi:jar:3.0.1:compile
[INFO]    |  |  \- wsdl4j:wsdl4j:jar:1.6.2:compile
[INFO]    |  +- org.apache.cxf:cxf-rt-core:jar:2.5.2:compile
[INFO]    |  |  +- com.sun.xml.bind:jaxb-impl:jar:2.1.13:compile
[INFO]    |  |  \- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1:compile
[INFO]    |  +- org.springframework:spring-core:jar:3.0.6.RELEASE:compile
[INFO]    |  |  \- org.springframework:spring-asm:jar:3.0.6.RELEASE:compile
[INFO]    |  +- javax.ws.rs:jsr311-api:jar:1.1.1:compile
[INFO]    |  +- org.apache.cxf:cxf-rt-bindings-xml:jar:2.5.2:compile
[INFO]    |  +- org.apache.cxf:cxf-rt-transports-http:jar:2.5.2:compile
[INFO]    |  |  +- org.apache.cxf:cxf-rt-transports-common:jar:2.5.2:compile
[INFO]    |  |  \- org.springframework:spring-web:jar:3.0.6.RELEASE:compile
[INFO]    |  |     +- aopalliance:aopalliance:jar:1.0:compile
[INFO]    |  |     +- org.springframework:spring-beans:jar:3.0.6.RELEASE:compile
[INFO]    |  |     \- org.springframework:spring-context:jar:3.0.6.RELEASE:compile
[INFO]    |  |        +- org.springframework:spring-aop:jar:3.0.6.RELEASE:compile
[INFO]    |  |        \- org.springframework:spring-expression:jar:3.0.6.RELEASE:compile
[INFO]    |  \- org.codehaus.jettison:jettison:jar:1.3.1:compile
[INFO]    +- org.apache.hadoop:avro:jar:1.3.3:compile
[INFO]    |  +- org.codehaus.jackson:jackson-mapper-asl:jar:1.4.2:compile
[INFO]    |  |  \- org.codehaus.jackson:jackson-core-asl:jar:1.4.2:compile
[INFO]    |  +- org.slf4j:slf4j-api:jar:1.5.11:compile
[INFO]    |  +- com.thoughtworks.paranamer:paranamer:jar:2.2:compile
[INFO]    |  \- com.thoughtworks.paranamer:paranamer-ant:jar:2.2:compile
[INFO]    |     +- com.thoughtworks.paranamer:paranamer-generator:jar:2.2:compile
[INFO]    |     |  +- com.thoughtworks.qdox:qdox:jar:1.10.1:compile
[INFO]    |     |  \- asm:asm:jar:3.2:compile
[INFO]    |     \- org.apache.ant:ant:jar:1.7.1:compile
[INFO]    |        \- org.apache.ant:ant-launcher:jar:1.7.1:compile
[INFO]    +- commons-lang:commons-lang:jar:2.6:compile
[INFO]    \- log4j:log4j:jar:1.2.16:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.301s
[INFO] Finished at: Wed Sep 19 19:10:04 IST 2012
[INFO] Final Memory: 8M/81M
[INFO] ------------------------------------------------------------------------

一切都很好

于 2012-09-19T18:11:25.137 回答