• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

specifying dependencies in gradle  RSS feed

 
author & internet detective
Marshal
Posts: 38506
653
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see both of these styles online for specifying the GAV (group id/artifact id/version) coordinates in Gradle. Is one preferred? If so, why?


   
 
Saloon Keeper
Posts: 1801
74
Android Chrome IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is a really good question, which I do not know the answer to, but I'd like to know as well.
To add to that here are a few other examples which Jeanne did not supply, but I think they do apply to this topic:It's been my experience that you if use a variable then you need to use the double quote as shown below:From looking at the documentation/examples provided by Gradle it appears as though usually (but not always) single quotes/apostrophes is used as opposed to the double quotes.
Plus, fairly often (but not always) in the documentation/examples they use this type of notation when dealing with plugins:All of the preceding examples different notations then what Jeanne provided in her initial post.

I wonder if some of this ambiguity is related to Groovy of is it all related to Gradle?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 38506
653
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pete,
Some of the distinctions you posted have to do with the person's familiarity with Groovy. For example:

  • A single quoted Groovy string is a like Java string. A double quoted Groovy string is called a "GString". It has superpowers and can expand variables just like UNIX does.
  • Some syntax isn't necessary in Java (like those parens you showed.) Java developers tend to use the 'extra" syntax.
  •  
    Jeanne Boyarsky
    author & internet detective
    Marshal
    Posts: 38506
    653
    Eclipse IDE Java VI Editor
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I'm at a Groovy presentation at DevNexus. Ken Kousen (who wrote a book about Java) showed the 'group:name:version' syntax and said he likes it better. But he said either is fine. So I think it is a personal preference thing.
     
    Ranch Hand
    Posts: 480
    10
    Android Open BSD Slackware
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Jeanne Boyarsky wrote:I see both of these styles online for specifying the GAV (group id/artifact id/version) coordinates in Gradle. Is one preferred? If so, why?


       


    I suggest to drop a line here
     
    Saloon Keeper
    Posts: 4693
    117
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    I suggest to drop a line here


    Why? What's that got to do with Jeanne's question?
     
    Jeanne Boyarsky
    author & internet detective
    Marshal
    Posts: 38506
    653
    Eclipse IDE Java VI Editor
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Tim Moores wrote:

    I suggest to drop a line here


    Why? What's that got to do with Jeanne's question?


    It kind of does. I was using hamcrest in the example and it looks like they are considering switching back to Maven.

    But I wasn't really asking about hamcrest. I was just using it for the sake of example.
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!