Asking IntelliJ IDEA to install the built artifact

2020-07-22 09:44发布

The title sums it up: I'm looking for a way to build and install a jar file into maven's local repository on my machine in IntelliJ IDEA without having to go to command prompt each time and issue an mvn install:install-file command.

The biggest part is that I want the IDE to read the project's info from pom, like groupId, artifactId and version!

?

1条回答
Luminary・发光体
2楼-- · 2020-07-22 10:13

My assumption is that you have a source code of Maven project and you want to build it and install to local repository. First, you need to import it into IDEA as IDEA project.

It's very simple: "File" -> "Open..." -> select POM file and choose to open it as a project. IDEA will do the rest.

When you have already opened Maven project in IDEA, you can install it to local repository in two ways:

  1. Go to "Maven Projects" sidebar. Expand "Lifecycle" node of your project and click "install".
  2. Use "Terminal" window. It's a command line interface for your project, where you can type "mvn install". This way is more useful, when you need to customize Maven execution with additional parameters like profile selection.
查看更多
登录 后发表回答