如何配置IntelliJ 11 +远程tomcat 6 + maven导入模块? [英] How to configure IntelliJ 11 + remote tomcat 6 + maven imported modules?

查看:576
本文介绍了如何配置IntelliJ 11 +远程tomcat 6 + maven导入模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我现在所在:




  • 将多个maven模块导入IntelliJ项目

  • Maven目标从Maven Projects弹出窗口运行OK - 创建一个战争文件。

  • 从Build | Make Project中创建项目也是可行的。但是这里没有创建任何战争,只是.class文件。

  • 在另一台机器上运行的Tomcat 6

  • 手动部署软件包maven目标到远程tomcat工作正常。

  • 将本地tomcat 6实例配置为应用程序服务器。我不会使用这个实例,但是JetBrains文档说我必须有一个本地实例才能让应用服务器配置IDE。

  • 没有配置工件和没有构面对于IntelliJ项目。

  • 远程tomcat运行时使用 JAVA_OPTS = -Xdebug -Xrunjdwp:transport = dt_socket,address = 1317,suspend = n,server = y我想要能够在IntelliJ中调试我的服务器,但是我想要能够调试我的服务器在IntelliJ中。



<这意味着我必须有一个运行配置,它执行以下操作:


  1. 生成相应的战争文件。使项目不会产生任何战争,所以应该被修改以产生一个或者战争应该被创建为运行配置的一部分。我不知道哪一个是正确的方法。

  2. 部署或重新部署到远程tomcat实例。

  3. 让我远程调试代码。

我该怎么做?



strong>



更正。其中一个项目将Web面自动添加到它,因为IntelliJ注意到了 ... \src\main\webapp\WEB-INF\web.xml 文件。



EDIT2



这是我的远程tomcat运行配置对话框:





文档说我应该在对话框中有执行on'更新'动作选项。这是哪里?



EDIT3



我添加了Spring支持和Spring web因为我们正在使用IntelliJ的服务插件。现在IntelliJ认出它并添加了Spring面:





但是,远程Tomcat运行配置对话框中仍然没有执行更新操作选项。 p>

我缺少什么?



EDIT4



解决了更新操作上缺少的执行选项的谜题 - 如何在IntelliJ中的远程Tomcat运行配置中启用执行on更新操作选项

解决方案

1)制作WAR



让IntelliJ IDEA产生war文件,您需要为该模块定义一个web面。


  1. 转到文件>项目结构>模块

  2. 选择您的模块

  3. 添加(通过'+'图标或Alt + Insert)Web面。

  4. 配置构面。 (如果您遵循标准,默认值应该是可以的,但检查它们。)

一旦定义了一个Web面,你然后可以定义一个WAR工件。


  1. 转到项目结构对话框中的工件页面。

  2. 您首先需要创建一个爆炸的战争神器。


    1. 单击添加按钮

    2. 选择Web应用程序:分解,然后选择从模块

    3. 在弹出窗口中,选择您的模块。验证Web应用程序工件是否正确定义。再次,如果您遵循标准,默认值应该是很好的。


  3. 一旦定义了爆炸物体,再次点击添加工件按钮并选择Web应用程序:Archie,然后For {module-name}:war(或者如果您没有使用默认名称,您命名为爆炸物体)。

  4. 验证配置。

IDEA将在您构建时创建一个war文件。 / p>

2)部署到远程服务器



您可以将其作为运行/调试配置的一部分。



3)远程调试



您只需创建运行/调试配置即可


  1. 从菜单
  2. 转到运行>编辑配置
  3. 单击添加图标(或键入Alt + Insert),然后从弹出列表中选择Tomcat Server> Remote。

  4. 配置运行/调试设置。我建议点击帮助按钮。它会显示出各种选项是什么。 (请务必注意哪些可用于本地,远程或两者。)请参阅帮助页面上的远程分期信息。此外,请确保选择部署选项卡并选择要部署的工件(并指定上下文路径。)启动/连接选项卡调试部分将需要在远程Tomcat上配置需要的调试连接信息服务器。

  5. 默认情况下,Make应列在启动前部分。一旦你添加了要部署的工件,那么在启动之前还应该显示这个工件将被构建。如果没有,添加它。

一旦定义,您可以执行此运行/调试配置。要调试,使用调试按钮或快捷键(Shift + F9)启动。这将使您的项目,创建战争,部署它,然后连接调试器。如果您只想在没有调试的情况下运行,请单击运行按钮,或使用快捷键Shift + F10。


Here is what I have now:

  • Imported multiple maven modules into IntelliJ project
  • Maven targets run OK from the Maven Projects flyout - a war file is created.
  • Making the project from the "Build|Make Project" is OK too. But here no war is created, just the .class files.
  • Tomcat 6 running on another machine
  • Manually deploying the war produced by the package maven goal to the remote tomcat works OK.
  • A local tomcat 6 instance is configured as an application server. I am not going to use this instance, but the JetBrains documentation says I must have a local instance in order to have an application server configured with the IDE.
  • No artifacts and no facets are configured for the IntelliJ project.
  • The remote tomcat is run with JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=1317,suspend=n,server=y

I want to be able to debug my server in the IntelliJ. Which means, that I must have a Run configuration, which does the following:

  1. Produces the respective war file. Making the project does not produce any war, so it should be either modified to produce one or the war should be created as part of a Run configuration. I have no idea which one is the right way.
  2. Deploys or redeploys it to the remote tomcat instance.
  3. Lets me remotely debug the code.

How do I do it?

EDIT

Correction. One of the projects has the Web facet automatically added to it, because IntelliJ has noticed the ...\src\main\webapp\WEB-INF\web.xml file.

EDIT2

Here is my remote tomcat run configuration dialog:

The documentation says I should have the Perform on 'Update' action option in the dialog. Where is it?

EDIT3

I have added Spring support and Spring web services plugins to IntelliJ, since we are using them. Now IntelliJ recognized it and added the Spring facet:

However, there is still no Perform on 'Update' action option in the remote Tomcat Run Configuration dialog.

What am I missing?

EDIT4

The mystery of a missing Perform on 'Update' action option is resolved - How to enable the Perform on 'Update' action option in the remote Tomcat run configuration in IntelliJ?

解决方案

1) Producing a WAR

To have IntelliJ IDEA produce the war file, you need to have a 'web' facet defined for the module.

  1. Go to File > Project Structure > Modules
  2. Select your module
  3. Add (via the '+' icon or Alt+Insert) a web facet.
  4. Configure the facet. (If you are following standards, the defaults should be OK, but check them.)

Once you have a web facet defined, you can then define a WAR artifact.

  1. Go to the "Artifacts" page in the Project Structure dialog.
  2. You will first need to create an exploded war artifact.

    1. Click the add button
    2. Select "Web Application: Exploded" and then "From Modules"
    3. In the popup, select your module. Verify that the web application artifact is correctly defined. Again, if you are following standards, the defaults should be good.

  3. Once the exploded artifact is defined, click the add artifact button again and select "Web Application: Archie", and then "For {module-name}:war exploded" (or what ever you named your exploded artifact if you did not use the default name).
  4. Verify the configuration.

IDEA will now create a war file when you build.

2) Deploy to Remote Server

You can do this as part of your run/debug configuration. See next section.

3) Remotely Debug

You simply need to create a run/debug configuration to do this.

  1. Go to Run > Edit Configurations from the menu
  2. Click the Add Icon (or type Alt + Insert) and select Tomcat Server > Remote from the pop-up list
  3. Configure the run/debug settings. I recommend clicking the Help button. It will show you what the various options are. (Be sure to pay attention which are available for Local, Remote, or Both.) Take a look at the "Remote Staging" information on the Help page. Also, be sure to select the deployment tab and select the artifact you want to deploy (and specify the context path.) The Startup/Connection tab, "Debug" section will have needed debug connection information that needs to be configured on the remote Tomcat server.
  4. By default, "Make" should be listed in the "Before Launch" section. And once you add the artifact to be deployed, the before launch should also show that the artifact will be built. If not, add it.

Once defined, you can execute this run/debug configuration. To debug, launch using the "debug" button or shortcut (Shift+F9). This will make your project, create the war, deploy it, and then connect the debugger. If you just want to run without debugging, click the Run button, or use the shortcut Shift+F10.

这篇关于如何配置IntelliJ 11 +远程tomcat 6 + maven导入模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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