Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find gradle dependencies?

Tags:

eclipse

gradle

I'm trying to learn Gradle in Eclipse.

Is there any good integration where you can search for a Jar to include in the project?

Right now it's a hit-and-miss operation from my side.

Example:

I want to add the CLI library from Apache Commons. Also the Codec library.

I have added both jcenter() and mavenCentral like this:

repositories {
    jcenter()
    mavenCentral()
}

and I have tried this (and variations) in the dependencies section:

compile 'org.apache.commons:cli:1.2'
compile 'org.apache.commons:codec:1.10'

but all I get is

Could not resolve: org.apache.commons:cli:1.2
Could not resolve: org.apache.commons:codec:1.10

When searching in search.maven.org, if I search on org.apache.commons I get 111 pages of hits... I haven't found the time to step thru them all.

When searching for commons-cli, it finds a version from 2005... plus a library called

org.mod4j.org.apache.commons cli

No idea what the "mod4" means.

Is the conclusion that Apache commons doesnt exist in these repositories?

How do you do in these cases? How do you come up with the correct "compile"-specification?

Can I for example say "get latest version of this jar" ?

Would love to have a way to do:

gradle search apache-commons --only-latest-version

or something similar. Something like the wonderful GEM/BUNDLE commands in Ruby.

Thanks for all help

like image 822
Peter Andersson Avatar asked Jan 26 '17 17:01

Peter Andersson


People also ask

What is dependencies in Gradle?

Dependencies refer to the things that supports in building your project, such as required JAR file from other projects and external JARs like JDBC JAR or Eh-cache JAR in the class path. Publications means the outcomes of the project, such as test class files, build files and war files.

Where are the dependencies in Android Studio?

Go to File > Project Structure in Android Studio. Select the app module in the Modules list on the left. Select the Dependencies tab. Click the + button on the lower left to add the dependency.


1 Answers

You can search the Maven Central repository to find specific versions of artifacts, but in some cases you have to know the exact name (artifactId) of the artifact. Unfortunately the apache artifacts are not consistent in their groupId or artifactId naming schemes. For example, Apache Commons CLI is commons-cli:commons-cli.

Here is the latest version of that artifact. There is even a convenient panel that shows the exact line to use based on your dependency tool (maven, Gradle, Ivy, etc.)

enter image description here

like image 174
E-Riz Avatar answered Oct 02 '22 20:10

E-Riz