IntelliJ IDEA:Maven,项目编译和部署 [英] IntelliJ IDEA: Maven, project compilation and deployment

查看:2315
本文介绍了IntelliJ IDEA:Maven,项目编译和部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能解释一下IntelliJ IDEA的捆绑maven项目的编译,部署和打包工作流程吗?

Can someone explain me IntelliJ IDEA's workflow of compilation, deployment and packaging with binded maven project ?

当我启动tomcat服务器时,我遇到了一些误解IDEA的调试模式。例如,我有一个工件 - 战争存档。
正如我所知,当我运行调试模式时 - IDEA重新编译并将更改的代码更新为war-archive。

I've encountered some misunderstanding when I'm starting tomcat server via IDEA's debug mode. For example I have one artifact - war archive. As I understand when I'm running debug mode - IDEA recompiles and updates changed code into war-archive.

但是打包的maven工件会发生什么? IntelliJ会更新吗?或者我必须在启动前设置'Buld maven'选项以确保更改的代码将上传到环境中?

But what happens with packaged maven artifact ? Does IntelliJ updates it ? Or I have to set 'Buld maven before startup' option to be sure that changed code will be uploaded to environment ?

推荐答案

Intelli J不使用maven来构建它使用自己的构建过程的项目。它使用pom文件作为项目的描述。

Intelli J doesn't use maven to build the project it uses its own build process. It uses the pom file as a description of the project.

这意味着一些事情,如果你想在tomcat中运行时构建一个像war文件这样的工件,那么你所要做的就是告诉IntelliJ构建运行/调试配置对话框中的war。 IntelliJ将自动构建您在运行/调试配置的部署选项卡下指定的任何工件。因此,如果你指定爆炸战争,它将构建爆炸战争,如果你指定常规战争,它将建立常规战争。

This means a couple of things, if you want to build an artifact such as a war file when running in tomcat then all you have to do is tell IntelliJ to build the war in the Run/Debug Configurations dialog. IntelliJ will automatically build any artifacts you specify under the deployment tab of your run/debug configuration. So if you specify the exploded war it will build the exploded war, if you specify the regular war it will build the regular war.

有时人们需要运行自定义插件或构建目标,在这种情况下,您可以配置IntelliJ来运行自定义maven目标。

Occasionally people need to run custom plugins or build targets in which case you can configure IntelliJ to run the custom maven goals.

您还可以告诉intellIJ运行maven包目标而不是构建工件。 IntelliJ会将目标目录下的任何内容部署到tomcat。

You can also tell intellIJ to run the maven package goal rather than build the artifact. IntelliJ will deploy whatever is under the target directory to tomcat.

重要的是,IntellIJ正在使用两个独立的构建系统。您需要告诉每个构建系统要做什么。而且你需要告诉IntelliJ哪个构建系统用于什么。一旦项目被导入,IntelliJ将默认使用它自己的构建系统,除非你告诉它使用maven做某事。

The important take away is IntellIJ is using two separate build systems. You need to tell each build system what to do. And you need to tell IntelliJ which build system to use for what. IntelliJ will by default use it's own build system once a project has been imported, unless you tell it to use maven for something.

虽然IntelliJ将构建您在pom文件中指定的工件,但除非您单击它,否则不会执行将工件存储库(本地或其他方式)部署到工件存储库的操作。在Maven工具窗口中部署目标。

While IntelliJ will build the artifact you specify in the pom file it won't do things like deploy them your artifact repository (local or other wise) unless you click on the deploy target in the Maven tools window.

此外,如果您更改了pom文件但未启用自动重新导入,则在您单击强制重新导入之前,这些更改不会反映在您的项目中maven工具窗口中的选项。

Also if you change your pom file and don't have auto re-import enabled those changes won't be reflected in your project until you click the force re-import option from the maven tools window.

这篇关于IntelliJ IDEA:Maven,项目编译和部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆