简体   繁体   English

Maven:不要在构建路径上构建指定的jar

[英]Maven: not to build specified jar at build path

I have added these dependency in my pom.xml 我在pom.xml中添加了这些依赖

<dependency>
    <groupId>javax.ws.rs</groupId>
    <artifactId>javax.ws.rs-api</artifactId>
    <version>2.0.1</version>
</dependency>

Seems it adding both jsr311-api (JAX-RS 1.x) and javax.ws.rs-api (JAX-RS 2.x). 似乎同时添加了jsr311-api(JAX-RS 1.x)和javax.ws.rs-api(JAX-RS 2.x)。 These two versions conflict my project deploying on JBoss As 7.1.1. 这两个版本与我在JBoss As 7.1.1上部署的项目冲突。 So I want to tell maven not to build jsr311-api (JAX-RS 1.x) jar file. 所以我想告诉Maven不要建立jsr311-api(JAX-RS 1.x)jar文件。

<dependency>
    <groupId>javax.ws.rs</groupId>
    <artifactId>javax.ws.rs-api</artifactId>
    <version>2.0.1</version>
    <exclusions>
        <exclusion>
            <groupId>javax.ws.rs</groupId>
            <artifactId>jsr311-api</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Seems this is not working. 似乎这不起作用。

I will suggest you check first your project dependency tree using below mvn command 我建议您首先使用下面的mvn命令检查项目依赖关系树

mvn enforcer:enforce mvn执行器:执行

It will useful to find any dependency conflicts in your project then you can resolve any conflicts in project manually. 在项目中查找任何依赖项冲突将很有用,然后您可以手动解决项目中的任何冲突。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM