Exclude Ivy Dependencies in WAR File

2019-07-24 21:26发布

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.

2条回答
乱世女痞
2楼-- · 2019-07-24 22:24

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.

查看更多
男人必须洒脱
3楼-- · 2019-07-24 22:26

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.

查看更多
登录 后发表回答