Development Environment

These instructions are for an older version of LAMS
The latest version is: LAMS 3.0.1 (see Git)



The following development is suggested for building and running LAMS 2.4+ Some of the software, such as Jboss, is required. Others, like the IDE is recommended but not required - you can use another program in its place.

Suggested locations are given for Windows installations. Using the suggested locations will reduce the number of changes needed in the configuration files. We suggest installing them in this order. You can swap around JBOSS, MySQL if you want.

Apache Ant

Required? Yes
Version 1.7+
Source Your IDE or Download now
Comments Include two environment variables ANT_OPTS and ANT_HOME. (see video for details)

Installing Apache Ant

Java 6 JDK

Note that you will need Java's JDK, not just the JRE.

Required? Yes
Version: Java 6
Source
See Installing Java

You can download the JDK from here

Installing Java 6 JDK

JBoss 5.1

Required? Yes
Version: 5.1 GA
Suggested Location Windows: D:\ unix: /usr/local/
Source Download from here

Installing JBoss 5.1

MySQL

Required? Yes
Version: 5.x
Source See Installing MySQL

Installying MySQL

Optionals

MySQL Administrator

Required? No. If you are happy using the MySQL command line utility or if you have another database GUI manager program for MySQL (e.g. DBManager Professional)  you don't need the Administrator program. But if you are new to MySQL we recommend you download this utility. Our instructions for configuring the database use this utility.
Version: 1.1
Suggested Location (Windows) C:\Program Files\MySQL
Source http://www.mysql.com    http://dev.mysql.com/downloads/administrator/1.1.html


Eclipse

Required?
No if all you want to do is build LAMS. Handy in other caes (see the comments below).
Version: 3.6+
Suggested Location (Windows) D:\eclipse
Source http://www.eclipse.org
Comments
If you want to explore the code or do some development then Eclipse may be useful. If you want want to view/update the database schema diagrams (as you need it for Clay) or you want the convenience of using our build files and our configuration instructions, then use Eclipse. If you want to use another IDE (or a text editor and ANT) and are prepared to do all the setup for your IDE, then you don't need Eclipse.

JUnit

Required? No. It is only used if you want to run the LAMS JUnit test cases. If you don't know what JUnit is or what we mean by test cases, then you don't need JUnit.
Version 3.8.1
Source Your IDE or http://www.junit.org/
Comments Version built into Eclipse/MyEclipse is fine. If you don't have Eclipse or another Java development environment with JUnit you can download it from the JUnit website.

Help!

Configuring Eclipse JDKs and JDK Version Compliance

This assumes that you are using Eclipse.

  • Go to the menu and select Window -> Preferences.
  • Preferences window comes up.
  • Open Java section, select installed JREs. It will default to your Java runtime (JRE) usually. You need to set up your JDK.
  • Click "Add" button.
  • An "Add JRA" window comes up. Make the name JDK 6 (or similar) and point the home directory to the JDK you installed e.g. C:\Program Files\Java\jdk1.6
  • Leave the JRE type as standard.
  • Click okay to close the window and go back to the list of Installed JREs.
  • Change the little tick box so that the JDK 6 is ticked, not the JRE, then click okay to close the preferences window.
  • Select Java -> Compiler.
  • Change "Compiler Compliance Level" to 6.0.
  • Leave "default compliance settings" and all the classfile generation options turned on.

Configuring Eclipse code formatter and clean up

LAMS developers are using common Java source code formatting and clean up configuration. It allows focusing on meaningful changes when comparing and commiting Java files. These configurations basically follow the default settings with slight changes that LAMS development team found useful.

  • Download formatter configuration and clean up configuration.
  • Go to the menu and select Window -> Preferences.
  • Preferences window comes up.
  • Select Java -> Code Style.
  • Select Formatter, click "Import..." button and choose the downloaded formatter configuration file.
  • Select Clean Up, click "Import..." button and choose the downloaded clean up configuration file.

Configuring Code Templates

When you set up the software, please configure your IDE to insert the correct license and CVS keyword statements automatically.

Eclipse: Installing Web Development Support, and how to run JBoss

If you are running Eclipse, this is how you can run JBOSS from within Eclipse. This section assumes that you have JBOSS already installed and Eclipse is running the JDK is configured.

Part 1: Install the  "Web Standard Tools" and "J2EE Standard Tools"

  • Go to the Help menu and select Software Updates, Find and Install
  • On the dialog box that pops up, select "Search for new features to install" and click "Next"
  • Click the Europa or Callisto Discovery Site checkbox and click "Finish"
  • This should bring you back a list including "C and C++ Development", "Java Development", "Web and J2EE Development".
  • Open "Web and J2EE Development" and select "Web Standard Tools" and "J2EE Standard Tools". Click on "Select Required" and the other needed items will be selected for you.
  • When you are ready, Click "next" and go through the screens to install these features.
  • Allow the installer to restart Eclipse if it needs to do this.
  • When it is all installed, follow the same process but this time select the option to "Search of updates" rather than get new features. This should ensure you have the latest copy of the installed products.

Part 2: Add JBOSS

  • Once "Web Standard Tools" and "J2EE Standard Tools" are installed, go to Preferences->Server->Installed Runtimes.
  • Click the Add button and select JBoss 4.0.2 from the type of Servers which Eclipse supports.
  • In the next dialog, choose JRE (you must have chosen a JDK for this as described earlier) and Browse to the server's root directory.
  • Click finished. Now the Server can be accessed from various parts of Eclipse.

Part 3: Configure JBoss

  • Go to your Project perspective.
  • From the Menu, select Window->Show View->Other...->Server.
  • Expand the Server and click Servers.
  • A new tab called Servers should be added in the Console pane of the Project Window.
  • Right click mouse inside the Servers panel to get a popup menu "New" and select "Server".
  • New Server dialogd opens.
  • click open JBoss and select JBoss v4.0 and click Next.
    • If you skipped Part 2 above, you will be asked to do it here now.
    • Or using the Installed Runtimes button, you can create more servers or toggle between servers.
  • Leave the port, host IP, JNDI port, servier config (dafelut) as they are and click Next.
  • Skip the next dialog asking what Project to add (just click Fiish). Do not set up any projects on the server.
  • You should now have an entry for JBoss v4.0 on the server tab.
    • There is also a new Project called Servers in Eclipse now.
  • Start JBoss by right mouse clicking on the JBoss v4.0 and selecting start.

One advantage of this method of starting JBOSS from Eclipse (over the older MyEclipse method) is that you can now have more than one 4.0.x version of JBOSS configured on your PC and be able to switch between versions easily. This won't affect many developers but it is handy when we are trying out other versions of JBOSS.

Configuring the J2EE libraries on the Build Path in Eclipse

If you are working on the LAMS code, you should set up the j2ee libraries on the project's the build path. This is useful for code completion and syntax checking. It doesn't need to be done if you are only using Eclipse to build and run LAMS.

  • Go to the preference dialogue.
  • Select java -> build path -> classpath variables
  • Select "New" to add a new variable entry
  • In the "Name" text field, type "JBOSS_HOME"
  • Select "Folder" to locate your jboss folder
  • Select OK and close the preference dialogue.

Using 3rd party libraries source code

During development it is sometimes useful to have access to source code of third party libraries used by LAMS, for example Hibernate, Struts, Spring etc.
Source code for some of these libraries is available in "3rdParty_sources" project in LAMS CVS. Downloading of this project is optional - LAMS will build anyway.
Class paths of LAMS subprojects are already set to look up sources from this additional project. To start using this project:

  • download 3rdParty_sources project from CVS the same way as other LAMS subprojects (lams_build, lams_common etc.)
  • add 3rdParty_sources project to the workspace in Eclipse
  • in Eclipse create a classpath variable "3RDPARTY_SOURCES_PROJECT" pointing to 3rdParty_sources project directory; the variable can be created the same way as JBOSS_HOME described above
  • you should have now access to source code of third party libraries

Read versions.txt inside the project to see what libraries versions it contains.

Labels

dev dev Delete
environment environment Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.