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

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

问题描述

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

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

在jibx插件pom中,有一个xpp3依赖关系,我想从我的项目构建过程中排除(由于某些原因我无法在我的私人存储库中)。



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



编辑:我试图从插件pom中删除xpp3依赖项,并且项目可以成功构建,所以我知道依赖不是

解决方案

下面是一个示例,其中jetty-maven-plugin依赖于jtidy替换为较新版本: / p>

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

 < plugin> 
< groupId> org.mortbay.jetty< / groupId>
< artifactId> jetty-maven-plugin< / artifactId>
<依赖关系>
<依赖关系>
< groupId> net.sf.jtidy< / groupId>
< artifactId> jtidy< / artifactId>
< version> r938< / version>
< / dependency>
<依赖关系>
< groupId> org.apache.maven.plugin-tools< / groupId>
< artifactId> maven-plugin-tools-api< / artifactId>
< version> 2.5.1< / version>
<排除>
< exclude>
< groupId> jetty< / groupId>
< artifactId> jetty< / artifactId>
< / exclusion>
< / exclusions>
< / dependency>
< / dependencies>
[...]
< / plugin>


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>

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).

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

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.

解决方案

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天全站免登陆