10

I'd like to set the filename of the jar artifact that I build with Intellij, but as I change it, it doesn't change in the output file.

enter image description here

Eugene Evdokimov
  • 2,220
  • 2
  • 28
  • 33
turinho
  • 125
  • 1
  • 6

2 Answers2

15

Using 2017.2.5 I am able to change the artifact name using the following steps:

  1. File > Project Structure.
  2. Under Project Settings > Artifacts.
  3. Add a new or modify existing artifact.
  4. Under Output Layout you can actually rename your JAR file to whatever you want, be sure to hit on enter to have the IDE eat up the change.

Screenshot:

Changing Name of JAR File

Rejinderi
  • 11,694
  • 2
  • 31
  • 40
  • 1
    The key piece of information for me was to press Enter. On the Mac, pressing Return isn't enough. Press the real Enter key (on the keypad) or Fn-Return on a keyboard without a separate Enter key. – Barry Brown May 15 '19 at 22:30
4

Here is a workaround to change the filename of the JAR artifact...

  1. From the Project pane, rename the module to what you'd like the JAR file to be named. The filename of the JAR is is captured from the name of the module at the time you create the artifact config.
  2. Go into Build Artifacts->Edit.. and delete the old artifact that is making the wrong JAR file name.
  3. Add a new JAR Artifact. This new artifact will use whatever the name of the module is.
  4. You can now go back and change the module name back.

Ugly, but works.

Note that you will likely hit this bug next, so make sure you do not use the default main/java path to the manifest. Instead manually change it to main/resources - and then go vote to have both these bugs fixed!

bigjosh
  • 1,273
  • 13
  • 19