Nexus Ivy Maven : Second Level Dependencies Ignore

2019-08-26 10:31发布

问题:

1.) I have a Project1 with this ivy dependency :

<dependency org="xalan" name="serializer" rev="2.7.1" transitive="false" conf="compile->default" />

This project brings serializer.jar (just only this jar, OK! )

2.) In a second one Project (Proyect2) i put the next dependency :

<dependency org="com.net" name="Project1" rev="latest.integration" conf="default->default;compile->compile;runtime->runtime" transitive="true">
</dependency>

This "Project 2" brings :

  1. Project 1
  2. Serializer.jar
  3. xml-apis.jar

    Despite of putting transite to false in xalan dependency.

I haven't this behaviour in my Eclipse + IVEDe environment, just only with Nexus and Maven.... It seems to be wrong because on Project1 i set xalan transitive to false.

回答1:

Try the following dependency in Project 1 and see if that fixes the problem:

<dependency org="xalan" name="serializer" rev="2.7.1" conf="compile->master" />

See the following answer on how Ivy interprets Maven modules and scopes:

  • How are maven scopes mapped to ivy configurations by ivy

I'm not a fan of switching off transitive dependencies. I think it's much better to rely on configuration mappings and if absolutely necessary include an exclude statement to remove an objectionable dependency.