java icon indicating copy to clipboard operation
java copied to clipboard

Gradle config for non-android project

Open petedmarsh opened this issue 6 years ago • 1 comments

I'm using gradle for the first time in my Java project (not android) and I'd like to use static code gen. I've taken a look at the example gradle file for android (https://github.com/json-iterator/java/blob/master/android-demo/build.gradle) but I'm unsure how to adapt this for a standard Java project. Is such an example available somewhere?

petedmarsh avatar Jan 15 '19 23:01 petedmarsh

For reference if someone needs non-andorid gradle setup:


apply plugin: 'java'
apply plugin: 'application'

task jsoniterStaticCodgen(type: JavaExec) {
    doFirst {
        //CAREFULL with this line, it can wipe src folder if slash won't match win \\ linux / backup before testing
        //delete sourceSets.main.java.srcDirs[0].toString() + '\\jsoniter_codegen\\'
    }
    classpath configurations.getByName(sourceSets.main.compileClasspathConfigurationName)
    classpath project.buildDir.toString() + '/classes/java/main/'
    main = 'com.jsoniter.static_codegen.StaticCodegen'
    args 'org.<package to your config>.CodegenConfig'
    workingDir = sourceSets.main.java.srcDirs[0]
}
compileJava.finalizedBy(jsoniterStaticCodgen)

norbert-gaulia avatar Oct 20 '20 19:10 norbert-gaulia