How to build jars from IntelliJ properly?

前端 未结 20 2527
盖世英雄少女心
盖世英雄少女心 2020-11-22 01:14

I have a project that contains a single module, and some dependencies. I\'d like to create a jar, in a separate directory, that contains the compiled module. In addition, I\

20条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-22 01:44

    My problem was this: I used Intellij IDEA (tried different versions) + Gradle. When I compiled the project and builded artifacf jar, as indicated in the above responses, I received an error - "no main manifest attrubute ..."

    This solution worked for me (special thanks to Thilina Ashen Gamage (see above) for tip):

    Excerpt - if you use external libraries and build a project through Project Settings - Artifacts - Add (+) - Jar - From modules with dependencies, then probably because of a program bug the META-INF folder with MANIFEST_MF file not including to jar. To avoid it create EMPTY jar file.

    Project Settings - Artifacts - Add (+) - Jar - EMPTY JAR. META-INF folder will added to resources folder. Then select your main class. You will see following jar structure: Note the presence of a folder META-INF Then you can build your project and build artifacts. This solution worked for javaFX applications too.

提交回复
热议问题