什么是要避免的maven-JAR的最佳方法? [英] What is the best way to avoid maven-jar?

查看:290
本文介绍了什么是要避免的maven-JAR的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是不同的插件(ant4eclipse)到jar我的文件。什么是避免在执行Maven的Jar插件的最佳方式?

I am using a different plugin (ant4eclipse) to jar my files. What is the best way to avoid the maven-jar plugin from executing?


  • 我试图删除<&插件GT;的maven-JAR-插件< /插件>

  • 我试图<&排除GT; ** / *< /排除>

  • 我试图<&跳过GT;真< /跳过>

  • I tried to remove the <plugin>maven-jar-plugin</plugin>
  • I tried to <exclude> ** / * < / exclude>
  • I tried to <skip>true</skip>

无工作

推荐答案

在Maven的3.0.x的(我试过3.0.2),您可以禁用的maven-JAR-插件默认-JAR 执行绑定到一个不存在的阶段,如<一个href=\"http://stackoverflow.com/questions/2188746/what-is-the-best-way-to-avoid-maven-jar/2189021#2189021\">@bmargulies建议。不幸的是,这并不在2.2.1工作,但你可以用自己的罐子干扰通过设置一个另外的&LT prevent它; finalName&GT; &LT;分类器GT; 默认-JAR 执行;它仍然会创建一个JAR,但它会被设置为项目的辅助神器,不会覆盖你创建的。下面是应该在这两个的Maven 2和Maven 3合作的例子:

In Maven 3.0.x (I tried 3.0.2) you can disable maven-jar-plugin by binding the default-jar execution to a nonexistent phase, as @bmargulies suggested. Unfortunately that doesn't work in 2.2.1, but you can prevent it from interfering with your own jar by setting an alternative <finalName> and <classifier> for the default-jar execution; it will still create a jar, but it will be set as a secondary artifact for the project and won't overwrite the one you've created. Here's an example that should work in both Maven 2 and Maven 3:

<project>
  <modelVersion>4.0.0</modelVersion>

  <groupId>test</groupId>
  <artifactId>test</artifactId>
  <version>0.1-SNAPSHOT</version>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>default-jar</id>
            <phase>never</phase>
            <configuration>
              <finalName>unwanted</finalName>
              <classifier>unwanted</classifier>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

如果您停用的maven-JAR-插件 Maven的安装,插件可能会给你带来太多的麻烦。在Maven的3可以将其禁用一样的maven-JAR-插件:绑定默认安装来一个不存在的相。然而,在Maven的2 Maven的安装,插件要求目标/班目录中,它会安装假罐子当没有主神器present。

Once you've disabled maven-jar-plugin, maven-install-plugin may give you trouble too. In Maven 3 it can be disabled the same as maven-jar-plugin: bind default-install to a nonexistent phase. However, in Maven 2 maven-install-plugin requires that the target/classes directory exist, and it will install the dummy jar when there isn't a primary artifact present.

这篇关于什么是要避免的maven-JAR的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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