将 Liferay portlet 导入 Eclipse IDE
我有一个关于使用 liferay 插件 SDK 开发 liferay portlet 的问题。 我的问题主要在于开发 IDE 的设置。 建议使用 Netbeans IDE,我也尝试过,但它在我的机器上运行速度似乎非常慢,而 Eclipse 的性能相当不错。 Netbeans IDE 的设置如下
- 转至目录 \portlets
- 运行 create.bat(或 sh 文件,具体取决于操作系统)以创建新的示例 portlet
- 运行 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
- Go to the directory \portlets
- Run the create.bat (or sh file depending on the OS) to create a new sample portlet
- 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我知道你的痛苦。 开始使用 Liferay 需要很多时间。 如果您不想编辑现有源代码,而只想创建自己的 portlet,则可以从 Liferay 网站上的“其他文件”部分下载插件 SDK。 这提供了 ant 脚本,用于创建一个简单的 JSR 兼容 portlet,并创建所有必要的东西,以创建一个健全的 Eclipse 项目,例如:
比 cd 进入您创建的 portlet 的目录并执行以下操作:
之后您应该能够创建从 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:
Than cd into the directory of your created portlet an do:
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.
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
您可以找到在eclipse中部署liferay的教程
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Development+Environment+(Windows)
you can find the tutorial for deploying liferay in eclipse
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Development+Environment+(Windows)
不知道 Liferay 的细节,但一般来说,我会这样做:
No clue about Liferay's specifics, but in general, I'd do this:
截至 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.