KenjiOhtsuka / harmonica

Kotlin Database Migration Tool. This tool makes it really easy to create table, index, add columns, and so on, with Kotlin DSL.
MIT License
134 stars 17 forks source link

plugin requires kotlin-pluralize which is not in common maven repos #140

Open NikkyAI opened 4 years ago

NikkyAI commented 4 years ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. add plugin to project
  2. refresh gradle
A problem occurred configuring project ':backend'.
> Could not resolve all artifacts for configuration ':backend:classpath'.
   > Could not find com.github.cesarferreira:kotlin-pluralizer:0.2.9.

this repo seems to be required to add in pluginManagement to find the kotlin-pluralizer dependency https://repository.mulesoft.org/nexus/content/repositories/public/

it is the only repo i found that provides the dependency https://mvnrepository.com/artifact/com.github.cesarferreira/kotlin-pluralizer/0.2.9

Expected behavior A clear and concise description of what you expected to happen.

easier adding of gradle plugin, maybe via shadowing the library ?

Environment:

Additional context Add any other context about the problem here.

The harmonica depndency seems to also not be properly uploaded to maven a .pom file seems to be missing and gradle refuses to find it on jcenter or bintray

Thank you for your cooperation!

LookBad commented 4 years ago

I have the same problem.

KenjiOhtsuka commented 4 years ago

@NikkyAI @LookBad Excuse me, could you share your build.gradle?

It could be the same situation as https://github.com/KenjiOhtsuka/harmonica/issues/144 🤔

LookBad commented 4 years ago

Yeah, no problem. I also use kotlin dsl. Gradle version: 6.1.1.

plugins {
    // Support for Kotlin
    id("org.jetbrains.kotlin.jvm") version "1.3.61"
    // Support for building a CLI application
    application
    // Documentation
    id("org.jetbrains.dokka") version "0.10.0"

    id("com.improve_future.harmonica") version "1.1.24"
}

application {
    mainClassName = "com.easythings.parkkometr.AppKt"
    group = "com.easythings"
    version = "0.0.1"
}

sourceSets {
    main {
        java.srcDir("app/main/src")
        resources.srcDir("app/main/resources")
    }
    test {
        java.srcDir("app/test/src/")
        resources.srcDir("app/test/resources/")
    }
}

repositories {
    jcenter()
    maven { url = uri("https://kotlin.bintray.com/ktor") }
}

dependencies {
    val ktorVersion: String by project
    val logbackVersion: String by project
    val exposedVersion: String by project
    val pgVersion: String by project
    val spekVersion: String by project

    // Kotlin ==========================================================================================================
    implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")

    // Libs ============================================================================================================
    // Ktor - framework
    implementation("io.ktor", "ktor-server-jetty", ktorVersion)
    implementation("io.ktor", "ktor-server-core", ktorVersion)
    implementation("io.ktor", "ktor-server-host-common", ktorVersion)
    implementation("io.ktor", "ktor-auth", ktorVersion)
    implementation("io.ktor", "ktor-auth-jwt", ktorVersion)
    implementation("io.ktor", "ktor-gson", ktorVersion)
    implementation("io.ktor", "ktor-network-tls-certificates", ktorVersion)

    // Logback - application logger
    implementation("ch.qos.logback", "logback-classic", logbackVersion)

    // Exposed - orm
    implementation("org.jetbrains.exposed", "exposed-core", exposedVersion)
    implementation("org.jetbrains.exposed", "exposed-dao", exposedVersion)
    implementation("org.jetbrains.exposed", "exposed-jdbc", exposedVersion)
    implementation("org.jetbrains.exposed", "exposed-jodatime", exposedVersion)

    // Postgresql - database driver
    implementation("org.postgresql", "postgresql", pgVersion)

    // Tests ===========================================================================================================
    testImplementation("org.jetbrains.kotlin", "kotlin-test")
    testImplementation("org.jetbrains.kotlin", "kotlin-test-junit")

    // Ktor test lib - default
    testImplementation("io.ktor", "ktor-server-tests", ktorVersion)

    // Speak - test lib
    testImplementation("org.spekframework.spek2", "spek-dsl-jvm", spekVersion)
    testRuntimeOnly("org.spekframework.spek2", "spek-runner-junit5", spekVersion)

    // Speak requires kotlin-reflect, can be omitted if already in the classpath
    testRuntimeOnly("org.jetbrains.kotlin", "kotlin-reflect")

    // AssertJ - more readable assertion methods
    testImplementation ("org.assertj","assertj-core","3.15.0")
}

tasks {
    dokka {
        outputDirectory = "$buildDir/docs/dokka"
        outputFormat = "html"
    }

    test {
        useJUnitPlatform {
            includeEngines("spek2")
        }
    }
}
LookBad commented 4 years ago

I upgraded Gradle to version 6.2.1. My error msg:

> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find com.github.cesarferreira:kotlin-pluralizer:0.2.9.
     Searched in the following locations:
       - https://plugins.gradle.org/m2/com/github/cesarferreira/kotlin-pluralizer/0.2.9/kotlin-pluralizer-0.2.9.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project : > com.improve_future.harmonica:com.improve_future.harmonica.gradle.plugin:1.1.24 > gradle.plugin.com.improve_future:harmonica:1.1.24
gdude2002 commented 4 years ago

We're also having this issue - the repo contains a pom-default.xml, but indeed, that is not where a pom should be, and therefore Gradle is unable to resolve it.

KenjiOhtsuka commented 4 years ago

@gdude2002 Hello. Thank you for your comment. You mean that I have to rename pom-default.xml to pom.xml, right?

KenjiOhtsuka commented 4 years ago

I added harmonica-1.1.26.pom

KenjiOhtsuka commented 4 years ago

Or, I have to use any other library for pluralization 🤔

KenjiOhtsuka commented 4 years ago

org.jboss.dna.common.text.Inflector looks another option https://github.com/HexarA/Json2Pojo/blob/master/src/org/jboss/dna/common/text/Inflector.java

It is in Apache 2 licence. (Should I copy it to this repo or use it as library ....)

gdude2002 commented 4 years ago

I'm not really even sure how you ended up managing to deploy without a pom - it's very much the standard thing, and it's what the maven-publish plugin does by default.

Are you sure you haven't over-customized the deploy phase?

Also: Please do not bundle libraries. They should be Maven dependencies if possible.

NikkyAI commented 4 years ago

if kotlin-pluralize is only used internally and not exposed to the library user then i guess shadowJar + repackaging is a option since i could not get this to work i never used it so that may as well be a moot point (hope to evaluate it for future projects still)

kotlin-pluralize looks like a abandoned project anyways

gdude2002 commented 4 years ago

Kotlin-pluralizer seems to be using JitPack (unfortunately, but it's something)

KenjiOhtsuka commented 4 years ago

@LookBad @NikkyAI adding maven { setUrl("https://jitpack.io") } could be the makeshift solution, I think.

// build.gradle.kts
repositories {
    jcenter()
    maven { setUrl("https://jitpack.io") }
}
LookBad commented 4 years ago

It doesn't work for me :(

KenjiOhtsuka commented 4 years ago

@LookBad Excuse me, did you use version 1.1.26?

LookBad commented 4 years ago

Version of plugin: 1.1.24, version of lib: 1.1.26.

KenjiOhtsuka commented 4 years ago

@LookBad

Sorry to be too late reply. I guess the following change may work. Could you tell me your Java version? I want to test it.

// add
buildscript {
    repositories {
        jcenter()
        maven { url = uri("https://jitpack.io") }
    }
    dependencies {
        classpath group: 'org.jetbrains.kotlin', name: 'kotlin-script-util', version: '1.3.20'
        classpath 'com.improve_future:harmonica:1.1.26'
    }
}

plugins {
    ...
    // remove
    //id("com.improve_future.harmonica") version "1.1.24"
}

// add
apply plugin: 'jarmonica'

repositories {
    jcenter()
    maven { url = uri("https://kotlin.bintray.com/ktor") }
    // add
    maven { url = uri("https://jitpack.io") }
}