RE: Deploying Eclipse as Liveray Development Environment

thumbnail
3067934, modified 17 Years ago. Regular Member Posts: 164 Join Date: 5/11/09 Recent Posts
I am stuck setting up Eclipse. I tried to use the Liveray source dir as a workspace, but Eclipse ist not allowing this. So I startet a new Project and importet the sources. Then I used the build.xml as an ant buildfile and managed to run clean, start and build-ext. I created my own app.server.properties and properties files according to this guide and copied the tomcat dir into my liferay source dir.
When I try to create a new project ext in eclipse analog to the guide (well mostly, since the description in the guide how to create a liferay project does not draw in any sources) eclipse can not find the dependencies of the sources in the project ext.
So I triedt to leave out this step, since this is just ment to be a test to play around with liferay portlets, I tried to tell eclipse where the tomcat server ist. But neither the image in the guide, nor the description, what I should do, is useable since the menuoptions in eclipse are not near those described in the guide....
Is there any documentation about this, which ist actually working? This seems awfull out of date. I am trying to write a simple HelloWorld Portlet since yesterday afternoon, but I have not actually written a single line of code, because I can not even setup liferay.
Any help is greatly apreciated, I do not see, how to work from here.

Regards
Kolja
thumbnail
3067934, modified 17 Years ago. Regular Member Posts: 164 Join Date: 5/11/09 Recent Posts
So there ist no one in this forum, developing portlets for Liferaz using eclipse? Feels kind of strange...
I will give the windows environment a try, since existing documentation focuses on that...

Regrads
Lorgarn
thumbnail
3077583, modified 17 Years ago. Regular Member Posts: 226 Join Date: 5/12/09 Recent Posts
http://www.liferay.com/web/guest/community/documentation/4_2

at the documentation of Liferay 4.2 there are powerpoint tutorials,

http://content.liferay.com/4/docs/ppt/eclipse/eclipse-1-create-a-new-project.ppt
http://content.liferay.com/4/docs/ppt/eclipse/eclipse-2-set-up-the-debugger.ppt

these should be a good start point.

http://content.liferay.com/4/docs/ppt/installation/installation-3-ext-environment.ppt also at this powerpoint it tutors how to point to existing eclipse directory of yours. this may be also useful.

i am stuck at "liferay adminisration guide 5.1" pg 31 "CREATE CONFIGURATION FILES"...

if i come to your point i will develop portlets by eclipse but i am now supposed to first deploy to ext and then hook to MySQL database and then start with eclipse. much to do, you advanced great by the way in 2 days.

where are you from Deutschland ?

p.s. by the way there are so many threads that are not answered, you moderator ?

ilke
thumbnail
3067934, modified 17 Years ago. Regular Member Posts: 164 Join Date: 5/11/09 Recent Posts
ilke Muhtaroglu:

if i come to your point i will develop portlets by eclipse but i am now supposed to first deploy to ext and then hook to MySQL database and then start with eclipse. much to do, you advanced great by the way in 2 days.

Guesss I skipped the 'ext-environment-Part'. Except from reading documents and staring at error mesages I have not done anythin exceptional. I do not like PowerPoint very much and since I am in the very comfortalbe position, to do my whole documentation with LaTeX, it feels wierd to install something like open office, just to have a look at some documentation, but I will give it a try.

ilke Muhtaroglu:

where are you from Deutschland ?

Near Bremen. Google Maps is about 10km wrong...

ilke Muhtaroglu:

p.s. by the way there are so many threads that are not answered, you moderator ?
ilke

I am afraid I do not understand that question.

Regards

Kolja
thumbnail
1392811, modified 17 Years ago. Regular Member Posts: 163 Join Date: 10/7/08 Recent Posts
Hi,

for portlet development, you should use the SDK instead of ext.
To do that, follow these steps :
- download and run Liferay
- download the SDK
- create a build.<username>.properties from the build.properties file where username is your OS username; edit the file in order to specify which server you use for deployment
- download Liferay source code
- import the Liferay source code in you Eclipse workspace (if needed, rename the project to "portal")
- in <SDK_home>/portlets/, simply type "/create.sh hello-world "Hello World"
- cd to to "hello-world-portlet"
- type : "ant setup-eclipse"
- import the "hello-world-portlet" project into your Eclipse workspace
- import the build.xml from the portlet in the Eclipse Ant view
- run the "deploy" target and the hello-world portlet will be deployed in your running Liferay instance

Hope this helps
thumbnail
3067934, modified 17 Years ago. Regular Member Posts: 164 Join Date: 5/11/09 Recent Posts
Thank you for your replies. I will try to comment, what I did according to your steps...


To do that, follow these steps :
- download and run Liferay

Did that. Installed a new JAVA SDK from scratch, set envrionment variables, installed ant, set evironment variables
Installed Liferay, set TOMCAT_HOME pointing to the tomcat within the Liferay bundel, setup MySQL, created a database and a database user with all permissons
Executedt startup.bat, works: done...


- download the SDK

Which one? There is a Liferay SDK and a Liferay portlet SDK. Assuming I need the portlet SDK I tool that one. Now what? Where to install this? What to do with it? There is not even a readme...
Asked the Liferay portal, which had nothing apropiate, asked google which came up with an wiki article form the Liferay wiki (very interesting):
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Plugins+SDK
So according to this guide I unziped the contents of the archive into the liveray directory, noticing this did not overwrite any file.
So I created a new filde called 'build.$username.properties' in my Liferay directory with the following values:

app.server.dir=H:\Programme\liferay-portal-5.2.2\tomcat-5.5.27
auto.deploy.dir=H:\Programme\liferay-portal-5.2.2\deploy
app.server.lib.portal.dir=H:\Programme\liferay-portal-5.2.2\tomcat-5.5.27\webapps\ROOT\WEB-INF\lib
javac.compiler=modern

I did not set anything for app.server.portal.dir, since there is no such directory in my Liferay folder. And yes, the letter of my harddisk is H: not C:, don't ask. It is most painfull to speak about that...


- create a build.<username>.properties from the build.properties file where username is your OS username; edit the file in order to specify which server you use for deployment

Done while installing Portlet SDK.


- download Liferay source code

Did that and extracted the archive to a different directory, then my working Liferay installation.


- import the Liferay source code in you Eclipse workspace (if needed, rename the project to "portal")

Installed Eclipse, created a workspace at H:\liferay. Crated a new project called portal, created the project from existing source in H:\liferay\portal (that's where the liferay sources are). Creating the project took ages, but did not complain about anything except about 100 warnings concerning no parameterized Vertors an the like.


- in <SDK_home>/portlets/, simply type "/create.sh hello-world "Hello World"

Since there already is a hello-world-portlet in Liferay i choose a different name, so things do not get mixed up:

H:\Programme\liferay-portal-5.2.2\portlets&gt;create.bat lorgarn-test "Lorgarn Test"
Buildfile: build.xml

create:
    [unzip] Expanding: H:\Programme\liferay-portal-5.2.2\portlets\portlet.zip in
to H:\Programme\liferay-portal-5.2.2\portlets\lorgarn-test-portlet
    [mkdir] Created dir: H:\Programme\liferay-portal-5.2.2\portlets\lorgarn-test
-portlet\docroot\WEB-INF\tld

BUILD FAILED
H:\Programme\liferay-portal-5.2.2\portlets\build.xml:30: H:\Programme\bundles\to
mcat-5.5.27\webapps\ROOT\WEB-INF\tld not found.

Total time: 5 seconds

H:\Programme\liferay-portal-5.2.2\portlets&gt;


Does not look so great. Since the directory 'lorgarn-test' was created, I gave it a shot:


- cd to to "hello-world-portlet"
- type : "ant setup-eclipse"

This is, what happened:

H:\Programme\liferay-portal-5.2.2\portlets&gt;cd lorgarn-test-portl
t

H:\Programme\liferay-portal-5.2.2\portlets\lorgarn-test-portlet&gt;
e
Buildfile: build.xml

setup-eclipse:

BUILD FAILED
H:\Programme\liferay-portal-5.2.2\build-common.xml:98: H:\Progra
at-5.5.27\common\lib\ext not found.

Total time: 1 second
H:\Programme\liferay-portal-5.2.2\portlets\lorgarn-test-portlet&gt;

I do not know, what is ment here. There are not 'trunk' directories, not in the source dir, and not in the liferay instalation...

- import the "hello-world-portlet" project into your Eclipse workspace

Tried that despite the errors, created a new project from existing source in lorgarn-test-portlet. Getting about 37 errors, about things can not be resolevd to a type.

Stuck at this point....again!!

Do I have to keep Liferay and Tomcat away from the Liferay sources? If not:How to mange/merge them? I somthing like subversion neccessary just to build one sample portlet?

Regards
Kolja

[Edit: Removed typos]
thumbnail
1392811, modified 17 Years ago. Regular Member Posts: 163 Join Date: 10/7/08 Recent Posts
re,
Kolja Köster:


- download the SDK

Which one? There is a Liferay SDK and a Liferay portlet SDK. Assuming I need the portlet SDK I tool that one. Now what? Where to install this? What to do with it? There is not even a readme...


You have to get the "Liferay Plugins SDK 5.2.2" from http://www.liferay.com/web/guest/downloads/additional.
You can extract it wherever you want (not necessary in the Liferay folder).

According to the errors, it seems to be a misconfig from your build.<username>.properties.In the build.<username>.properties, assuming that you are using tomcat 5.5, edit the line in bold:
app.server.dir=[b]H:\Programme\liferay-portal-5.2.2\tomcat-5.5.27[/b]
app.server.classes.portal.dir=${app.server.portal.dir}/WEB-INF/classes
app.server.lib.global.dir=${app.server.dir}/common/lib/ext
app.server.lib.portal.dir=${app.server.portal.dir}/WEB-INF/lib
app.server.portal.dir=${app.server.dir}/webapps/ROOT


Remember, the username is your os username. On windows, type "set" and search for the env variable called "USERNAME".
thumbnail
3067934, modified 17 Years ago. Regular Member Posts: 164 Join Date: 5/11/09 Recent Posts
Thanks for your quick answer.
I edited the build.$username.properties again (yes, I am aware it ist not 'username' but my actual username on the machine) and it looks like this now:

app.server.dir=${project.dir}/../bundles/tomcat-5.5.27
app.server.portal.dir=${app.server.dir}/webapps/ROOT
app.server.classes.portal.dir=${app.server.portal.dir}/WEB-INF/classes
app.server.lib.global.dir=${app.server.dir}/common/lib/ext
app.server.lib.portal.dir=${app.server.portal.dir}/WEB-INF/lib


auto.deploy.dir=${app.server.dir}/../deploy

##
## Compiler
##

    ant.build.javac.source=1.5
    ant.build.javac.target=1.5

    javac.compiler=modern
    #javac.compiler=org.eclipse.jdt.core.JDTCompilerAdapter

    javac.debug=on
    javac.deprecation=off
    javac.fork=true
    javac.memoryMaximumSize=256m
    javac.nowarn=on

##
## Libraries
##

    required.portal.jars=commons-logging.jar,log4j.jar,util-bridges.jar,util-java.jar,util-taglib.jar

##
## Operating Systems
##

    os.apple=Mac OS X
    os.unix=Linux,FreeBSD,Solaris,SunOS
    os.windows=Windows 95,Windows 98,Windows NT,Windows 2000,Windows 2003,Windows XP,Windows Vista

##
## Plugins
##

    #
    # Set the excludes and includes attributes. These attributes are read when
    # you run "ant" from the layouttpl, portlets, or themes directory. By
    # default, the ant task will go through every subdirectory. Setting these
    # attributes can limit it to just the plugins you're working on.
    #
    plugins.excludes=
    plugins.includes=*

##
## SVN
##

    svn.enabled=false

##
## Version
##
   #
    # Set the version of Liferay Portal that these plugins are designed for.
    #
    lp.version=5.2.2


Ceating a portlet still complains:


H:\Programme\liferay-portal-5.2.2\portlets&gt;create.bat lorgarn-test "Lorgarn Test
"
Buildfile: build.xml

create:
    [unzip] Expanding: H:\Programme\liferay-portal-5.2.2\portlets\portlet.zip in
to H:\Programme\liferay-portal-5.2.2\portlets\lorgarn-test-portlet
    [mkdir] Created dir: H:\Programme\liferay-portal-5.2.2\portlets\lorgarn-test
-portlet\docroot\WEB-INF\tld

BUILD FAILED
H:\Programme\liferay-portal-5.2.2\portlets\build.xml:30: H:\Programme\bundles\to
mcat-5.5.27\webapps\ROOT\WEB-INF\tld not found.

Total time: 1 second

H:\Programme\liferay-portal-5.2.2\portlets&gt;

Still don't get where the 'Programme\bundles\tomcat' path comes from...

Regards
Kolja
thumbnail
1392811, modified 17 Years ago. Regular Member Posts: 163 Join Date: 10/7/08 Recent Posts
H:\Programme\bundles\tomcat-5.5.27\ exists ?
what is the complete path of your liferay/tomcat directory ?
thumbnail
3067934, modified 17 Years ago. Regular Member Posts: 164 Join Date: 5/11/09 Recent Posts
Gaaaa....
Build faild because I wanted to be really sure the config understands me and used backslashes '\' instead of slashes '/'.
So liferay\tomcat becomes:
liferay omcat -.-

Ceating Portlest works not, trying to deploy them via eclipse..

Regards and thanks
Kolja

[Edit: created the portlet with create.bat, changed into the directory and did 'ant setup-eclipse' which was successfull. When I try to create a eclipse project now, from the source in my test portlet dir, I get seven java errors, about missing required libs like anotations.jar oder portal-service.jar. Shall I include them manually?
thumbnail
1392811, modified 17 Years ago. Regular Member Posts: 163 Join Date: 10/7/08 Recent Posts
Kolja Köster:
[Edit: created the portlet with create.bat, changed into the directory and did 'ant setup-eclipse' which was successfull. When I try to create a eclipse project now, from the source in my test portlet dir, I get seven java errors, about missing required libs like anotations.jar oder portal-service.jar. Shall I include them manually?


From the build.xml file from the "portal" Eclipse project, run the target called "jar", and then refresh your Eclipse projects.
thumbnail
3067934, modified 17 Years ago. Regular Member Posts: 164 Join Date: 5/11/09 Recent Posts
Nico Ekito:

From the build.xml file from the "portal" Eclipse project, run the target called "jar", and then refresh your Eclipse projects.

Like adding an ant view on the "Portal" Project and adding the build.xml file? I did that an found the jar- build among many others. Compilation fails with:

[javac] H:\liferay\portal\util-bridges\src\com\liferay\util\bridges\php\PHPPortlet.java:31: package com.liferay.util.servlet does not exist


Do I have to do a complete ant build as described in the 'creating an ext environment' documentation?

Regards
Kolja
thumbnail
1392811, modified 17 Years ago. Regular Member Posts: 163 Join Date: 10/7/08 Recent Posts
try "ant compile" first, and then "jar"
thumbnail
3067934, modified 17 Years ago. Regular Member Posts: 164 Join Date: 5/11/09 Recent Posts
I will...
But I will leave my working place now, so it may take some time until I can post something about that (guess this is a convenient information, since communication was almost realtime). I will do further work on that tomorrow morning or perhaps this evening.
You have bee most helpfull so far, many thanks.

Regards
Kolja
thumbnail
3067934, modified 17 Years ago. Regular Member Posts: 164 Join Date: 5/11/09 Recent Posts
So I have tried ant compile and ant jar, but still no luck. I did a ant clear, ant compile, ant start, ant jar, but still the same issue. I my portlet project there are no buildpaths to:
annotations.jar
portal-kernel.jar
portal-service.jar
util-bridges.jar
util-java.jar
util-taglib.jar

Regards
Kolja
thumbnail
1392811, modified 17 Years ago. Regular Member Posts: 163 Join Date: 10/7/08 Recent Posts
Re,

check the following locations :
<eclipse_workspace>/portal/lib/global/annotations.jar
<eclipse_workspace>/portal/portal-kernel/portal-kernel.jar
<eclipse_workspace>/portal/portal-service/portal-service.jar
and so on
thumbnail
3067934, modified 17 Years ago. Regular Member Posts: 164 Join Date: 5/11/09 Recent Posts
The locations are all there, except for annotations.jar, which resides in another directory. When I change the buildpath manually, deploying the portlet works. Still do not see, why this is not working from the buildfile, but since it is working now, I will start playing around with portlet coding now.

Many thanks

Regards
Kolja