views:

217

answers:

4

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

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

None worked

A: 

What happens if you declare this?

<packaging>pom</packaging>

Even if it does what you're looking for, be careful. I'm not sure if there could be negative side effects -- such as other maven projects that depend on your jar not being able to locate it.

Drew Wills
this would require you rebind all the goals, as it'll turn off compilation, testing, etc.
Brett Porter
A: 

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

First, the jar:jar goal is bound by default on the package phase for a project with a packaging of type jar. Second, there is no way to unbind a plugin bound to a phase. So, if you are using another plugin(?), either accept to produce 2 JARs or change the packaging (but I don't think this will work well).

Pascal Thivent
A: 

Explicitly bind the jar plugin to a phase that doesn't exist.

bmargulies
Are you sure? I just tried that and I still see `[INFO] [jar:jar {execution: default-jar}]`.
Pascal Thivent
I've made the source plugin go away this way, but I've never had to get rid of the jar plugin, so I am NOT sure.
bmargulies
+1  A: 

As other's have said, it's not possible to turn it off, other than using <packaging>pom</packaging>, which turns everything off and is probably not what you want.

Even though it will generate twice, a working solution is to bind your jar process to the package phase, as that is guaranteed to run after the default. By overwriting the same JAR file, you'll find that yours is used wherever the original would have been.

Brett Porter