7

Is there a way to automatically build artifacts in a project just like how it automatically build the output? A shortcut key would also work if it exists -- right now I need to click on Build -> Build Artifacts -> Build which is cumbersome.

Edit: my "artifact" in this case is just a jar file of my project output.

valiano
  • 16,433
  • 7
  • 64
  • 79
JRR
  • 6,014
  • 6
  • 39
  • 59

1 Answers1

12

Old question, but posting this hoping it'll be useful to others.

You could set the artifacts to be updated automatically when the project is built, rather than having to manually build the artifacts on each update: open the project settings (File -> Project Structure), and in the Artifacts tab check Include in project build (screenshot IntelliJ IDEA Ultimate 2017.1):

IntellJ Build Artifacts Automatically

Edit:

For having the artifacts built automatically upon source change, similar to automatic build, refer to the procedure described in @CrazyCoder answer that was commented above:

deploy/debug java code on a remote server using Intellij

Quoting the additional needed steps from this answer, adapted for IntelliJ IDEA Ultimate 2017.1:

  • Open File -> Settings -> Build, Execution, Deployment.
  • Under Options, set the Upload changes files automatically to the default server to On explicit save action (Ctrl + S).
  • Check the Upload external changes box below.
valiano
  • 16,433
  • 7
  • 64
  • 79
  • In IntelliJ, you can enable the project to be automatically built on source change. I think this is what OP is referring to as "*just like how it automatically build the output*". While checking `Include in project build` as you show here enables IntelliJ to build the artifact when the project is **manually** built, the artifact is still not built with the automatic project build. The user still has to manually trigger a "build" for the project to build the artifact. – birgersp Jan 22 '18 at 14:22
  • @gromit190 thanks, now that I read this again, I see your point! I'll update my answer. – valiano Jan 23 '18 at 06:49