How to build jars from IntelliJ properly?

前端 未结 20 2846
盖世英雄少女心
盖世英雄少女心 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条回答
  •  猫巷女王i
    2020-11-22 01:59

    In case you are reading this answer because you are facing "resource file not found" error, try this:

    1. File -> Project Structure -> Artiface -> New, type is Other.
    2. Give it a nice name, and in the Output Layout, press Create Archive to create a new jar, and again, give it a nice name ;)
    3. Click on the jar you just added, add your compiled module output in the jar.
    4. Click on the jar again, in the lower pane, select your project path and add Manifest File then set correct Main Class and Class Path.
    5. Click Add Library Files, and select libraries you need (you can use Ctrl+A to select all).
    6. Build -> Build Artifact -> Clean & Build and see if the error is gone.

提交回复
热议问题