OpenAPITools / OpenAPITools/openapi-generator

[BUG] [KOTLIN] JCenter is no longer exist. Duplicated `repositories` block in build.gradle.kts

Open
#11,143 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

JCenter is no longer exist but generated repositories block has a link to it.
Also there is repositories block duplication (You can find it on lines 16 and 50 in example of generated code)

Here is an example of generated build.gradle.kts for kotlin-spring:

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

buildscript {
    repositories {
        jcenter()
        maven { url = uri("https://repo1.maven.org/maven2") }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3")
    }
}

group = "org.openapitools"
version = "1.0.0"

repositories {
    jcenter()
    maven { url = uri("https://repo1.maven.org/maven2") }
}

tasks.withType<KotlinCompile> {
    kotlinOptions.jvmTarget = "1.8"
}

plugins {
    val kotlinVersion = "1.3.30"
    id("org.jetbrains.kotlin.jvm") version kotlinVersion
    id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion
    id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion
    id("org.springframework.boot") version "2.2.0.M3"
    id("io.spring.dependency-management") version "1.0.5.RELEASE"
}

dependencies {
    val kotlinxCoroutinesVersion="1.2.0"
    compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    compile("org.jetbrains.kotlin:kotlin-reflect")
    compile("org.springframework.boot:spring-boot-starter-web")
    compile("io.swagger:swagger-annotations:1.5.21")
    compile("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")
    compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
    compile("com.fasterxml.jackson.module:jackson-module-kotlin")

    testCompile("org.jetbrains.kotlin:kotlin-test-junit5")
    testCompile("org.springframework.boot:spring-boot-starter-test") {
        exclude(group = "junit", module = "junit")
    }
}

repositories {
    maven { url = uri("https://repo1.maven.org/maven2") }
    maven { url = uri("https://repo.spring.io/snapshot") }
    maven { url = uri("https://repo.spring.io/milestone") }
}
openapi-generator version

checked this bug on versions 5.3.0 and 5.0.0

OpenAPI declaration file content or url

This bug reproduced for any api description.

Command line used for generation

I used vanilla openapi generator for kotlin-spring with only one custom parameter:

additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true
Steps to reproduce
  • generate code for any openapi.yaml
  • look at the build.gradle.kts
  • find a jcenter() in repositories block
  • find a duplicate of repositories block in the end of the file

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the kotlin-spring generator template that emits build.gradle.kts and compare the repositories blocks shown in the report. Generate a Kotlin Spring project from any OpenAPI description with the listed library and additional properties; done means the output has no jcenter() entry and only one repositories block.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.