Ivy's transitive="false" gets simply ignored when downloading from Nexus - java

At our company, we are migrating our old ivy repository to Nexus.
After uploading our own artifacts to Nexus, I tried downloading a few projects' dependencies to test the setup, but I'm failing with spring-web. Let me explain how.
Here is the ivy-settings.xml file pointing only to our local Nexus installation
<?xml version="1.0" encoding="ISO-8859-1"?>
<ivysettings>
<settings defaultResolver="default" />
<resolvers>
<ibiblio name="nexus" m2compatible="true" root="http://nexus.local/nexus/content/repositories/central/" />
<ibiblio name="our-nexus" m2compatible="true" root="http://nexus/nexus/content/repositories/repo" />
<chain name="default" returnFirst="true">
<resolver ref="our-nexus" />
<resolver ref="nexus" />
</chain>
</resolvers>
</ivysettings>
In one of our projects we use Spring Web, but not all of its dependencies, so I declared
<dependency org="org.springframework" name="spring-web" rev="3.0.5.RELEASE" transitive="false" />
This worked fine when using Ivy repository. However today I can't perform an <ivy:retrieve> task because it can't find com.caucho#hessian#3.2.1
<ivy:report> task says that such version of hessian is required by spring-web 3.2.11.RELEASE
But I have declared transitive="false"!!!
Why isn't it working? What am I missing/messing?

Should work. Personally I prefer configuration mappings. Try the following instead:
<dependency org="org.springframework" name="spring-web" rev="3.0.5.RELEASE" conf="default->master" />
For more details see:
How can I include the Ivy dependency and none of its dependencies?

Related

com.ibm.websphere#uow;6.0.2.17: not found

I am new to Ivy and am a chronic ant user, so repositories are still sort of new to me.
I have a Spring 4 project and I'm attempting to build my data access stuff using Hibernate. I have the following ivy.mxl file being imported into my build.
<ivy-module version="2.0">
<info organisation="apache" module="data"/>
<dependencies>
<dependency org="org.eclipse.persistence" name="org.eclipse.persistence.core" rev="2.5.2-M1" />
<dependency org="org.eclipse.persistence" name="org.eclipse.persistence.jpa" rev="2.5.2-M1" />
<dependency org="com.ibm.websphere" name="com.springsource.com.ibm.websphere.uow" rev="6.0.2.17" />
<dependency org="org.springframework" name="spring-beans" rev="4.0.3.RELEASE" />
<dependency org="org.springframework" name="spring-context" rev="4.0.3.RELEASE" />
<dependency org="org.springframework" name="spring-orm" rev="4.0.3.RELEASE" />
<dependency org="org.springframework" name="spring-tx" rev="4.0.3.RELEASE" />
</dependencies>
</ivy-module>
I added the uow line as a result of this problem. When I build, I get the following message:
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] :: UNRESOLVED DEPENDENCIES ::
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] :: com.ibm.websphere#uow;6.0.2.17: not found
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
I google for this error and found nothing.
I found the library here: http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.com.ibm.websphere.uow&version=6.0.2.17 and added the following to my ivysettings.xml file as a result of the FAQ from this link:
<url name="com.springsource.repository.bundles.release">
<ivy pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
<artifact pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<url name="com.springsource.repository.bundles.external">
<ivy pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
<artifact pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
And then added to my chain:
<resolver ref="com.springsource.repository.bundles.release"/>
<resolver ref="com.springsource.repository.bundles.external"/>
None of this has made any impact to my error. Any ideas?
Based on what I found here: Find hidden dependencies in Ivy I added transitive="false" to my dependency and it quit bringing it in.
Using this dependency statement I was able to resolve the problem.
<dependency org="org.springframework" name="spring-tx" rev="3.2.9.RELEASE"
transitive="false" conf="compile->default;runtime->default;"/>
It is located in the Redhat GA repo.
I added the repo to the resolvers in ivysettings.xml.
<resolvers>
<chain name="chained" returnFirst="true">
<ibiblio name="redhat" root="https://maven.repository.redhat.com/ga/" m2compatible="true"/>
</chain>
</resolvers>
I use the search facilities at http://mvnrepository.com/ . This lists where a library/artefact can be found.

ivy cannot resolve org.springframework dependencies

I want to use the Ivy Eclipse plugin to reolve the spring-oxm dependency.
<dependency org="org.springframework" name="spring-oxm" rev="3.2.2.RELEASE" />
But I got below error:
Some projects fail to be resolved Impossible to resolve dependencies
of my class name unresolved dependency:
org.restlet.jee#org.restlet;2.1.1: not found unresolved dependency:
org.restlet.jee#org.restlet.ext.servlet;2.1.1: not found
I googled, and people say the restlet-2.1.1 no longer exist. And I have no idea how to solve this problem.
Its available in this repo http://maven.restlet.org/org/restlet/jee/org.restlet/2.1.1/
Probably you need to add this repository in your Ivy settings or any repository you are using.
Well, i just now had same problem with my Solr 5.5.0 with changing repository for IVY. But that's all waste of time.
Just download org.restlet.ext.servlet jar file from http://maven.restlet.com/org/restlet/jee/org.restlet.ext.servlet/2.1.1/, create folder repository near ivy-settings.xml, copy downloaded file and change ivy-settings.xml like :
<ivysettings>
<settings defaultResolver="chain-example"/>
<resolvers>
<chain name="chain-example">
<ibiblio name="central" m2compatible="true" />
<filesystem name="libraries">
<artifact pattern="${ivy.settings.dir}/repository/[artifact]-[revision].[ext]" />
</filesystem>
</chain>
</resolvers>
</ivysettings>
Enjoy.

Selenium remote webdriver error when running a build with ant/ivy

Here is my error message, I'll explain below.
<error message="Mouse is not implemented yet for the remote WebDriver." type="java.lang.UnsupportedOperationException">java.lang.UnsupportedOperationException: Mouse is not implemented yet for the remote WebDriver
The problem is when I run my selenium automation scripts using ant/ivy I get that error. This code runs fine on it's own, but i'm trying to use ant/ivy to get it built so I can run it on jenkins. It does build ok, I get this problem when running the build suite.
I have the following selenium packages being pulled from the central repository
<dependency org="org.seleniumhq.selenium" name="selenium-server" rev="2.5.0"/>
<dependency org="org.seleniumhq.selenium" name="selenium-java" rev="2.5.0"/>
<dependency org="org.seleniumhq.selenium" name="selenium-firefox-driver" rev="2.5.0"/>
<dependency org="org.seleniumhq.selenium" name="selenium-api" rev="2.5.0"/>
<dependency org="org.seleniumhq.selenium" name="selenium-remote-client" rev="2.0b1"/>
<dependency org="org.seleniumhq.selenium" name="selenium-remote-driver" rev="2.5.0" >
<artifact name="selenium-remote-driver" type="jar" />
</dependency>
<dependency org="org.seleniumhq.webdriver" name="webdriver-common" rev="0.9.7376" >
<artifact name="webdriver-common" type="jar" />
</dependency>
<dependency org="org.seleniumhq.webdriver" name="webdriver-remote-client" rev="0.9.7376" >
<artifact name="webdriver-remote-client" type="jar" />
</dependency>
<dependency org="org.seleniumhq.webdriver" name="webdriver-remote-server" rev="0.9.7376" >
<artifact name="webdriver-remote-server" type="jar" />
</dependency>
<dependency org="org.seleniumhq.webdriver" name="webdriver-remote-common" rev="0.9.7376" >
<artifact name="webdriver-remote-common" type="jar" />
I wasn't able to find a place in the central repository to pull down the selenium-server-standalone.jar so I don't have that. Is there a package that might work better or a workaround for this issues?
Please let me know if my question is not clear enough, I'm new to ant/ivy.
Is it possible that you are hitting this issue? It seems like you are using an older version (2.5.0) of most of those Selenium packages. According to Maven Central those packages are all at version 2.19.0 now. Maybe updating to the most recent ones may fix the problem.

Ivy appears to fetch javadoc jars only

I'm using Ivy on my project, with the Ivy Eclipse plugin.
It appears that certain jars which are downloaded and added to my project are the javadoc jars, not the jars with the actual code. Note - this doesn't happen with all jars.
For example, adding this to my ivy.xml file:
<dependency org="junit" name="junit" rev="4.8.2"/>
caused the javadocs for junit to be downloaded and added to my classpath:
This breaks compilation for my project, as none of the unit tests are working.
This was working fine until I added a reference to Spring, and everything broke. I've tried removing the reference, and deleting junit from my local cache to force ivy to fetch it again, but the problem persists.
Here's my total dependency block (with spring removed):
<dependencies>
<dependency org="org.hamcrest" name="hamcrest-library" rev="1.3.RC2"/>
<dependency org="junit" name="junit" rev="4.8.2"/>
<dependency org="org.mockito" name="mockito-core" rev="1.8.5"/>
<dependency org="javax.persistence" name="persistence-api" rev="1.0"/>
</dependencies>
Here's my ivysettings.xml for the project:
<ivysettings>
<caches artifactPattern="[organisation]/[module]/[revision]/[artifact].[ext]" />
<settings defaultResolver="local.ibiblio.jboss.java-net.springsource" checkUpToDate="true" />
<resolvers>
<chain name="local.ibiblio.jboss.java-net.springsource">
<filesystem name="libraries">
<artifact pattern="${basedir}/ivy-repo/[artifact]-[revision].[type]" />
</filesystem>
<ibiblio name="ibiblio" m2compatible="true" />
<ibiblio name="jboss" m2compatible="true"
root="https://repository.jboss.org/nexus/content/groups/public-jboss" />
<ibiblio name="java.net" m2compatible="true"
root="https://repository.jboss.org/nexus/content/repositories/java.net-m2/" />
<ibiblio name="java.net" m2compatible="true"
root="http://repository.codehaus.org/" />
<url name="com.springsource.repository.libraries.release">
<ivy pattern="http://repository.springsource.com/ivy/libraries/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
<artifact pattern="http://repository.springsource.com/ivy/libraries/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<url name="com.springsource.repository.libraries.external">
<ivy pattern="http://repository.springsource.com/ivy/libraries/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
<artifact pattern="http://repository.springsource.com/ivy/libraries/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<url name="com.springsource.repository.bundles.release">
<ivy pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
<artifact pattern="http://repository.springsource.com/ivy/bundles/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<url name="com.springsource.repository.bundles.external">
<ivy pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
<artifact pattern="http://repository.springsource.com/ivy/bundles/external/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
</chain>
</resolvers>
</ivysettings>
Some open source modules include optional java doc jars. To remove them add a configuration mapping to each of your dependencies:
<dependency org="junit" name="junit" rev="4.8.2" conf="default"/>
The default configuration in ivy is equivalent to the the compile scope in a maven module. This is how the optional libraries can be automatically omitted. (Check their POMs).
A better approach is to declare your own configurations and the default mapping as follows:
<configurations defaultconfmapping="compile->default">
<conf name="compile" description="Required to compile code"/>
<conf name="test" description="Additional test dependencies" extends="compile" />
</configurations>
Then in your ivy file you only need to declare the non-standard configurations:
<dependencies>
<dependency org="org.hamcrest" name="hamcrest-library" rev="1.3.RC2" conf="test->default"/>
<dependency org="junit" name="junit" rev="4.8.2" conf="test->default"/>
<dependency org="org.mockito" name="mockito-core" rev="1.8.5" conf="test->default"/>
<dependency org="javax.persistence" name="persistence-api" rev="1.0"/>
</dependencies>
In this case we only want the 3 test libraries to appear on the test configuration.
Still confused? The magic of ivy configurations is when you use them to manage your build's class path
<target name='dependencies' description='Resolve project dependencies and set classpaths'>
<ivy:resolve/>
<ivy:cachepath pathid="compile.path" conf="compile"/>
<ivy:cachepath pathid="test.path" conf="test"/>
</target>
This is what Maven is doing when you declare a scope tag on a dependency, for example:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
The scopes in Maven are fixed. In ivy you can have as many as you need.

How to use Apache ivy to resolve dependency with multiple files?

Here is my ivy.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0">
...
<dependencies>
<dependency org="spring" name="richclient" rev="1.1.0"/>
</dependencies>
</ivy-module>
And ivy-settings.xml:
<property name="ivy.local.default.root" value="/home/---/dev/Java/_libraries/_ivy" override="false"/>
<property name="ivy.local.default.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="false"/>
<property name="ivy.local.default.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="false"/>
<resolvers>
<filesystem name="local">
<ivy pattern="${ivy.local.default.root}/${ivy.local.default.ivy.pattern}" />
<artifact pattern="${ivy.local.default.root}/${ivy.local.default.artifact.pattern}" />
</filesystem>
</resolvers>
Ivy try to find
/home/---/dev/Java/_libraries/_ivy/spring/richclient/1.1.0/jars/richclient.jar
And here is the problem. Library has 4 jar files.
How to include all jars in project from one dependency in ivy.xml?
Thx
I'm assuming you've just downloaded the jars locally? It won't work unless you also write an ivy.xml file for the downloaded files, listing the artifacts that are associated with the module (See publications section of the ivy.xml doco)
Why not avoid the hassle of maintaining the your own version of someone else's module by using the maven repository provided by Spring?
Add the following to your ivy-settings.xml file:
<resolvers>
<ibiblio name="spring-rcp" m2compatible="true" root="http://spring-rich-c.sourceforge.net/maven2repository"/>
</resolvers>
While Ivy can work using dependencies on individual JAR files, it works better if you define separate ivy.xml files for the dependencies themselves, which specifies the 4 separate JAR files. This ivy.xml defines what Ivy calls a module.
Your application's ivy.xml then expresses a dependency on that module, rather than on specific JAR files.
The Ivy website has a tutorial on modules, I highly recommend reading it
http://ant.apache.org/ivy/history/latest-milestone/tutorial/conf.html

Categories

Resources