Chapter 2. Configuring Your Development Environment [DRAFT]

Table of Contents

2.1. This is a DRAFT! Give your opinion!
2.2. A brief glance at the road ahead
2.3. Development environment philosophy and assumptions
2.4. Versions
2.5. Verifying your installations and versions
2.5.1. Verifying Nuxeo EP Server
2.5.2. Verifying Eclipse

Objective: To insure that you have all the tools you need for Nuxeo development, with all the correct versions of each.

O Marvelous! what new configuration will come next? I am bewildered with multiplicity.” --William Carlos Williams, American poet (1883-1963)

2.1. This is a DRAFT! Give your opinion!

If you have any comments, questions, or general-purpose harassment you would like give us about this book, then please use the comment form at the bottom of each page! We promise that we will try to incorporate any feedback you give (minus the profanity, of course), will respond to your questions, and credit you appropriately.

2.2. A brief glance at the road ahead

Through the lessons in this book, we (or more specifically you) will develop the notion of an Upcoming Event. An upcoming event is something that occurs at a definite moment in time, like Tuesday at 7:30pm, has a definite purpose such as political meeting or a concert. These typically have what we term a presenter, such as the band performing at the concert or the political organization hosting the meeting. When we say presenter we do not mean a single person who is the leader of the meeting, such as Kurt Cobain (correct presenter: Nirvana) or Barack Obama (the Democratic Party), unless that is the sole person who is "presenting" the event, such as book reading by a sole author. Over the course of the lessons, the notion of what the "content is" for an Upcoming Event will change as you learn more about ECM systems. For now, you can think of a scanned invitation or ticket as the content that is to be "managed" for an Upcoming Event.

We have chosen Upcoming Events as the organizing, pedagogical tool of this book because they are broadly useful in many domains and complex enough that we can use them to facilitate explanation of a number of ECM concepts. When you have completed all the lessons in this book, you will have built a number of different tools that can create, edit, modify, and delete Upcoming Events in the context of an Enterprise Content Management system. You will have extended the notion of an Upcoming Event in a number of ways, for example associating multiple documents with single upcoming event, and allowed access sets of upcoming events in both a traditional ECM setting and in a custom presentation.

Please try to bear with us in the first few lessons, despite their lack of discussion of upcoming events, as these are necessary preparations for your journey on the road ahead.

2.3. Development environment philosophy and assumptions

Development environments are a personal preference and one that most software developers take seriously. The debates about the merits of various development environments-even within a community such as Java-are both frequent and heated. Given that a development environment is the primary tool that any software developer uses to do his or her work, the passions around these tools is understandable. However, book authors-and to some extent system builders-are forced to make choices in order to simplify the problems that they must solve. Writing a book such as this-or developing a tool the size of the Nuxeo platform-is difficult enough without compounding the problem of considering every possible development environment and configuration of said environment. For this reason, this book assumes the following about the tools that you are using to develop applications built on the Nuxeo platform:

  • Eclipse for text editing and "interactive" development tasks such as running tests and debugging

  • Maven for "batch" development tasks such as building aggregate files like jar files for deployment to a server

  • A "unixish" shell (command line processor) for doing miscellaneous file operations like checking file creation times or looking at the contents of log files

  • Subversion (or just the command's name, svn) for remote access to files used in this book

If the setup above is not the one you prefer, it is probably best to work through the lessons of this book using the tools described here and after you are comfortable with the concepts adapt these examples to your tool set. There are two reasons for this: First, and foremost, it allows you to make faster progress on the "greased path" than if you are forced to spend significant time to "adapt" each example to the tools of your choice as you go. Second, Nuxeo has a number of different layers to it and during earlier parts of the book, many things are elided for reasons of easy exposition. If you try to port an earlier lesson to your tools before you have finished all the lessons, you may be unaware of important issues that were ignored for clarity-making the porting all the more difficult.

If you are using a Microsoft-based operating system, you will not have a "unixish" shell installed on your machine by default. We recommend using Cygwin, which is available from http://cygwin.org. Many of the examples in this book were developed with Cygwin.

2.4. Versions

The Nuxeo platform itself, many software subsystems it depends on, and the development tools used as you work through these lessons are all open source software. There is a tradition within the open source community of frequent updates to fix problems and distribution via the Internet, inevitably leading to distress among book writers as the readers are likely to be using at least somewhat different software than was used to write the book. To mitigate this problem somewhat, this book follows the classical strategy of trying to keep a stable "base" of expectations about the tools readers will use to work through the examples. For this book's lessons, you should use:

Tool VersionAvailable From 
Nuxeo EP5.2M4 probably 5.2GAhttp://www.nuxeo.org/sections/downloads/
Eclipse3.4 (also known as Eclipse Ganymede)http://www.eclipse.org/downloads/
Subversion (also known as svn)1.5 or greaterhttp://www.collab.net/downloads/subversion/
Maven (also known as mvn)2.0.9 or greaterhttp://maven.apache.org/download.html
Java Standard Edition Development Kit1.5 should test for 1.6http://java.sun.com/javase/downloads/index.jsp

Table 2.1. Versions Of Tools Expected For Developers Following These Lessons


For the command shell, referred to above, almost any unix-like shell should work adequately; the authors use bash, version 3+ if you are concerned with being exactly compatible.

Note

Readers that have already familiarized themselves with Nuxeo will observe that Nuxeo has a number of different version numbers associated with various parts of the platform. For example, the Nuxeo "core" and "runtime" subsystems are at version 1.5, whereas the Nuxeo "webengine" subsystem is listed as version 1.0. These distinctions are typically only important for developers that are working on the platform itself or writing tools (or books) for others. The readers of this book are using the platform as provided, so we will follow the custom of naming the Nuxeo version by the name of the release of the Nuxeo EP server; the distribution of the Nuxeo EP server includes compatible versions of all the subsystems it requires, so the detailed versions of these subsystems can be safely ignored for now.

2.5. Verifying your installations and versions

We will assume in this book that all of the files related to these lessons are kept in the directory /nuxeo. Further, we will assume that you have installed the tools described above in /nuxeo/tools if they did not come already installed on your system. In this book, our convention is to use this font for file names or file-system paths, this font for commands you type and text like this for

output you should see

Let's begin by making sure that the base for all the software will use, Sun Microsystem's Java Development Kit, is installed properly. You should be able to do a command like this:

iansmith@Photo /nuxeo 
$ java -version 
java version "1.5.0_17" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_17-b04) 
Java HotSpot(TM) Client VM (build 1.5.0_17-b04, mixed mode, sharing) 

Warning

Be careful that you don't just have a copy of the Java Runtime Environment environment installed! You will need the extra tools that come with Java Development Kit, usually called the JDK as opposed the former, usually referred to as the JRE. Most people who have only the JRE installed do not have tools like jar, so you can test for the JDK with something like this:

iansmith@Photo /nuxeo 
$ which jar 
/cygdrive/c/Program Files/Java/jdk1.5.0_17/bin/jar

Note

If you are unfamiliar with it, the Unix command which checks that you have a program in your PATH and displays in what directory the command resides. You can see from the output above the "jdk" that is the name of the directory that contains jar.

You should continue by verifying that you have correctly installed maven. Maven must also be in your PATH environment variable so that it can be found from the shell, like this:

iansmith@Photo /nuxeo 
$ mvn --version 
Maven version: 2.0.9 
Java version: 1.5.0_17 
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows" 

Continue verifying that your command line tools are correct by checking subversion.

iansmith@Photo /nuxeo
$ svn --version

svn, version 1.5.5 (r34862)
   compiled Dec 23 2008, 10:46:29

... more information... 

2.5.1. Verifying Nuxeo EP Server

We will assume that you have already downloaded the Nuxeo EP server and used the installer to install it in /nuxeo/tools/NuxeoEP5. To make sure that you have installed everything correctly:

iansmith@Photo /nuxeo
$ cd tools/NuxeoEP5/NuxeoServer
iansmith@Photo /nuxeo/tools/NuxeoEP5/NuxeoServer
$ ls
InstallConfigRecord.xml          Uninstaller  docs         scripts
InstallSummary.html              bin          lib          server
PUT_HERE_Nuxeo_JBoss_Server.txt  client       readme.html

You can start the sever using one of the launching programs in the bin directory such as run.sh.

iansmith@Photo /nuxeo/tools/NuxeoEP5/NuxeoServer
$ cd bin

iansmith@Photo /nuxeo/tools/NuxeoEP5/NuxeoServer/bin
$ ./run.sh

.... lots of output as server starts up ....

After the server has started (perhaps in 1 minute), you can use your web browser to visit the URL http://localhost:8080/nuxeo to see the output of your server running on your local machine, "localhost" as is shown here:

If you return to the window where you launched the server with ./run.sh you will notice even more output as the Nuxeo server reports on its activities. To stop the running Nuxeo server you can either hit control-c in the window where you started the server, or you can use another shell window and one of the programs in the bin directory such as shutdown.sh.

2.5.2. Verifying Eclipse

Normally, you use your machine's file browser to navigate to the directory where eclipse was installed. We have assumed you installed this tool into /nuxeo/tools/eclipse, so you should be able to start the eclipse application from this directory by clicking on the program launcher icon. You should see a splash screen like this one:

Note

Many heavy users of eclipse have found that the amount of memory allocated to Eclipse by default is insufficient. This causes occasional errors and eclipse reports that it is out of memory or resources. If you would like, you can increase the amount of stack (-Xms) and heap (-Xmx) memory allocated to eclipse when it starts by changing the eclipse.ini file found in the root of your eclipse installation. By default, it will look something like this:

-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256M
-framework
plugins\org.eclipse.osgi_3.4.2.R34x_v20080826-1230.jar
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx256m

The last two lines can be changed to increase the amount of stack and heap memory; they must be written on two separate lines as shown. The authors suggest changing the last two lines to be

-Xms60m
-Xmx512m