Java 如何使用 IntelliJ IDEA 执行 mvn 命令?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27246065/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 04:02:08  来源:igfitidea点击:

How to execute mvn command using IntelliJ IDEA?

javamavenintellij-ideamaven-2maven-3

提问by vatsal mevada

I am trying to add Oracle JDBC driver in my local Maven repo. I have found thislink to do so.

我正在尝试在我的本地 Maven 存储库中添加 Oracle JDBC 驱动程序。我找到了这个链接来这样做。

I want to do the same from Inside IntelliJ IDEA. Is there any way to execute mvn commands from IntelliJ IDEA?

我想从 Inside IntelliJ IDEA 中做同样的事情。有没有办法从 IntelliJ IDEA 执行 mvn 命令?

采纳答案by Ruslan Ostafiichuk

There is a button in maven menu of Intellij IDEA:

Intellij IDEA 的 maven 菜单中有一个按钮:

screenshot

截屏

Also you can always use "Terminal"

您也可以随时使用“终端”

回答by Puce

In the Edit Configurations you can specify a Maven configuration which allows you to execute Maven goals.

在编辑配置中,您可以指定允许您执行 Maven 目标的 Maven 配置。

That said, I recommend to add the library to a Maven Repository such as Nexus. Then you can use the library like any other dependency and don't have to wory about the local repositories yourself.

也就是说,我建议将该库添加到 Maven 存储库,例如 Nexus。然后,您可以像使用任何其他依赖项一样使用该库,而不必自己担心本地存储库。

回答by user3145373 ツ

You can check the Image :

您可以检查图像:

enter image description here

在此处输入图片说明

If you don't fine the Maven Projects there then you can open it from Bottom Left part of Intellij IDEA, there's one Square Button there. click on it.

如果你没有在那里完善 Maven 项目,那么你可以从 Intellij IDEA 的左下部分打开它,那里有一个方形按钮。点击它。

If You don't have configure the mavenpath then you also need to configure maven directory also. Using maven settings.

如果您没有configure the maven路径,那么您还需要配置 maven 目录。使用maven settings.

回答by philippeback

In IntelliJ IDEA Ultimate 2018.2 (maybe earlier) there is a maven projects tool window:

在 IntelliJ IDEA Ultimate 2018.2(可能更早)中有一个 maven 项目工具窗口:

Maven Tool Window

Maven 工具窗口

Then goals are available:

然后目标可用:

Maven Goals

Maven Goals

There is no other way than to use the terminal for some commands. But these are few since there is quite a number of cool features in the toolbar.

除了使用终端执行某些命令外,别无他法。但是这些很少,因为工具栏中有很多很酷的功能。

回答by hossein

Just press the ctrl key twice!

只需按两次 ctrl 键!

Then you will see this: Command window

然后你会看到这个: 命令窗口

Then run your maven command

然后运行你的 maven 命令

https://www.jetbrains.com/help/idea/work-with-maven-goals.html

https://www.jetbrains.com/help/idea/work-with-maven-goals.html

回答by Arun Joshla

The maven command image is updated as below(in the latest versions)

The maven command image is updated as below(in the latest versions)

A popup will come up on clicking the maven icon from where mvn commands can be executed.

单击可以执行 mvn 命令的 maven 图标时会出现一个弹出窗口。