kotlingradlerome

Why do I get no main manifest attribute, in rome-utils-1.15.0.jar?


I am trying to use the rome rss library. However, when I go to execute my jar I get the error.

I am assuming it has something to do with my build.gradle.kts file. I have copied it here

buildscript {
    repositories {
        maven("https://plugins.gradle.org/m2/")
        maven(url = "https://www.jitpack.io") {
            name = "jitpack"
        }
        flatDir {
            dirs("libs")
        }
    }
    dependencies {
    }
}

plugins {
    application
    kotlin("jvm") version "1.4.0"
    id("com.github.johnrengelman.shadow") version "6.1.0"
}

application {
    mainClassName = "io.ktor.server.netty.EngineMain"
}

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

tasks {
    withType<KotlinCompile> {
        kotlinOptions.jvmTarget = "11"
    }
    named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
        archiveBaseName.set("freedom")
        archiveClassifier.set("")
        archiveVersion.set("1.1.0")
        manifest {
            attributes(mapOf("Main-Class" to application.mainClassName))
        }
    }
}

dependencies {
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
    implementation("io.ktor:ktor-server-netty:$ktor_version")
    implementation("com.rometools:rome:1.15.0")
    implementation("ch.qos.logback:logback-classic:$logback_version")
    implementation("io.ktor:ktor-client-core:$ktor_version")
    implementation("io.ktor:ktor-client-core-jvm:$ktor_version")
    implementation("io.ktor:ktor-gson:$ktor_version")
    implementation("io.ktor:ktor-client-apache:$ktor_version")
    implementation("io.ktor:ktor-html-builder:$ktor_version")
    implementation("com.github.chimbori:crux:2.2.0")
    implementation("org.jsoup:jsoup:1.13.1")
    implementation("io.lettuce:lettuce-core:6.0.1.RELEASE")
    implementation("org.jetbrains.exposed", "exposed-core", "0.28.1")
    implementation("org.jetbrains.exposed", "exposed-dao", "0.28.1")
    implementation("org.jetbrains.exposed", "exposed-jdbc", "0.28.1")
    implementation("com.google.firebase:firebase-admin:7.0.1")
    implementation("org.postgresql", "postgresql", "42.2.18")
    implementation("com.zaxxer:HikariCP:3.4.5")
    implementation("com.github.kittinunf.fuel:fuel:2.3.0")
    implementation("com.github.kittinunf.fuel:fuel-gson:2.3.0")
    testImplementation("io.ktor:ktor-server-tests:$ktor_version")
}

kotlin.sourceSets["main"].kotlin.srcDirs("src")
kotlin.sourceSets["test"].kotlin.srcDirs("test")

sourceSets["main"].resources.srcDirs("resources")
sourceSets["test"].resources.srcDirs("testresources")

My app builds fine without this library. However, I need to use this particular library. I have tried steps in similar questions but they did not work. When trying to execute my program I get no main manifest attribute, in rome-utils-1.15.0.jar


Solution

  • The problem lies with shadowJar improperly building the Rome jar. This is something that must be taken up on the shadowJar's github.