Don't skip writing <artifact>s to ivy.xml even if there's only one.
Review Request #3388 - Created Jan. 28, 2016 and submitted
|nhoward_tw, patricklaw, zundel|
We ran into a problem internally at Square where ivy would
stubbornly resolve a 'test-jar' instead of a 'jar' artifact, even
when we directly declared a dependency on the 'jar'. The reason for
this appears to be that pants was short-circuiting instead of
writing an explicit artifact for the 'jar'.
This changes:<dependency org="org.apache.hadoop" name="hadoop-common" rev="2.0.0-cdh4.6.0"> <conf name="default" mapped="default"/> <\!-- excludes, etc --> </dependency>
To:<dependency org="org.apache.hadoop" name="hadoop-common" rev="2.0.0-cdh4.6.0"> <conf name="default" mapped="default"/> <artifact name="hadoop-common" type="jar"/> <\!-- excludes, etc --> </dependency>
Which causes ivy to behave as expected.
This fixed our internal problem, and didn't break anything.
Manually confirmed that features like
export --libraries-sourceswhich have been historically fragile and prone to regression still work.
CI passed here: https://travis-ci.org/pantsbuild/pants/builds/105511558
Due to the complexity of the build graph which created this problem (it only arises due to very particular arrangements of our transitive dependencies on artifacts in our internal nexus), I don't have an open-source repro for this, and thus adding an integration test for it is hard. I have fairly high confidence that this is correct though, because it fixed our problem, and didn't break anything.