1

I use Eclipse and the Ivy plugin IvyDE.

I currently create a WAR file by using Eclipse's export to WAR functionality. I don't use an ANT build file - I let Eclipse handle that.

When I export to war, all the dependencies in the ivy.xml file get copied to the war file's bin directory. I want to exclude one (or more) of them. How do I do that?

What't the simplest way to accomplish this? If possible, I would like to avoid creating my own ANT build files and continue to use Eclipse's export tool and the IvyDE plugin.

stepanian
  • 11,373
  • 8
  • 43
  • 63
  • Ivy is primarily designed to work as an ANT plugin. I don't use Eclipse so assume that ivy is used to populate it's classpath, obviously pulling in all jars regardless of configuration. This logic would work fine to support Eclipse compiles, but certainly breaks down under your use-case. Perhaps someone with more knowledge of the Eclipse plug-in could comment? – Mark O'Connor Apr 22 '14 at 08:17
  • I would reconsider not using a Java build tool. If you share your code you're forcing others to build it using Eclipse. A second consideration is CI. Getting Jenkins to run an Eclipse build would be painful. If you don't like ANT (many people do not) there are other options like Maven or Gradle. Just a suggestion, don't mean to start a flame war :-) – Mark O'Connor Apr 22 '14 at 08:22
  • Thanks. What you say makes sense. Let me wait and see if anyone can suggest a quick method to do what I need just using Eclipse and IvyDE before I make major changes to the way I build and deploy code. That way, I would have more time to consider the alternatives you mentioned. – stepanian Apr 22 '14 at 22:42

2 Answers2

1

For me the following did the trick:

  • copy the ivy.xml to e.g. ivy-nodeploy.xml
  • create/select the configurations you want to include in the deployment assembly in ivy.xml
  • create/select the configurations you don't want to include in the deployment assembly in ivy-nodeploy.xml
  • add a new ivy-library to the build path where you change the default ivy-filename to ivy-nodeploy.xml

That way you still have all ivy managed libraries at compile time in your build path but only libraries configured in ivy.xml get included in the war file.

1

Right click on your project's ivy.xml, and choose "Add ivy library".

In the main tab are customization settings for the build configs, and it looks as though you can choose the conf you desire (i.e. set it to runtime). I war using Ant, so I've never tried it. I presume this will accomplish what you desire.

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Letifer
  • 9
  • 2