简体   繁体   English

如何在IntelliJ中的GlassFish上运行?

[英]How to run on GlassFish in IntelliJ?

I am using IntelliJ , and I have a J2EE project. 我正在使用IntelliJ ,我有一个J2EE项目。 I have setted up a local GlassFish server in the IDE, but how can I configure the project to run on that local GlassFish server? 我在IDE中设置了一个本地GlassFish服务器,但是如何配置项目以在该本地GlassFish服务器上运行?

My project uses Java EE's features (such as servlets), but IntelliJ says that those libraries do not exist: 我的项目使用Java EE的功能(例如servlet),但IntelliJ说这些库不存在:

在此输入图像描述

I can't run my project either: 我也无法运行我的项目:

在此输入图像描述

How do I associate my local GlassFish server with the project, and enable the GlassFIsh's library? 如何将本地GlassFish服务器与项目关联,并启用GlassFIsh的库?

I have setted up a local GlassFish server in the IDE, but how can I configure the project to run on that local GlassFish server? 我在IDE中设置了一个本地GlassFish服务器,但是如何配置项目以在该本地GlassFish服务器上运行?

I assume that you did this using Run > Edit Configurations... in which a local or remote Glassfish server can be configured. 我假设您使用“运行”>“编辑配置...”执行此操作 ,其中可以配置本地或远程Glassfish服务器。 So in the window of Glassfish edit configurations there is a tab named deployment in which you can add source(s) to be deployed at the server startup. 因此,在Glassfish编辑配置窗口中,有一个名为deployment的选项卡,您可以在其中添加要在服务器启动时部署的源。

在服务器启动时部署

My project uses Java EE's features (such as servlets), but IntelliJ says that those libraries do not exist: 我的项目使用Java EE的功能(例如servlet),但IntelliJ说这些库不存在:

Go to File > Project structure or press Ctrl+Alt+Shift+S click to open Modules > Dependencies tab press the Add (+) button select Library... and there you can find Glassfish and add it as a dependency. 转到文件>项目结构或按Ctrl + Alt + Shift + S单击打开模块>依赖项选项卡按添加(+)按钮选择库...然后您可以找到Glassfish并将其添加为依赖项。

依赖

Did you follow the recommended way to create your J2EE project in Intellij? 您是否按照推荐的方式在Intellij中创建J2EE项目?

Follow the guide here: Getting Started with Java EE 7 and GlassFish 4.0 请遵循以下指南: Java EE 7和GlassFish 4.0入门

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM