Skip to content

Add support for Gradle #312

@mdesharnais

Description

@mdesharnais

The current state of integration with Maven is impressive and very useful. Unfortunately, this also means that users using other build tools have a suboptimal experience. Gradle is one such newer tool that is becoming increasingly popular.

I want to raise the question, whether it could be a mid-term goal, to add support for an alternative build tool. This support could range from instructions in the documentation to a plugin à la Maven.

As an example, here is a slightly edited version of the build script I am using for a project:

apply plugin: 'application'

version = 0.1
mainClassName = "foo.bar.baz.Main"
sourceCompatibility = 1.8

// The `javac` does not have that much warning, but it is still worth enabling them all.
compileJava {
  options.compilerArgs = [ "-Werror", "-Xlint:all" ]
}

// We want a `.tgz` instead of a plain `.tar`
tasks.withType(Tar){
  compression = Compression.GZIP
}

repositories {
  mavenCentral()
}

dependencies {
  compile group: 'org.jooby', name: 'jooby', version: '0.16.0'
  compile group: 'org.jooby', name: 'jooby-netty', version: '0.16.0'
  compile group: 'com.github.jknack', name: 'handlebars', version: '4.0.4'
  compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.6.0'
}

// Override project defaults to reproduce Jooby's structure.
sourceSets.main.resources {
  srcDirs = ["conf", "public"]
}

// The `java.util.PropertyResourceBundle` class only support ISO-8859-1, so we
// must manually convert the UTF-8 files.
processResources.doLast {
  new File(destinationDir, "i18n").listFiles().each { File f ->
    if (f.getName().endsWith(".properties")) {
      def path = f.getPath()
      "native2ascii -encoding UTF-8 $path $path".execute()
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions