0

I am pretty new to Gradle, I followed some tutorials and read around wikis and guides but I still have some questions I couldn't clearly find an answer for.

What I'd like to have are some clarifications about Gradle and general github project dependencies.

Reading this question, he mentions the following example:

dependencies {  
    mavenCentral()
    compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+'
}

I get com.github.chrisbanes.actionbarpulltorefresh, it is basically com.github.username.repository, but what do exactly represent extra-abc and the +?

On the gradle irc they said the first one is the artifact and they gave me this, where it says: Dependency configurations are also used to publish files.. but I still don't get.. which files and for which purpouse you want to do that? I guess artifacts should refer to jars, but why giving it a name (extra-abc)?

+ takes the place where the version usually is, so I assume it should indicate the latest version, shouldn't it?

Moreover, is the example I pasted valid for both gradle and plain (netbeans) projects hosted on github or do we have to differentiate?

I am using Netbeans 8.02 with the gradle plugin.

Sorry for the dumb questions, but I really want to clear my doubts.

Community
  • 1
  • 1
elect
  • 6,765
  • 10
  • 53
  • 119

1 Answers1

0

First of all, this library is NO LONGER BEING MAINTAINED. You should use the support library.

I get com.github.chrisbanes.actionbarpulltorefresh, it is basically com.github.username.repository,

It is not correct.
This library is published on Maven Central.

The com.github.chrisbanes.actionbarpulltorefresh is the groupId of the artifact that you can find on Maven.

but what do exactly represent extra-abc

The extra-abc is the name of the artifact (the name of the library...) on Maven.

Here you can find the full list.

|GroupId                                     |ArtifactId|   Latest Version|
|--------------------------------------------|----------|-----------------|
|com.github.chrisbanes.actionbarpulltorefresh|library   |            0.9.9|
|com.github.chrisbanes.actionbarpulltorefresh|extra-abs |            0.9.9|
|com.github.chrisbanes.actionbarpulltorefresh|extra-abc |            0.9.9|

and the +

It indicates to gradle to use the last version. In your case you can use one of these:

compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+'
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:0.+'
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:0.9.+'
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:0.9.9'

Pay attention, the use of + is not in general a good idea, because you can't know what version you are using.
In this case, since the library is deprecated it is not a problem.

EDIT
If the question is how can I add a github project that is not present on the maven repo as a reference to my project then?

Pls refer to this answer:

Community
  • 1
  • 1
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
  • The `actionbarpulltorefresh` was just an example but thanks for the explanation and the suggestion about the `+`. Anyway, how can I add a github project that is not present on the maven repo as a reference to my project then? – elect Oct 21 '15 at 11:05
  • @elect In this case you can follow this answer: http://stackoverflow.com/questions/33053779/create-a-gradle-dependency-to-import-from-git/33053965#33053965 – Gabriele Mariotti Oct 21 '15 at 11:07