java - How to subtract ivy dependency sets -
my goal demarcate project transitive dependencies several not crossing sets:
- system (jars present in j2ee container; listed manually explicit fixed versions)
- provided (jars copied j2ee container; listed manually)
- ear (jars packed inside ear/lib, rest)
my current solution listed below has shortcomings:
- have exclude system , provided libraries ear conf 1 one
- new third-party transitive deps weren't explicitly excluded accidentally ear
- sometimes have add explicit
override
duplicating library name , version
is there approach possible eliminate these shortcomings?
it nice able somehow define 1 conf result of dependency sets subtraction of others (with graceful conflict resolution): ear = runtime - system - provided.
maybe <conf name="ear" extends="runtime,!system,!provided"/>
notation supported when ivy-982 gets fixed.
looking actual solution apply.
even willing consider switching gradle if has solution.
<?xml version="1.0" encoding="utf-8"?> <ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="http://ant.apache.org/ivy/schemas/ivy.xsd"> <info organisation="example.com" module="parent"/> <configurations defaultconfmapping="compile->@;runtime->@;system->master;provided->runtime;ear->runtime;test->test(default)"> <conf name="compile"/> <conf name="runtime" extends="compile"/> <conf name="ear" extends="runtime" description="libs packed inside ear"/> <conf name="provided" description="libs copy j2ee container"/> <conf name="system" description="libs present in j2ee container"/> <conf name="test" extends="ear,provided,system" description="simulate container environment. used unit tests catch dependency compatibility problems."/> </configurations> <dependencies> <dependency org="log4j" name="log4j" rev="1.2.15" force="true" conf="system"/> <dependency org="commons-collections" name="commons-collections" rev="3.1" force="true" conf="system"/> <dependency org="commons-lang" name="commons-lang" rev="2.2" force="true" conf="system"/> <dependency org="org.apache.velocity" name="velocity" rev="1.7" force="true" conf="provided"/> <dependency org="org.slf4j" name="slf4j-api" rev="1.5.6" force="true" conf="provided"/> <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.5.6" force="true" conf="provided"/> <!-- ... --> <dependency name="module1" rev="latest.integration" conf="runtime,ear,provided,test"/> <dependency name="module2" rev="latest.integration" conf="runtime,ear,provided,test"/> <!-- ... --> <exclude org="commons-collections" conf="ear,provided"/> <exclude org="commons-lang" conf="ear,provided"/> <exclude org="org.apache.velocity" conf="ear"/> <!-- todo: negation not working: https://issues.apache.org/jira/browse/ivy-982 --> <!--<exclude org="org.slf4j" conf="*, !provided"/>--> <exclude org="org.slf4j" conf="ear,test"/> <!-- ... --> <override org="org.slf4j" rev="1.5.6"/> <override org="commons-collections" module="commons-collections" rev="3.1"/> <override org="commons-lang" module="commons-lang" rev="2.2"/> <!-- ... --> </dependencies> </ivy-module>
sample project sources experiment can found in ivy-1443 attachment.
while provided dependencies exclusion possible maven , gradle, seems there no way achieve ivy.
update
in cases task can worked around intermediate induced module , negative regexp mask:
<dependency org="com.company" name="root.module" conf="ear" rev="latest.integration"> <exclude org="^(?!com.company).*$" matcher="regexp"/> </dependency>
but we've moved gradle ivy seems losing momentum.
Comments
Post a Comment