简体   繁体   English

Eclipse支持Glassfish 5

[英]Eclipse support for Glassfish 5

Does anyone know if there will be support for GlassFish 5 in Eclipse in nearer future (GlassFish Tools supports 3.1 and 4.x)? 有谁知道在不久的将来是否会在Eclipse中支持GlassFish 5(GlassFish Tools支持3.1和4.x)?

Is there another way to integrate Glassfish in Eclipse besides GlassFish Tools? 除了GlassFish Tools之外,还有其他方法可以将Glassfish集成到Eclipse中吗?

GlassFish Tools just checks for a version as follows: GlassFish Tools只检查版本如下:

Version version = getVersion();

if (!version.matches("[3.1-5)")) {
    return new Status(Status.ERROR, GlassfishToolsPlugin.SYMBOLIC_NAME, Messages.unsupportedVersion);
}

Where getVersion() is obtained from reading [install dir]/glassfish/modules/glassfish-api.jar!META-INF/MANIFEST.MF and then the Bundle-Version entry. 其中getVersion()是从阅读[install dir]/glassfish/modules/glassfish-api.jar!META-INF/MANIFEST.MF ,然后是Bundle-Version条目。

So a hacky way to get Eclipse working with GlassFish 5 and Payara 5 is: 因此,让Eclipse与GlassFish 5和Payara 5一起工作的一种愚蠢的方法是:

  1. cd [install dir]/glassfish/modules/ cd [install dir] / glassfish / modules /
  2. mkdir META-INF mkdir META-INF
  3. unzip -p glassfish-api.jar META-INF/MANIFEST.MF > META-INF/MANIFEST.MF unzip -p glassfish-api.jar META-INF / MANIFEST.MF> META-INF / MANIFEST.MF
  4. vim META-INF/MANIFEST.MF vim META-INF / MANIFEST.MF
  5. Change Bundle-version to start with a 4 and make sure digits are all single (ie 181 should become 0 or so) 将Bundle-version更改为以4开头并确保数字全部为单(即181应该变为0左右)
  6. zip -u glassfish-api.jar META-INF/MANIFEST.MF zip -u glassfish-api.jar META-INF / MANIFEST.MF

Now you can add a runtime and server for GlassFish 5 and Payara 5 as you would normally do, and start, debug, deploy etc. 现在,您可以像往常一样为GlassFish 5和Payara 5添加运行时和服务器,并启动,调试,部署等。

For illustration, the entry to be changed looks as follows: 例如,要更改的条目如下所示:

Bundle-Name: Public APIs of Glassfish
Bundle-Version: 5.181.0.Alpha4-SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Build-Jdk: 1.8.0_144

Should become: 应该成为:

Bundle-Name: Public APIs of Glassfish
Bundle-Version: 4.0.0.Alpha4-SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Build-Jdk: 1.8.0_144

The GlassFish tooling is currently in proposal to be donated to Eclipse, so it may take a while to be updated. GlassFish工具目前正在提交给Eclipse,因此可能需要一段时间才能更新。 Meanwhile, I'm planning to create a derivative version before long with some extra enhancements, but that too may take some time. 与此同时,我计划不久之后通过一些额外的增强功能创建衍生版本,但这也可能需要一些时间。

Eclipse Oxygen.3a (4.7.3a) now supports Glassfish 5 Eclipse Oxygen.3a(4.7.3a)现在支持Glassfish 5 在此输入图像描述 在此输入图像描述

for Eclipse photon users checkout my question and the chosen answer Cannot install Glassfish tools in Eclipse photon 对于Eclipse光子用户签出我的问题和所选答案无法在Eclipse光子中安装Glassfish工具

Unfortunately there's no support yet, but you could build your JavaEE app (EAR,WAR) grab the .war|ear file and paste it in 不幸的是还没有支持,但你可以构建你的JavaEE应用程序(EAR,WAR)抓取.war|ear文件并粘贴它

[GF_LOCATION]\glassfish5\glassfish\domains\[DOMAIN]\autodeploy\

Then go to [GF_LOCATION]\\glassfish5\\bin\\ 然后转到[GF_LOCATION]\\glassfish5\\bin\\

Open a terminal and run: 打开终端并运行:

asadmin start-domain [DOMAIN]

If you've configured your app correctly, you should be able to access you application locally, something like: 如果您已正确配置应用程序,则应该能够在本地访问您的应用程序,例如:

localhost:8080/YourApp/

If you require a datasource and connection_pool then from bin, run: 如果您需要datasourceconnection_pool然后从bin,运行:

asadmin add-resources [location_to_you_app's_glassfish-resources.xml]

This should add the configuration needed in GF5 to run your app. 这应该添加GF5所需的配置来运行您的应用程序。

Alternative 替代

Use Netbeans, I've been able to configure Glassfish 5 in netbeans. 使用Netbeans,我已经能够在netbeans中配置Glassfish 5。 Unfortunately, currente version, 8.2 doesn't have JavaEE 8 detection and automatic file completion yet, so you will have to add this configuration manually if you plan to use JSF 2.3,Servlet 4.0, etc ... , but at least you are able con configure and run you applications from your IDE onto Glassfish 5. 不幸的是,当前版本8.2还没有JavaEE 8检测和自动文件完成,所以如果你计划使用JSF 2.3,Servlet 4.0, etc ... ,你必须手动添加这个配置,但至少你能够con配置并运行从IDE到Glassfish 5的应用程序。

To integrate payara5 with Eclipse 4.7.1a via Oracle "GlassFish Tools" I hat to modify within file \\payara5\\glassfish\\modules\\glassfish-api.jar the file META-INF\\MANIFEST.MF at the end of the content as follows: 要通过Oracle“GlassFish Tools”将payara5与Eclipse 4.7.1a集成,我可以在文件\\ payara5 \\ glassfish \\ modules \\ glassfish-api.jar中修改内容末尾的文件META-INF \\ MANIFEST.MF,如下所示:

...;version="4.0.0" Bundle-Name: Public APIs of Glassfish Bundle-Version: 4.0 Created-By: Apache Maven Bundle Plugin Build-Jdk: 1.8.0_152 ...; version =“4.0.0”Bundle-Name:Glassfish Bundle的公共API-Version:4.0创建者:Apache Maven Bundle Plugin Build-Jdk:1.8.0_152

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

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