On May 29, 2009, at 9:24 AM, Pfau, Matthias wrote:
Hello,
the java.net-Repositories are a bit special (both contain a
different subset of projects):
* http://download.java.net/maven/2 -> Is a true maven2 repository
* http://download.java.net/maven/1 -> Is a maven1 repository
(directory layout) which also contains maven2 poms. These poms
contain dependency descriptions that should be used, if possible.
One Problem with when using Ivy's IBiblioResolver is that its
creators never thought about this combination (m1 directory
structure/m2 poms). One essential difference between m1 and m2
directory structures is how the organization is mapped to the file
system. Examples:
* m1: "org.gradle" -> One Folder
* m2: "org/gradle" -> Folder with subfolders
That is why you can not make use of the poms in the repository http://download.java.net/maven/1
which requires you to explicitly list all dependencies.
The solution to this problem is rather easy, because of gradle's
design approach.
1. Create your own resolver. Place the following contents in a File
named '$projectDir/buildSrc/src/main/groovy/build/SunResolver.groovy':
package build
import org.apache.ivy.plugins.resolver.IBiblioResolver
import org.apache.ivy.core.module.id.ModuleRevisionId
class SunResolver extends IBiblioResolver {
protected ModuleRevisionId
convertM2IdForResourceSearch(ModuleRevisionId mrid) {
return mrid
}
}
2. Use the Resolver when declaring your repositories:
import build.*
repositories {
mavenRepo urls: 'http://download.java.net/maven/2'
add(new SunResolver()) {
name = 'java.net M1 Repo'
m2compatible = true
setRoot("http://download.java.net/maven/1/")
pattern = "[organisation]/[ext]s/[module]-[revision].[ext]"
}
}
3. Declare your dependencies (e.g. jax-ws)
dependencies {
compile 'com.sun.xml.ws:jaxws-rt:2.1.7'
compile 'com.sun.xml.ws:jaxws-tools:2.1.7'
}
Kind regards,
Matthias
Thanks for sharing this. Your are welcome to add a wiki page to our
wiki for this.
- Hans
--
Hans Dockter
Gradle Project Manager
http://www.gradle.org
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email