简体   繁体   English

Maven2插件依赖性

[英]Maven2 plugin dependency

I have a troubles with plugin dependecies. 我在插件依赖方面遇到了麻烦。

I want to use "proguard-maven-plugin", but by default this plugin use proguard 4.3. 我想使用“ proguard-maven-plugin”,但是默认情况下,此插件使用proguard 4.3。 Proguard 4.3 don't support jdk 7. Proguard 4.3不支持jdk 7。

To fix my problem i'm just need to use proguard 4.6+. 要解决我的问题,我只需要使用proguard 4.6+。 Buuut, last version in central repo is 4.4. Buuut,中央仓库中的最新版本是4.4。 I can manualy download proguard 4.6+ from proguard repo, but how i can include it to plugin? 我可以从proguard存储库中手动下载proguard 4.6+,但是如何将其包含在插件中?


I have my own nexus repo, and i put proguard 4.8 there. 我有自己的联系仓库,在那儿放置了proguard 4.8。 How can i load dependecies for "proguard-maven-plugin" from my repo? 如何从我的仓库中加载“ proguard-maven-plugin”的依赖项?

i did as written there: http://www.sonatype.com/people/2008/04/how-to-override-a-plugins-dependency-in-maven/ , but maven looking proguard 4.8 in central repo. 我按照此处的描述进行操作: http : //www.sonatype.com/people/2008/04/how-to-override-a-plugins-dependency-in-maven/ ,但是maven在中央仓库中使用了proguard 4.8。 How can i force maven search in my own repo? 我该如何在自己的仓库中强制进行Maven搜索?

Sorry my terrible English, i hope you understand me. 对不起,我的英语不好,我希望你能理解我的意思。

You have to edit the file .m2/settings.xml in your home folder (and the home folder of every user who runs the Maven job). 您必须在主文件夹(以及运行Maven作业的每个用户的主文件夹)中编辑文件.m2/settings.xml There you have to add your Nexus as a repository as described here . 有你有你的Nexus添加为存储库的描述在这里 Basically the config looks like this: 基本上,配置如下所示:

<settings>
  ...
  <mirrors>
    <mirror>
      <id>mynexus</id>
      <name>My Nexus</name>
      <url>http://mynexusurl</url>
      <mirrorOf>*</mirrorOf>
    </mirror>
  </mirrors>
  ...
</settings>

Additionally you have to configure your Nexus to mirror the central repo. 另外,您必须配置Nexus以镜像中央存储库。

Maybe this will also help, I don't use it, but this is the form of the config for changing a dependency 也许这也有帮助,我不使用它,但这是用于更改依赖项的配置形式

<plugin>
    <artifactId>proguard-maven-plugin</artifactId>
    <version>2.0.4</version>
    <dependencies>
        <dependency>
            <groupId>net.sf.proguard</groupId>
            <artifactId>proguard</artifactId>
            <version>4.6</version>
        </dependency>
    </dependencies>
</plugin>

Also an ant-run example 也是一个蚂蚁运行的例子

<plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.7</version>
    <dependencies>
        <dependency>
            <groupId>ant-contrib</groupId>
            <artifactId>ant-contrib</artifactId>
            <version>1.0b2</version>
            <exclusions>
                <exclusion>
                    <groupId>ant</groupId>
                    <artifactId>ant</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant-nodeps</artifactId>
            <version>1.8.1</version>
        </dependency>
    </dependencies>
</plugin>

Note also! 注意也! for maven2 - issues resolved maven3 http://jira.codehaus.org/browse/MNG-1323 适用于 maven2-已解决的问题maven3 http://jira.codehaus.org/browse/MNG-1323
For multi module reactor builds dependencies for plugin resolved in first use of the plugin. 对于多模块反应堆,在首次使用插件时就解决了插件的依赖关系。 If your dependency isn't being downloaded in reactor build but works fine in single module then you may need to include it in an earlier project - easiest done by adding to pluginManagement of shared parent 如果您的依赖项未在反应堆构建中下载,但在单个模块中运行良好,则您可能需要将其包含在早期项目中-最简单的方法是将其添加到pluginManagement

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

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