ivy cannot resolve org.springframework dependencies - java

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.

Related

using ivy:publish task to publish to the public Maven repo - need credentials?

I am trying to use the ivy:publish task to publish my jars using the public ibiblio resolver which I understand corresponds to the Maven central repository.
It seems to sort of work, but I am eventually getting an HTTP 405: Method Not Allowed.
The relevant sections from my ivysettings.xml, ivy.xml and build.xml files are:
ivysettings.xml
This is actually the entire file:
<ivysettings>
<settings defaultResolver="public"/>
<resolvers>
<ibiblio name="public" m2compatible="true" />
</resolvers>
</ivysettings>
ivy.xml
...
<publications>
<artifact type="pom" ext="pom" conf="default"/>
<artifact type="jar" ext="jar" conf="default"/>
</publications>
...
build.xml
...
<target name="gen-pom" depends="ivy-resolve">
<ivy:makepom ivyfile="ivy.xml" pomfile="${dist.dir}/${ant.project.name}.pom">
<mapping conf="default" scope="compile"/>
</ivy:makepom>
</target>
<target name="ivy-publish" depends="jar, gen-pom" description="publish jar/source to maven repo">
<ivy:publish resolver="public" forcedeliver="true" overwrite="true" publishivy="false">
<artifacts pattern="${dist.dir}/[artifact].[ext]" />
</ivy:publish>
</target>
...
When I invoke ant ivy-publish I get:
impossible to publish artifacts for mant-tasks#mant-tasks;1.0: java.io.IOException: PUT operation to URL https://repo1.maven.org/maven2/mant-tasks/mant-tasks/1.0/mant-tasks-1.0.pom failed with status code 405: Method Not Allowed
I guess this makes sense otherwise anybody would be able to pollute the namespace. So my questions are:
is this due to my lack of credentials? I.e. would I need to add a
credentials element in my ivysettings.xml as shown in this
answer?
can I obtain credentials for ibiblio for my
insignificant module and if not what other freely available public
repositories are available to a Java developer who doesn't want to
build and maintain their own maven repository? I need to be able to pull-in my module (as an IVY dependency of other projects) from a globally available repository.
Maven central is operated by Sonatype, the creators of Maven:
http://central.sonatype.org/
JFrog operate a competing service called bintray:
https://bintray.com/
I suggest reading the documentation and obtain a credential that will allow to publish your module's file(s)

IvyDE unable to resolve Mule dependencies

I am working with Apache Ivy to manage transitive dependencies.
Working with Maven was quite a good experience because if there was any dependency that was not available at a remote directory or available with a different version, then Maven would manage those effectively.
However, Ivy gets stuck with this in my case as I am trying to manage Mule dependencies but it is being difficult for Ivy to manage while Maven manages it well without any problems.
One more important point is that I cannot even exclude any dependency because I don't want to exclude but I want Ivy to be capable enough so that it can manage it all or any other way if any.
Below is a screenshot of the error along with the necessary XML files.
ivy.xml
<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="MyOrganization"
module="TestForIvySupport"
status="integration">
</info>
<dependencies>
<dependency org="org.mule" name="mule-core" rev="3.6.0"/>
</dependencies>
ivysettings.xml
<settings defaultResolver="chained"/>
<resolvers>
<chain name="chained">
<url name="custom-repo">
<ivy pattern="https://repository.mulesoft.org/nexus/content/groups/public/org/[organisation]/[module]/[revision]/ivy-[revision].xml"/>
<artifact pattern="https://repository.mulesoft.org/nexus/content/groups/public/org/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>
</url>
<ibiblio name="ibiblio" m2compatible="true" root="http://mirrors.ibiblio.org/maven2/"/>
<ibiblio name="ibiblio1" m2compatible="true" root="http://repo1.maven.org/maven2/"/>
</chain>
</resolvers>
build.xml
<project name="test ivy" default="test" xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="test" description="Test ivy installation">
<ivy:settings file="ivysettings.xml"/>
<ivy:retrieve sync="false" pattern="myfolder/[artifact]-[revision].[ext]"/>
</target>
Using your example I had a different error:
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] :: UNRESOLVED DEPENDENCIES ::
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] :: org.mule.mvel#mule-mvel2;2.1.9-MULE-005: not found
[ivy:resolve] :: org.mule.common#mule-common;3.6.0: not found
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
I eventually got it working but discovered a broken POM.
Working Example
ivy.xml
<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="MyOrganization"
module="TestForIvySupport"
status="integration">
</info>
<dependencies>
<!-- Exclude the broken dependency -->
<dependency org="org.mule" name="mule-core" rev="3.6.0" conf="default">
<exclude org="com.github.stephenc.eaio-grabbag" module="grabbag"/>
</dependency>
<!-- Just pull down the jar artifact associated with the module -->
<dependency org="com.github.stephenc.eaio-grabbag" name="grabbag" rev="1.8.1" conf="default">
<artifact name="grabbag" type="jar"/>
</dependency>
</dependencies>
</ivy-module>
Notes:
The POM associated with the grabbag dependency is broken.
Work-around tells ivy to ignore the POM and then we explicitly pull down the jar file as a second dependency declaration.
ivysettings.xml
<ivysettings>
<settings defaultResolver="chained"/>
<resolvers>
<chain name="chained" returnFirst="true">
<ibiblio name="central" m2compatible="true"/>
<ibiblio name="mulesoft" m2compatible="true" root="https://repository.mulesoft.org/nexus/content/groups/public"/>
</chain>
</resolvers>
</ivysettings>
Notes:
Simplified the settings file to use ibiblio resources to talk to just two Maven repositories: Maven Central and the Mulesoft repository
Error analysis
Analysis of first error
I tracked this down to a problem with the parent pom of the "mule-core" module.
http://search.maven.org/#artifactdetails|org.mule|mule|3.6.0|pom
There is an override dependency where the property refers to a version of "mule-mvel2" module that doesn't exist in Maven Central
<properties>
..
<muleMvelVersion>2.1.9-MULE-005</muleMvelVersion>
..
</properties>
<dependency>
<groupId>org.mule.mvel</groupId>
<artifactId>mule-mvel2</artifactId>
<version>${muleMvelVersion}</version>
</dependency>
Managed to fix this by adding the following Mulesoft repository.
https://repository.mulesoft.org/nexus
Analysis of second error
Trouble shooting this further I discovered a second cascaded error:
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] :: FAILED DOWNLOADS ::
[ivy:resolve] :: ^ see resolution messages for details ^ ::
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve] :: com.github.stephenc.eaio-grabbag#grabbag;1.8.1!grabbag.non-maven-jar
[ivy:resolve] ::::::::::::::::::::::::::::::::::::::::::::::
This problem is more serious as it's caused by a misconfigured POM file:
http://search.maven.org/#artifactdetails|com.github.stephenc.eaio-grabbag|grabbag|1.8.1|pom
Where the packaging has been changed from the "jar" default
<packaging>non-maven-jar</packaging>
The ivy work-around for is to exclude this broken transitive dependency and then explicitly pull down the jar artifact as a second dependency in the ivy file.
I have raised a github issue with the the project.

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

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?

ivysettings.xml: add local maven path

How to add a local path (not URL) to ivysettings.xml? I need to add my Maven local repository (/Users/me/.m2/repository to it.
Thanks
Try the following ivysettings.xml file:
<ivysettings>
<settings defaultResolver="default"/>
<property name="m2-pattern" value="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]" override="false" />
<resolvers>
<chain name="default">
<filesystem name="local-maven2" m2compatible="true" >
<artifact pattern="${m2-pattern}"/>
<ivy pattern="${m2-pattern}"/>
</filesystem>
<ibiblio name="central" m2compatible="true"/>
</chain>
</resolvers>
</ivysettings>
It includes Maven central in case the dependency is missing from the local Maven repo.
Note:
The benefits of re-using a local Maven repository are limited. Ivy caches jars retrieved from repostories.
Ivy dependencies are resolved with "Resolvers".
This page is pretty good for understanding the basics of how they work.
http://ant.apache.org/ivy/history/latest-milestone/settings/resolvers.html
Specifically : How can I "resolve" a local maven repository ?
Ivy has a "FileSystemResolver" which, rather than taking in a web address, can simply resolve from a local, root path. Note that there are some gotchas when things get complicated, like this one : http://ant.apache.org/ivy/history/latest-milestone/settings/resolvers.html . Resolvers are similar to maven Repository tags, in that they define a resource.
A quick word of advice
Remember that once you customize ivysettings.xml if you are using an IDE, you will have to tell it to specifically use YOUR ivysettings.xml file, rather than some internal default.
I found out that in the more recent versions of sbt you can do
sbt publish-m2
Prior to 0.13.7, SBT ignored the Maven's settings.xml to use the <localRepository> setting. See https://github.com/sbt/sbt/issues/1589. In some cases, this will obviate the need to change ivysettings.xml when using publish-m2.

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