首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么我在rome utils-1.15.0.jar中没有得到主要的清单属性?

为什么我在rome utils-1.15.0.jar中没有得到主要的清单属性?
EN

Stack Overflow用户
提问于 2021-01-03 00:32:03
回答 3查看 157关注 0票数 0

我正在尝试使用罗马rss库。然而,当我去执行我的jar时,我得到了错误。

我假设它与我的build.gradle.kts文件有关。我已经把它复制到这里了

代码语言:javascript
复制
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")

我的应用程序在没有这个库的情况下构建得很好。但是,我需要使用这个特定的库。我在类似的问题中尝试了一些步骤,但它们都不起作用。当尝试执行我的程序时,我得到no main manifest attribute, in rome-utils-1.15.0.jar

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2021-01-12 07:21:05

问题出在shadowJar不恰当地构建了罗马jar。这是必须在shadowJar的github上采用的东西。

票数 1
EN

Stack Overflow用户

发布于 2021-01-11 23:06:24

我遇到了同样的问题,我确信这个问题不在build.gradle文件中。

票数 0
EN

Stack Overflow用户

发布于 2021-01-12 01:46:00

我相信你想要的是mainClass而不是mainClassName per Gradle user guide

所以试一试

代码语言:javascript
复制
application {
    mainClass = "io.ktor.server.netty.EngineMain"
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65541467

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档