pegasystems / api2swagger

Auto generation of Swagger JSON by invoking REST API
Apache License 2.0
13 stars 4 forks source link

Convert to gradle project? #2

Closed cdancy closed 6 years ago

cdancy commented 6 years ago

Might it make sense to convert to a gradle based project?

saikiran939 commented 6 years ago

Maven looks simple for our standalone java project, any advantages that we would get in gradle over maven in this case ?

cdancy commented 6 years ago

Gradle is the direction we've adopted internally at Pega so I'm just wondering why we've not done so in our open-source space? As to the advantages of gradle over maven I could go on ad nausem about them but this site does a much better and more concise breakdown of them:

https://gradle.org/maven-vs-gradle/

saikiran939 commented 6 years ago

Yes I understand that there are advantages in gradle over Maven, but my point was Maven looks simple to use and easy to maintain for a standalone project like api2swagger (which doesn't have any other project dependencies)

cdancy commented 6 years ago

@saikiran939 I assume by that comment you've never worked with gradle before and so I can appreciate where you are coming from. Consider the below gradle snippet that I just whipped together. It's enough to build this entire project and I was able to knock it out in about 15 minutes. It's as stupid-simple as one can get and is inifintely less lines of code than the pom that is in place now. If you want to add maven pulishing and/or jacoco it's probably handful more of lines.

On top of this, and building on top of the link I posted above, gradle makes it very easy to apply plugins to bring in checkstyle/pmd/findbugs/error-prone/jacoco and loads of other tools simply by adding one line of code. I could send in a PR for this work (it's really very simple) and/or you could take a look a the gradle-multi-project-example we put together and are trying to pass around and get folks to adopt internally that I recently open-sourced for broader usage.

apply plugin: 'java'

repositories {
    jcenter()
}

dependencies {    
    compile ("com.fasterxml.jackson.core:jackson-core:2.8.5")
    compile ("log4j:log4j:1.2.17") 
    compile ("io.rest-assured:json-schema-validator:3.0.2") 
    compile ("io.swagger:swagger-parser:1.0.24") 
    compile ("com.google.guava:guava:20.0") 
    compile ("com.mashape.unirest:unirest-java:1.4.9") 
    compile ("com.beust:jcommander:1.48") 
    runtime ('org.slf4j:slf4j-log4j12:1.7.22') 

    testCompile ("org.hamcrest:hamcrest-all:1.3")
    testCompile ("junit:junit:4.12") 
}

ext.compatibilityVersion = '1.7'
sourceCompatibility = compatibilityVersion
targetCompatibility = compatibilityVersion
cdancy commented 6 years ago

@dcasavant any opinions here one way or another? It would be great to start standardizing on the use of gradle within our open-source projects vs maven. On top of all the benefits it's simply easier to maintain on top of being that much more terse.

dcasavant commented 6 years ago

I do think we should be suggesting Gradle for all projects at this point for consistency. If you have not used Gradle before, it would be a good experience to try it out too. @cdancy or I can help if you would like.

cdancy commented 6 years ago

@dcasavant I can send in a PR as the work is easy enough to knock out or the project could be modeled after the one I linked to above which has all the bells and whistles of a fully featured gradle project.

cdancy commented 6 years ago

Merged as part of #4