如何排除 Maven 插件中的依赖关系? [英] How to exclude dependency in a Maven plugin?

查看:36
本文介绍了如何排除 Maven 插件中的依赖关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目需要以下 Maven jibx 插件:

I have a project that needs the following Maven jibx plugin:

  <build>
    <plugins>
      <plugin>
        <groupId>org.jibx</groupId>
        <artifactId>maven-jibx-plugin</artifactId>
        <version>1.2.2</version>
        ...
      </plugin>
    </plugins>
  </build>

在 jibx 插件 pom 中,有一个 xpp3 依赖项,我想从我的项目构建过程中排除(由于某种原因,我不能将它放在我的私有存储库中).

Inside the jibx plugin pom, there is a xpp3 dependency which I want to exclude from my project build process (due to some reason I cannot have it inside my private repository).

有没有办法配置我的 pom.xml(不是插件 pom)来排除这种依赖关系?

Is there a way to config my pom.xml (not the plugin pom) to exclude that dependency?

编辑:我尝试从插件pom中删除xpp3依赖,项目可以成功构建,所以我知道依赖不是强制性的.

EDIT: I tried to remove the xpp3 dependency from the plugin pom and the project could be built successfully, so I know the dependency is not mandatory.

推荐答案

这里是一个例子,jetty-maven-plugin 对 jtidy 的依赖被替换为新版本:

Here is an example where the jetty-maven-plugin has a dependency on jtidy replaced with a newer version:

http://jira.codehaus.org/browse/JETTY-1339?focusedCommentId=257747&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_257747

    <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <dependencies>
          <dependency>
            <groupId>net.sf.jtidy</groupId>
            <artifactId>jtidy</artifactId>
            <version>r938</version>
          </dependency>
          <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-tools-api</artifactId>
            <version>2.5.1</version>
            <exclusions>
              <exclusion>
                <groupId>jetty</groupId>
                <artifactId>jetty</artifactId>
              </exclusion>
            </exclusions>
          </dependency>
        </dependencies>
[...]
      </plugin>

这篇关于如何排除 Maven 插件中的依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆