On 5/04/10 11:02 PM, Gradlist wrote:
Hi,
currently, I'm testing Gradle as an alternative to Maven. In my projects,
there are some 3rd party jars, which aren't available in any (Maven)
repositories. My problem is now, how could I manage it to install these jars
into my local .gradle repository. (If it's possible, I don't want to use the
local Maven repository, because Gradle should run independently.) At the
moment, I get a lot of exceptions because of missing jars. In Maven, it's
quite simple by running the install command. However, my Google search for
something similar to the Maven install command wasn't successful. Has
anybody an idea?
There's a few options:
1. Copy the jars to a local directory and use a flatDir() repository to
use them out of there. For example, you might copy them to
$projectDir/lib and in your build file do:
repositories {
flatDir(dirs: 'lib')
}
The files in the lib directory must follow the naming scheme:
name-version-classifier.extension, where version and classifier are
optional. So, for example you might call them groovy-1.7.0.jar or even
groovy.jar
Then, you just declare the dependencies as normal:
dependencies {
compile 'groovy:groovy:1.7.0'
}
There's a little more detail one flatDir() repository at:
http://gradle.org/0.9-preview-1/docs/userguide/dependency_management.html#sec:flat_dir_resolver
2. Similar to the above, but using an ivy resolver instead of flatDir().
This is pretty much the same as the above, but allows a lot more options
as far as naming and locations go.
There's some detail at:
http://gradle.org/0.9-preview-1/docs/userguide/dependency_management.html#sub:more_about_ivy_resolvers
3. Don't bother with declaring the dependencies. Just copy the jars to a
local directory somewhere and add a file dependency. For example, if the
jars are in $projectDir/lib:
dependencies {
compile fileTree('lib') // this includes all the files under 'lib'
in the compile classpath
}
More details at:
http://gradle.org/0.9-preview-1/docs/userguide/dependency_management.html#N12EAD
4. Use maven install to install the dependencies into your local maven
cache, and the use the maven cache as a repository:
repositories {
mavenRepo(urls: new File(System.properties['user.home'],
'.m2/repository').toURI().toURL())
}
After the 0.9 Gradle release, we plan on reworking the repositories DSL,
and one of the goals for that is to let you more easily use declarative
dependencies with artifacts which don't live in a formal repository.
--
Adam Murdoch
Gradle Developer
http://www.gradle.org
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email