当包含带有maven的jar时,2个缺少依赖项

时间:2014-12-07 23:33:18

标签: java eclipse maven jar

我正在开发一个网络应用程序,为了最大限度地减少其 pom.xml 中的依赖项数量,我创建了一个包含所有必需依赖项的jar。

但是在我的web项目中添加这个jar依赖项时,似乎jar上的2个现有依赖项没有包含在我的web-app中。

我的网络应用的pom.xml:

<!-- rest-easy-api -->
<dependency>
    <groupId>rest-easy-api</groupId> 
    <artifactId>rest-easy-api</artifactId>
    <version>1.0</version>
    <scope>provided</scope>
</dependency>

2个缺少的依赖项(包含在我的jar中):

<!-- EclipseLink's JPA capabilities for relational databases. -->
<dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>eclipselink</artifactId>
    <version>2.5.2</version>
    <scope>provided</scope> 

    <exclusions>
        <exclusion>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>commonj.sdo</artifactId>
        </exclusion>
    </exclusions>
</dependency> 

<!-- JPA 2.1 -->
<dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>javax.persistence</artifactId>
    <version>2.1.0</version>
    <scope>provided</scope>
</dependency>

就像本地存储库没有更新..我确实清理了两个项目,删除它们 - 重新导入它们。它仍然无效..

你们是否知道这可能是什么原因?

谢谢,

2 个答案:

答案 0 :(得分:1)

删除

<scope>provided</scope> 

告诉maven,依赖项将由运行时环境提供,因此它不会被提取到此构建中,而只会在编译时使用。

答案 1 :(得分:0)

您是否尝试删除提供的范围,只是为了将它们重新导入您的本地仓库?

相关问题