java 如何在 IntelliJ 中运行 GlassFish?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28402770/
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
How to run on GlassFish in IntelliJ?
提问by Victor2748
I am using IntelliJ, and I have a J2EE project. 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?
我正在使用IntelliJ,并且我有一个 J2EE 项目。我已在 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 的库?
采纳答案by eric-haibin-lin
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 入门
回答by Amir Keshavarz
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. So in the window of Glassfish edit configurations there is a tab named deploymentin which you can add source(s) to be deployed at the server startup.
我假设您是使用Run > Edit Configurations... 完成的,其中可以配置本地或远程 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 表示这些库不存在:
Go to File > Project structureor press Ctrl+Alt+Shift+S click to open Modules > Dependenciestab press the Add (+) button select Library...and there you can find Glassfish and add it as a dependency.
转到文件 > 项目结构或按 Ctrl+Alt+Shift+S 单击打开模块 > 依赖项选项卡,按添加 (+) 按钮选择库...,然后您可以找到 Glassfish 并将其添加为依赖项。