Building a self-executable jar with Gradle and Kotlin

前端 未结 7 1451
囚心锁ツ
囚心锁ツ 2020-12-08 18:40

I\'ve written a simple kotlin source file in order to get started, and a gradle script file. But I can\'t figure out how to add the main func to the manifest, so that the ja

7条回答
  •  心在旅途
    2020-12-08 19:08

    None of the above solution worked for me while building Artifact.

    IDE version IntelliJ IDEA 2019.1.1.

    To fix the issue, do the following

    Steps

    Step 1 - Create Artifact

    1. Go to File -> Project Structure -> Artifacts

    2. Click the + -> JAR -> From modules with dependencies

    1. Select your program's Main Class

    Step 2 - Change MANIFEST Path

    1. Change value of Directory for META-INF/MANIFEST.MF to your project root.

      For example , from /your/project/directory/src/main/kotlin to /your/project/directory

    1. Press OK,then Press Apply and OK.

    Step 3 - Build Artifact

    1. Finally, Go to Build -> Build Artifacts -> [your-artifact-name] -> Build.

    The generated JAR file can be found in the out/artifact/[your-artifact-name] directory. (y)

提交回复
热议问题