0
votes

i'm facing an issue while deploying my app on tomcat container which already contains servlet-api and my app also depends on servlet-api due to different they clash.

Is it possible define ivy for my app to include servlet-api only during compilation not for runtime.

How to do that.

dependency org="java" name="servlet-api" rev="default" conf="compile"

passing conf as compile fails ivy validation.

1
it would be helpful to include the ivy.xml file. you'll want to define that configuration. - thekbb

1 Answers

3
votes

Sounds like a dependency functionally similar to the Maven "provided" scope.

My advice is to create an extra confguration and mapping for example:

<configurations>
  <conf name="compile" description="Compile dependencies"/>
  <conf name="runtime" description="Runtime dependencies" extends="compile"/>
  <conf name="provided" description="Provided dependencies"/>
</configurations>

<dependencies>
  <dependency .. conf="compile->default"/>
  <dependency .. conf="runtime->default"/>
  <dependency .. conf="provided->default"/>
</dependencies>

Within your build file the classpath used for compilation can include the extra depenencies as follows:

<ivy:cachepath pathid="compile.path" conf="compile,provided"/>