将 Liferay portlet 导入 Eclipse IDE

发布于 2024-07-14 22:08:35 字数 612 浏览 9 评论 0原文

我有一个关于使用 liferay 插件 SDK 开发 liferay portlet 的问题。 我的问题主要在于开发 IDE 的设置。 建议使用 Netbeans IDE,我也尝试过,但它在我的机器上运行速度似乎非常慢,而 Eclipse 的性能相当不错。 Netbeans IDE 的设置如下

  1. 转至目录 \portlets
  2. 运行 create.bat(或 sh 文件,具体取决于操作系统)以创建新的示例 portlet
  3. 运行 Netbeans IDE,创建一个新的“Java 自由形式项目”并将其指向到创建的示例 portlet 的目录

就是这样,非常简单。

由于上述原因(并且因为我对 Eclipse 更加熟悉),我想以相同的方式将项目导入到 Eclipse 中。 有没有一种方法可以做到这一点,而不必对创建的示例 portlet 和相应的 build.xml (ant 文件)的原始结构进行太多更改? 我已经尝试从创建的示例 portlet 的 build.xml ant 文件中创建一个新项目,但是这样它不包含我的源代码。

我在网上也没有找到很棒的教程... 有人可以帮我解决这个问题,指出在线教程或给我一些提示。

谢谢

I have a question regarding the development of liferay portlets using the liferay plugin SDK. My question goes mainly in the setup of the development IDE. The suggested one would be to use Netbeans IDE which I also tried out, but it appears to run very slowly on my machine while Eclipse is quite performant.
The setup for Netbeans IDE is the following

  1. Go to the directory \portlets
  2. Run the create.bat (or sh file depending on the OS) to create a new sample portlet
  3. Run Netbeans IDE, create a new "Java free form project" and point it to the directory of the created sample portlet

That's it, pretty simple.

For the mentioned reasons above (and because I'm a lot more familiar with Eclipse) I'd like to import the project into Eclipse the same way. Is there a way for doing it without having to change too much in the original structure of the created sample portlet and the according build.xml (ant file)?? I tried already to create a new project out of the build.xml ant file of the created sample portlet, however in this way it doesn't include me the source code.

I didn't also find great tutorials on the web...
Could someone help me with this, pointing out online tutorials or give me some hints.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

花辞树 2024-07-21 22:08:35

我知道你的痛苦。 开始使用 Liferay 需要很多时间。 如果您不想编辑现有源代码,而只想创建自己的 portlet,则可以从 Liferay 网站上的“其他文件”部分下载插件 SDK。 这提供了 ant 脚本,用于创建一个简单的 JSR 兼容 portlet,并创建所有必要的东西,以创建一个健全的 Eclipse 项目,例如:

ant -Dportlet.name=<project name> -Dportlet.display.name="<portlet title>" create

比 cd 进入您创建的 portlet 的目录并执行以下操作:

ant setup-eclipse

之后您应该能够创建从 Eclipse 中该目录中的源代码创建一个新项目,然后可以通过另一个 ant 脚本将其部署到正在运行的 tomcat 实例。 如果您已经了解一些有关 portlet 编程的知识,那么您现在应该已经很满意了。 如果没有,请先尝试查找有关 JSR portlet 编程的文档,然后再研究 Liferay 特定 portlet 开发。

I know your pain. Starting to work with Liferay needs much time. I you do not want to edit the existing source, but only crate your own portlets, you can download the plugins SDK from the 'Additional Files' section on the Liferay website. This provides ant scripts, to create a simple JSR compliant portlet, and to create all necessary things, to create a sound Eclipse project, for example:

ant -Dportlet.name=<project name> -Dportlet.display.name="<portlet title>" create

Than cd into the directory of your created portlet an do:

ant setup-eclipse

After that you should be able to create a new project from the sources in that directory in Eclipse, which can then be deployed via another ant script to the running tomcat instance. If you already know somthing about portlet programming, you shoud be pretty much settled now. If not, try to find documentation about JSR portlet programming first, before looking into Liferay specifig portlet development.

决绝 2024-07-21 22:08:35

Liferay 现在已经发布了一套官方的 Eclipse 插件,支持 portlet 开发。 以下是安装 Eclipse 插件的安装指南:

Liferay IDE 安装指南

另外还有一个入门指南,展示了安装后如何实际设置您的第一个 portlet 项目。

入门教程

Liferay IDE在幕后使用 Liferay 的插件 SDK 来完成所有工作。 如果您已经有使用 Plugins SDK 创建的现有项目,那么这些项目也可以导入到 Liferay IDE 中。

导入现有项目

Liferay has now released an official set of Eclipse plugins that support portlet development. Here is the installation guide for installing the eclipse plugins:

Liferay IDE Installation Guide

Also there is a getting started guide that shows what to do after installation to actually setting up your first portlet project.

Getting Started Tutorial

Liferay IDE uses the Plugins SDK from Liferay under the covers to do all the work. If you already have existing projects that you created with the Plugins SDK those can be imported into Liferay IDE as well.

Importing existing Projects

烟柳画桥 2024-07-21 22:08:35

不知道 Liferay 的细节,但一般来说,我会这样做:

  1. 按照 NB 设置列表中的步骤 1 和 2
  2. 创建一个新的动态 Web 项目(如果不需要 Web 项目的功能,则创建一个 Java 项目) Eclipse
  3. 通过执行 Import -> 来导入示例 portlet 目录的内容 Eclipse 中的文件系统
  4. 调整项目的 Java 源目录以指向生成的示例 portlet 源目录(现在应该出现在您的项目中)
  5. 调整项目的类路径,将其指向 LR lib 文件夹,...
  6. 如果有生成的构建。 xml,检查它是否可用于部署到 LR,或生成构建。

No clue about Liferay's specifics, but in general, I'd do this:

  1. Follow the steps 1 and 2 from your NB setup list
  2. Create a new Dynamic web project (or a Java project if you don't need the web project's features) in Eclipse
  3. Import the contents of sample portlet directory by doing Import -> File system in Eclipse
  4. Adjust the project's Java source directory to point to the generated sample portlet source directory (that should now appear in your project)
  5. Adjust classpath of the project, point it to LR lib folders, ...
  6. If there's a generated build.xml, check if it can be used to deploy to LR, or to produce builds.
岁吢 2024-07-21 22:08:35

截至 2011 年 3 月,Liferay 对 NetBeans 提供了一些官方支持,并且如前所述,对 Eclipse 也提供了官方支持(在 Marketplace 中)。 纪录片作者自己使用 Eclipse,尽管许多示例只是使用带有 shell 脚本、ant 脚本的 Plugins-SDK,而不是 IDE。

我们正在与 Eclipse 上的 Liferay 进行斗争,Eclipse 看起来有问题且不可预测,但我们对 J2EE 和 Eclipse 也是新手(所以稍微考虑一下最后的评论),并且我在 SVN 的单独区域中设置了 portlet 文件,需要重构-move,重构肯定是有bug的。

您应该知道,官方纪录片制作人正在为开发人员提供一本书 - 我们已经购买了早期版本并发现它很有用。 他确实涵盖了一些 IDE 问题。 参见曼宁出版社。

Liferay 示例 portlet(有很多)不是为 Eclipse 项目设置的,您必须导入一些 java 文件并跳过一些 Eclipse 环节才能将它们放入您可以开发的正在运行的 Eclipse 项目中。

As of March 2011, there is some official Liferay support for NetBeans and as noted before, there is official support for Eclipse ( In the Marketplace). The Documentarian uses Eclipse himself, though many examples just use the Plugins-SDK with shell scripts, ant scripts and no IDE.

We are fighting with Liferay on Eclipse, Eclipse seems buggy and unpredictable, but we are also new to J2EE and Eclipse ( so discount this last comment a bit), and I have our portlet files setup in a separate area for SVN, requiring a refactor-move, refactor is definitely buggy.

You should be aware that there is a book for developers on the way from the official documentarian - we've bought the early release and found it useful. He does cover some IDE issues. See Manning press.

The Liferay sample portlets ( there are many) are not set up for Eclipse projects, and you'll have to import some java files and jump through some Eclipse hoops to get them into a running Eclipse project you can develop.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文