为什么排除了maven依赖?

时间:2014-12-07 17:42:46

标签: java maven

执行mvn dependency:tree后,我得到以下输出:

[INFO] stpr:stpr:war:1.0
[INFO] +- org.jboss.spec:jboss-javaee-6.0:pom:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.annotation:jboss-annotations-api_1.1_spec:jar:
1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.resource:jboss-connector-api_1.5_spec:jar:1.0.
0.Final:provided
[INFO] |  +- org.jboss.spec.javax.ejb:jboss-ejb-api_3.1_spec:jar:1.0.0.Final:pro
vided
[INFO] |  |  \- javax.xml:jaxrpc-api:jar:1.1:provided
[INFO] |  +- org.jboss.spec.javax.el:jboss-el-api_2.2_spec:jar:1.0.0.Final:provi
ded
[INFO] |  +- org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.1_spec:ja
r:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.security.jacc:jboss-jacc-api_1.4_spec:jar:1.0.
0.Final:provided
[INFO] |  +- org.jboss.spec.javax.enterprise.deploy:jboss-jad-api_1.2_spec:jar:1
.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.security.auth.message:jboss-jaspi-api_1.0_spec
:jar:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.xml.registry:jboss-jaxr-api_1.0_spec:jar:1.0.0
.Final:provided
[INFO] |  +- org.jboss.spec.javax.jms:jboss-jms-api_1.1_spec:jar:1.0.0.Final:pro
vided
[INFO] |  +- org.jboss.spec.javax.servlet.jsp:jboss-jsp-api_2.2_spec:jar:1.0.0.F
inal:provided
[INFO] |  +- org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:jar:1.0.0.F
inal:provided
[INFO] |  +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar
:1.0.0.Final:provided
[INFO] |  +- org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.2_spec:jar:1.0.0.Fin
al:provided
[INFO] |  +- org.jboss.spec.javax.xml.rpc:jboss-jaxrpc-api_1.1_spec:jar:1.0.0.Fi
nal:provided
[INFO] |  +- org.jboss.spec.javax.xml.soap:jboss-saaj-api_1.3_spec:jar:1.0.0.Fin
al:provided
[INFO] |  +- org.jboss.spec.javax.xml.ws:jboss-jaxws-api_2.2_spec:jar:1.0.0.Fina
l:provided
[INFO] |  +- javax.activation:activation:jar:1.1:provided
[INFO] |  +- javax.enterprise:cdi-api:jar:1.0-SP4:provided
[INFO] |  +- com.sun.faces:jsf-api:jar:2.0.3-b05:provided
[INFO] |  +- javax.inject:javax.inject:jar:1:provided
[INFO] |  +- javax.jws:jsr181-api:jar:1.0-MR1:provided
[INFO] |  +- javax.mail:mail:jar:1.4.2:provided
[INFO] |  +- javax.servlet:jstl:jar:1.2:provided
[INFO] |  +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Fin
al:provided
[INFO] |  +- org.jboss.resteasy:jaxrs-api:jar:2.1.0.GA:provided
[INFO] |  +- stax:stax-api:jar:1.0.1:provided
[INFO] |  \- javax.validation:validation-api:jar:1.0.0.GA:provided
[INFO] \- javax.transaction:javax.transaction-api:jar:1.2-b03:compile

我的问题是javax.transaction-api:jar:1.2-b03:compile被排除在外的原因?我没有明确指定任何排除。怎么了?

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>gr</groupId>
  <artifactId>ar</artifactId>
  <packaging>war</packaging>
  <version>1.0</version>
  <name>nm</name>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.6</maven.compiler.source>
    <maven.compiler.target>1.6</maven.compiler.target>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.jboss.spec</groupId>
      <artifactId>jboss-javaee-6.0</artifactId>
      <version>1.0.0.Final</version>
      <type>pom</type>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.transaction</groupId>
      <artifactId>javax.transaction-api</artifactId>
      <version>1.2-b03</version>
    </dependency>
  </dependencies>
  <profiles>
       <!-- profiles here -->
  </profiles>
</project>

2 个答案:

答案 0 :(得分:1)

也许您需要更新您的maven项目以重新加载依赖项。

答案 1 :(得分:1)

输出未显示依赖项的任何排除。实际上,如果依赖项被排除,它将不会在依赖关系树中显示。通过查看树,依赖关系显示在最后一行:

[INFO] \- javax.transaction:javax.transaction-api:jar:1.2-b03:compile