leco leco - 11 days ago 6
Scala Question

Pants and IntelliJ

I wonder if there is a way to force IntelliJ to update a pants-based Scala project once the BUILD file has been changed outside the IDE.

Currently, the only way I have found to handle this is to re-create the project.

Thanks in advance.

Answer

What should I do if I modify a BUILD file?

When you modify a BUILD file or perform a Git operation that updates a BUILD file, your IntelliJ project may get out of sync with the state of BUILD files on disk.

To update the IntelliJ project, either trigger refresh all external projects or open Pants on the top menu bar, then click Refresh Pants project and wait for the refresh to complete.

How do I create a new target in IntelliJ?

Currently IntelliJ Pants plugin does not have an action assisting target creation.

If the new target will be in an existing BUILD file that is already in the project, please refer to What should I do if I modify a BUILD file?

Otherwise the new target needs to be created outside IntelliJ. Then import the new target into IntelliJ via the regular import process.

P.S.

If there is any specific aspect of the UX you would like to see improve, feel free to create an ticket on https://github.com/pantsbuild/intellij-pants-plugin/issues or make a pull request.