简体   繁体   English

如何解决Intellij想法不将清单添加到工件的问题?

[英]How to fix Intellij idea not adding manifest to Artifact?

I ran into a problem which I cannot solve neither by cleaning, nor by deleting Artifact/recreating it. 我遇到了一个问题,我既无法通过清洁也无法通过删除工件/重新创建来解决。 I stuck with it for several days now and google search doesn't know such problem. 我坚持了几天,谷歌搜索不知道这样的问题。

So, I have a Gradle java project in Intellij Idea, and it doesn't extract my manifest to Artifact's jar. 因此,我在Intellij Idea中有一个Gradle java项目,它没有将清单提取到Artifact的jar中。

It does it in a different project, but here it doesn't include manifest, so my jar says no main manifest attribute, in txtadventureserver_main.jar 它在另一个项目中执行此操作,但此处不包含清单,因此我的jar no main manifest attribute, in txtadventureserver_main.jarno main manifest attribute, in txtadventureserver_main.jar

在此处输入图片说明

Here's the Artifact screen - manifest is not there and I don't see how I add it 这是工件屏幕-清单不存在,我看不到如何添加它

在此处输入图片说明

here's my gradle: 这是我的礼物:

group 'com.vladdrummer.txtadventureserver'
version '1.0-SNAPSHOT'

apply plugin: 'java'
apply plugin: 'idea'

sourceCompatibility = 1.8

jar {
    manifest {
        attributes 'Main-Class': 'TextAdventureServer'
    }
}
repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile group: 'junit', name: 'junit', version: '4.12'
    compile "com.sparkjava:spark-core:2.7.2"
}

You can generate the MANIFEST.mf by going here in the Project Settings window: 您可以通过在“项目设置”窗口中转到此处来生成MANIFEST.mf:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM