I am trying to depend on Neo4j server jar and Neo4j server jar - static-web.jar in Ivy. I am trying something like
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="org.jimwebber" module="neo4j-koans"/>
<dependencies>
<dependency org="org.springframework.data" name="spring-data-neo4j" rev="1.0.0.RELEASE">
<exclude module="jms"/>
<exclude module="jmxtools"/>
<exclude module="jmxri"/>
<exclude org="org.slf4j" name="slf4j-log4j12"/>
</dependency>
<dependency org="org.aspectj" name="aspectjrt" rev="1.6.11.RELEASE"/>
<dependency org="org.aspectj" name="aspectjtools" rev="1.6.11.RELEASE"/>
<dependency org="org.neo4j.app" name="neo4j-server" rev="1.5-SNAPSHOT" m:classifier="static-web"/>
<dependency org="org.neo4j.app" name="neo4j-server" rev="1.5-SNAPSHOT"/>
<dependency org="org.neo4j" name="neo4j-community" rev="1.5-SNAPSHOT"/>
<dependency org="org.neo4j" name="neo4j-shell" rev="1.5-SNAPSHOT"/>
<dependency org="org.codehaus.jackson" name="jackson-core-asl" rev="1.7.5"/>
<dependency org="org.codehaus.jackson" name="jackson-mapper-asl" rev="1.7.5"/>
<dependency org="com.sun.jersey" name="jersey-client" rev="1.3"/>
<dependency org="org.mockito" name="mockito-all" rev="1.8.5"/>
<dependency org="junit" name="junit" rev="4.7"/>
</dependencies>
</ivy-module>
But I never get the "staic-web".jar down, and now error either. Anyone knows how to do this?
Thanks for any hints!
/peter
This is how you retrieve more than one artifact associated with a Maven module:
<dependency org="org.neo4j.app" name="neo4j-server" rev="1.5-SNAPSHOT">
<artifact name="neo4j-server" type="jar" />
<artifact name="neo4j-server" type="jar" m:classifier="static-web"/>
</dependency>
The syntax is odd because of the way Maven references additional artifacts using classifiers.
The neo4j snapshot repository needs to be added into your ivysettings.xml file (snapshot releases are not published to Maven Central)
<ivysettings>
<settings defaultResolver="chain"/>
<resolvers>
<chain name="chain">
<ibiblio name="central" m2compatible="true"/>
<ibiblio name="neo4j-snapshot" m2compatible="true" root="http://repo.neo4j.org/content/repositories/snapshots"/>
</chain>
</resolvers>
</ivysettings>
Other issues
Version corrections
<dependency org="org.aspectj" name="aspectjrt" rev="1.6.11"/>
<dependency org="org.aspectj" name="aspectjtools" rev="1.6.11"/>
Broken repository POM
The problem with using snapshot repos is sometimes the POMs are broken. Ivy is unable to process the following file:
This prevents ivy from downloading the neo4j-server arifacts....
[ivy:retrieve] :::: WARNINGS
[ivy:retrieve] io problem while parsing ivy file: http://repo.neo4j.org/content/repositories/snapshots/org/neo4j/app/neo4j-server/1.5-SNAPSHOT/neo4j-server-1.5-SNAPSHOT.pom: Impossible to load parent for file:/home/mark/.ivy2/cache/org.neo4j.app/neo4j-server/ivy-1.5-SNAPSHOT.xml.original. Parent=org.neo4j.build#parent-pom;25
[ivy:retrieve] module not found: org.neo4j.app#neo4j-server;1.5-SNAPSHOT
..
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] :: UNRESOLVED DEPENDENCIES ::
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] :: org.neo4j.app#neo4j-server;1.5-SNAPSHOT: not found
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
Work-around
In the settings file configure ivy to retrieve the artifacts directly using the url resolver. The ibiblio resolver is used for all other modules whose POMs are valid.
<ivysettings>
<settings defaultResolver="chain"/>
<resolvers>
<chain name="chain">
<ibiblio name="central" m2compatible="true"/>
<ibiblio name="neo4j-snapshot" m2compatible="true" root="http://repo.neo4j.org/content/repositories/snapshots"/>
</chain>
<url name="neo4j-snapshot-hack">
<artifact pattern="http://repo.neo4j.org/content/repositories/snapshots/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
</url>
</resolvers>
<modules>
<module organisation="org.neo4j.app" name="neo4j-server" resolver="neo4j-snapshot-hack"/>
</modules>
</ivysettings>
This will mean transitive dependencies in the by-passed POM file might be skipped. Can't be helped if the POM is not working properly
来源:https://stackoverflow.com/questions/7804253/how-to-dowload-multiple-maven-dependencies-in-ivy-with-different-classifiers