IntelliJ automatically build artifacts when code changes

Viewed 5917

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.

1 Answers

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.
Related