Set up your development environment with eclipse 3.3 JEE edition
What we want to do
- Set up Lenya 2.0 into eclipse 3.3 JEE edition and run it into eclipse
- In order to do this install, we have to 0) build Cocoon and Lenya sources 1) put cocoon into eclipse, 2) put lenya and 3) run Lenya
http://wiki.apache.org/lenya/HowToLenyaInEclipse (others sections of this page)
Set up your build directory
download the Lenya 2.0 source code (http://lenya.apache.org/#download)
- Create this directory layout :
trunk/ -> LENYA_HOME
BRANCH_2_1_X/ -> COCOON_HOME
- You don't need to set these environment variables, I only use them in this tutorial.
- In the folder BRANCH_2_1_X copy cocoon's files that are ships with Lenya (folder lenya/extern)
- The apache directory will come in handy when you start serious development, because you're likely to peek into the source code of other ASF projects like Excalibur or Xalan.
Build cocoon and put it into eclipse
- go to your $COCOON_HOME directory
- copy-paste block.properties and rename the copy into local.block.properties
- edit local.block.properties : replace include.block.jcr=false by include.block.jcr = true
- Go to the $COCOON_HOME directory and execute : ./build.sh eclipse-project
- Run eclipse
- create a new “Java project”
- give a name and select under “content”, “create project from existing source”, select you $COCOON_HOME directory and clic finish
- edit the Java Build Path properties of your Cocoon project and select all libraries on the Order and Export tab
- You will have some errors related to “Jackrabit”
download the jcr.zip here http://day.com/maven/jsr170/distributions/
- unzip this and paste this lib into $COCOON_HOME/lib/optional and add this into the eclipse's build path
Build Lenya and put it into eclipse
- Edit $LENYA_HOME/local.build.properties and set the property cocoon.src.dir to the path of your $COCOON_HOME directory. When you use the suggested directory structure, this would be ../../cocoon/branches/BRANCH_2_1_X. (you just have to uncomment fist line and comment the second)
- Go to the $LENYA_HOME directory and execute : ./build.sh eclipse-project
- Create a new “Java project”in eclipse
- give a name and select under “content”, “create project from existing source”, select you $LENYA_HOME directory and clic finish
- In the Preferences pane, you have to configure the Java compiler to use the 1.4 compliance level : unselect “use default compliance level” and set “generated .class files compatibility” and “source compatibility” to 1.4
Run Lenya into eclipse
- coming soon ...
- There are a number of ways to set up Apache Lenya in Eclipse, but the most straightforward (and likely to work) way is to use Eclipse for developing and Ant in command line mode for building your project (and optionally your Subversion client to check out/update your project if you're working with the Subversion source).
- Download and install Lenya and Cocoon
as described in the Lenya homepage (http://lenya.apache.org/1_2_x/installation/index.html and http://lenya.apache.org/1_4/installation/source_version.html for 2.0).
- Build the Eclipse-project files with Ant
- Open a command line, move to the directory where you installed Cocoon, and type "ant eclipse-project". This will build the files that eclipse need to recognise it as a project.
- Move to the directory where you installed Lenya, and type "ant eclipse-project".
- Start Eclipse
- optionally create a new workspace where you'll put Lenya.
- In menu project, unselect build automatically
In menu file, select import...>existing project into workspace and next.
- Click on "browse" and select the directory where you installed Cocoon. Then click on Finish.
- Eclipse should have found the project called Cocoon. Click on "Finish" button.
Do the same for Lenya: In menu file, select import...>existing project into workspace and next.
- Click on "browse" and select the directory where you installed Lenya. Then click on Finish.
- Eclipse should have found the project called Lenya. Click on "Finish" button.
- That's it. Enjoy Eclipse and Lenya.
- From here:
- To build Lenya, go back to that command line, and type "build.bat" or "./build.sh" on linux.
- To run Lenya, go back again to that command line, and type "lenya.bat servlet" or "./lenya.sh servlet" on linux.
- To update Lenya (if you downloaded it from SVN), use your SVN client
Also check out the instructions over at the Cocoon wiki