Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow generation of build.gradle file #234

Open
thejeff77 opened this issue Sep 19, 2023 · 3 comments
Open

Allow generation of build.gradle file #234

thejeff77 opened this issue Sep 19, 2023 · 3 comments

Comments

@thejeff77
Copy link

In order to package the generated code to prepare to publish as an artifact, a build.gradle file has to be created that can build the project as a *.jar file.

This is included for openapi generated clients for this reason.

Could support for generating a build.gradle file in the root destination directory be supported?

@thejeff77
Copy link
Author

thejeff77 commented Sep 20, 2023

This is a build.gradle file that worked for me:

group 'com.missionlane'
version 'VERSION'

buildscript {
    ext.kotlin_version = '1.7.21'

    repositories {
        maven { url "https://repo1.maven.org/maven2" }
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

apply plugin: 'kotlin'
apply plugin: 'maven-publish'

repositories {
    maven { url "https://repo1.maven.org/maven2" }
}

test {
    useJUnitPlatform()
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

    // Below dependencies are solely present so code examples in the test resources dir compile
    implementation("javax.validation:validation-api:2.0.1.Final")
    implementation("jakarta.validation:jakarta.validation-api:3.0.2")
    // implementation("org.springframework:spring-webmvc:6.0.0")
    // implementation("org.springframework.security:spring-security-web:6.0.0")
    implementation("io.micronaut:micronaut-core:3.8.7")
    implementation("io.micronaut:micronaut-http:3.8.7")
    //testCompileOnly("io.micronaut.security:micronaut-security:3.8.7")
    implementation("com.squareup.okhttp3:okhttp:4.10.0")
    implementation("com.pinterest.ktlint:ktlint-core:0.48.2")
    implementation("com.pinterest.ktlint:ktlint-ruleset-standard:0.48.2")
    implementation("com.pinterest:ktlint:0.48.2")
    implementation("org.openapitools:jackson-databind-nullable:0.2.6")
    implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.15.2")

}

@cjbooms
Copy link
Owner

cjbooms commented Sep 23, 2023

As there are many different build tools for JVM, we have deliberately avoided adding gradle script, or otherwise, generation to save on the maintenance toil.

However, if you like we can accept an example gradle script for this that we link to from the README?

@thejeff77
Copy link
Author

Yeah that would be just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants