• 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

specifying dependencies in gradle  RSS feed

 
author & internet detective
Posts: 38911
686
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?


   
 
Bartender
Posts: 1856
81
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
Posts: 38911
686
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
    Posts: 38911
    686
    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: 484
    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: 5046
    134
    • 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
    Posts: 38911
    686
    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.
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!