Glassfish 服务器库在 Eclipse Kepler 中不可用?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17204096/
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-09-19 20:45:26  来源:igfitidea点击:

Glassfish Server Library not available in Eclipse Kepler?

eclipseglassfishbuildpath

提问by dispake

I'm setting up a new dev machine with Eclipse Kepler to deploy on a Glassfish 3.1.2.2 instance.

我正在使用 Eclipse Kepler 设置一台新的开发机器以部署在 Glassfish 3.1.2.2 实例上。

When I go to

当我去

project properties > java build path > libraries > add library > server runtime

There is no option to add the Glassfish server libraries.

没有添加 Glassfish 服务器库的选项。

Some other notes of what I've done (whether they help or not...):

我所做的其他一些笔记(无论是否有帮助......):

  • Manually installed GF
  • Installed OEPE for Juno
  • GF Server already added
  • GF Server starts / stops no problem (from Eclipse)
  • 手动安装GF
  • 为 Juno 安装 OEPE
  • GF 服务器已添加
  • GF 服务器启动/停止没问题(来自 Eclipse)

I pretty much had the same setup on my other machine with the exception that I used Juno instead of Kepler (however, I tried the above with a fresh Juno install as well). That machine has everything working but was set up a while ago. From what I understand, there has been a lot of changes with GF, Eclipse plugins and such: https://blogs.oracle.com/piotrik/entry/glassfish_3_1_2_2. So perhaps it's still under works and not fully ready?

我在另一台机器上几乎有相同的设置,除了我使用 Juno 而不是 Kepler(但是,我也尝试使用全新的 Juno 安装进行上述操作)。那台机器一切正常,但是是前一段时间设置的。据我了解,GF、Eclipse 插件等发生了很多变化:https: //blogs.oracle.com/piotrik/entry/glassfish_3_1_2_2。所以也许它仍在工作中并且没有完全准备好?

In the meantime, I created a User Library with the Glassfish jar files from the Modules folder. Not the ideal solution but it works for now.

同时,我使用 Modules 文件夹中的 Glassfish jar 文件创建了一个用户库。不是理想的解决方案,但目前有效。

However, I still rather have the "cleaner" method of adding a Server Runtime instead. Ideas?

但是,我仍然宁愿使用“更干净”的方法来添加服务器运行时。想法?

回答by robinst

See the thread GlassFish Tools does not provide a Server Runtime for Java Build Pathin the Oracle forum.

请参阅Oracle 论坛中的主题GlassFish 工具不提供 Java 构建路径的服务器运行时

Summary: They no longer provide a "Server Runtime" for plain Java projects. Instead, the project needs to be a faceted project and have a target runtime.

简介: 他们不再为普通 Java 项目提供“服务器运行时”。相反,该项目需要是一个分面项目并具有目标运行时。

To configure this, do the following:

要配置它,请执行以下操作:

  1. Go to the project properties > Project Facets
  2. If necessary, click on Convert to faceted form...
  3. In the Runtimestab, select GlassFish 3.1
  1. 转到项目属性 >项目构面
  2. 如有必要,单击转换为多面形式...
  3. 运行时选项卡中,选择GlassFish 3.1

In case you need to export the GlassFish libraries to dependent projects, also do the following:

如果您需要将 GlassFish 库导出到相关项目,还需要执行以下操作:

  1. In Project Facetsproperties, select Utility Moduleand click Apply
  2. In Java Build Path> Order and Export, select GlassFish System Libraries
  1. Project Facets属性中,选择Utility Module并单击Apply
  2. Java Build Path> Order and Export 中,选择GlassFish System Libraries

回答by Andre

Someone has reported this issue in the Oracle Glassfish Tools forum. A fix will be included in the next release, which "will be out before too long".

有人在 Oracle Glassfish 工具论坛中报告了这个问题。下一个版本将包含一个修复程序,“很快就会发布”。

See https://forums.oracle.com/thread/2552592

请参阅https://forums.oracle.com/thread/2552592

I ended up installing "GlassFish Tools for Indigo" from Help > Eclipse Marketplace...

我最终从帮助 > Eclipse Marketplace 安装了“GlassFish Tools for Indigo”...

回答by unwichtich

Looks like a bug in Eclipse Kepler / Glassfish Server Tools.

看起来像是 Eclipse Kepler / Glassfish Server Tools 中的一个错误。

You can try the following:

您可以尝试以下操作:

Add this in your projects .classpath file:

将此添加到您的项目 .classpath 文件中:

<classpathentry kind="con" path="oracle.eclipse.tools.glassfish.lib.system">
    <attributes>
        <attribute name="owner.project.facets" value="jst.web"/>
    </attributes>
</classpathentry>

Update the file YOUR_PROJECT/.settings/org.eclipse.wst.common.project.facet.core.xmlto look like this:

将文件更新为YOUR_PROJECT/.settings/org.eclipse.wst.common.project.facet.core.xml如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <runtime name="GlassFish 3.1"/>  <-- Insert the name of your Glassfish Runtime in Eclipse here 
  <fixed facet="jst.web"/>
  <fixed facet="java"/>
  <fixed facet="wst.jsdt.web"/>
  <installed facet="java" version="1.7"/>
  <installed facet="jst.web" version="3.0"/>
  <installed facet="glassfish.web" version="3.1"/> <-- Glassfish Version here
  <installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>

You have to choose the appropriate runtime name which you defined in Eclipse.

您必须选择在 Eclipse 中定义的适当运行时名称。

回答by Munesh

Goto Project Properties > Project Facets > Under the tabs 'Runtimes' > Select the glass fish server and click on Apply. This will setup the GF Java EE libraries in the build path.

转到项目属性 > 项目构面 > 在“运行时”选项卡下 > 选择玻璃鱼服务器并单击应用。这将在构建路径中设置 GF Java EE 库。