| 12 | | |
|---|
| 13 | | The goal of this document is to guide the interested newcomer on installing |
|---|
| 14 | | the necessary components to develop modules for the Nuxeo 5 Enterprise Platform. |
|---|
| 15 | | This setup assumes the use of Eclipse as target IDE and JBoss AS as target |
|---|
| 16 | | application server for deployments. |
|---|
| 17 | | |
|---|
| 18 | | This guide was written with Linux as a default operating system but remains |
|---|
| 19 | | appropriate for any other POSIX platform (such as Mac OS X). Minor changes |
|---|
| 20 | | might be required to adapt it on the MS Windows operating system. |
|---|
| 21 | | |
|---|
| 22 | | The reference (up-to-date) version of this document is located at: |
|---|
| 23 | | |
|---|
| 24 | | http://svn.nuxeo.org/nuxeo/doc/nuxeo5-dev-quickstart-howto.txt |
|---|
| 25 | | |
|---|
| 26 | | .. sectnum:: :depth: 2 |
|---|
| 27 | | .. contents:: :depth: 2 |
|---|
| 28 | | |
|---|
| 29 | | Summary |
|---|
| 30 | | ======= |
|---|
| 31 | | |
|---|
| 32 | | To *compile* Nuxeo 5, you will need to install: |
|---|
| 33 | | |
|---|
| 34 | | - Java 5 (latest JDK 1.5.0 from Sun) - not Java 6 |
|---|
| 35 | | |
|---|
| 36 | | - Ant |
|---|
| 37 | | |
|---|
| 38 | | - Maven 2 |
|---|
| 39 | | |
|---|
| 40 | | To *run* Nuxeo 5 EP, you will need: |
|---|
| 41 | | |
|---|
| 42 | | - JBoss AS 4.0.4.GA (**NOT JBoss AS 4.0.5.GA!**) with ejb3 profile |
|---|
| 43 | | |
|---|
| 44 | | To *work on Nuxeo 5 source*, an IDE is recommended: |
|---|
| 45 | | |
|---|
| 46 | | - Eclipse + SVN plugin (like Subclipse or Subversive) |
|---|
| 47 | | + m2eclipse plugin (0.0.10 or later) |
|---|
| 48 | | |
|---|
| 49 | | or: |
|---|
| 50 | | |
|---|
| 51 | | - IDEA (after running "mvn idea:idea" from the command line) |
|---|
| 52 | | |
|---|
| 53 | | or: |
|---|
| 54 | | |
|---|
| 55 | | - Netbeans (not tested) |
|---|
| 56 | | |
|---|
| 57 | | Several other plugins are also recommended for greater efficiency, like |
|---|
| 58 | | the JBossIDE plugin for Eclipse, but not mandatory for building Nuxeo 5. |
|---|
| 59 | | |
|---|
| 60 | | |
|---|
| 61 | | Installing Java 5 |
|---|
| 62 | | ================= |
|---|
| 63 | | |
|---|
| 64 | | Nuxeo 5 uses the latest generation of Java technologies and thus requires a |
|---|
| 65 | | Java 5 VM such as the reference implementation by Sun. |
|---|
| 66 | | |
|---|
| 67 | | IMPORTANT WARNING: Nuxeo 5 doesn't currently compile under Java 6 (the 1.6.0 JDK from Sun). Even if it did, it is not clear that JBoss, the application server we are targeting, works under Java 6. |
|---|
| 68 | | |
|---|
| 69 | | |
|---|
| 70 | | Using package management systems |
|---|
| 71 | | -------------------------------- |
|---|
| 72 | | |
|---|
| 73 | | Some linux distributions now include Java 5 in their official repositories. |
|---|
| 74 | | |
|---|
| 75 | | For instance with Ubuntu (Edgy and later): |
|---|
| 76 | | |
|---|
| 77 | | - enable multiverse (2 lines to uncomment) in your /etc/apt/sources.list |
|---|
| 78 | | - update your package indexes:: |
|---|
| 79 | | |
|---|
| 80 | | $ sudo apt-get update |
|---|
| 81 | | |
|---|
| 82 | | - install the full java5 stack (probably not all is necessary):: |
|---|
| 83 | | |
|---|
| 84 | | $ sudo apt-get install "sun-java5-*" |
|---|
| 85 | | |
|---|
| 86 | | - ensure Java 5 is now the default JVM on your system (instead of gcj and |
|---|
| 87 | | friends by default):: |
|---|
| 88 | | |
|---|
| 89 | | $ sudo update-alternatives --set java /usr/lib/jvm/java-1.5.0-sun/jre/bin/java |
|---|
| 90 | | |
|---|
| 91 | | (TODO: add similar instructions for Fedora Core and Debian) |
|---|
| 92 | | |
|---|
| 93 | | |
|---|
| 94 | | Manual installation |
|---|
| 95 | | ------------------- |
|---|
| 96 | | |
|---|
| 97 | | You can also manually install Java by following the instructions of this page: |
|---|
| 98 | | |
|---|
| 99 | | http://www.java.com/en/download/linux_manual.jsp |
|---|
| 100 | | |
|---|
| 101 | | |
|---|
| 102 | | Setting up JAVA_HOME |
|---|
| 103 | | -------------------- |
|---|
| 104 | | |
|---|
| 105 | | In your .bashrc (or .zshrc, ...) add something like:: |
|---|
| 106 | | |
|---|
| 107 | | export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun |
|---|
| 108 | | |
|---|
| 109 | | This will be required by tools such as Maven (see later). |
|---|
| 110 | | |
|---|
| 111 | | |
|---|
| 112 | | Installing JBoss AS |
|---|
| 113 | | =================== |
|---|
| 114 | | |
|---|
| 115 | | Nuxeo EP default target is the JBoss_ application server with EJB3 support |
|---|
| 116 | | enabled. To enable the EJB3 support, you should install JBoss with the |
|---|
| 117 | | latest version of the `Jems installer`_:: |
|---|
| 118 | | |
|---|
| 119 | | $ sudo java -jar jems-installer-1.2.0.BETA2.jar |
|---|
| 120 | | |
|---|
| 121 | | Note: Nuxeo5 does not work yet with jems-installer-1.2.0.BETA3.jar / JBoss AS 4.0.5 |
|---|
| 122 | | |
|---|
| 123 | | While executing the wizard you must select ejb3 install. You can leave all other |
|---|
| 124 | | parameters to their default values. |
|---|
| 125 | | |
|---|
| 126 | | If you get PermGenSpace errors when running the application: |
|---|
| 127 | | |
|---|
| 128 | | - Linux:: |
|---|
| 129 | | |
|---|
| 130 | | Edit `/opt/jboss/bin/run.conf` and add the following line at the end of |
|---|
| 131 | | the file:: |
|---|
| 132 | | |
|---|
| 133 | | JAVA_OPTS="$JAVA_OPTS -XX:MaxPermSize=128m" |
|---|
| 134 | | |
|---|
| 135 | | Restart JBoss. |
|---|
| 136 | | |
|---|
| 137 | | - Windows:: |
|---|
| 138 | | |
|---|
| 139 | | Edit '$JBOSS/bin/run.bat' and add the following line at the end of |
|---|
| 140 | | the file:: |
|---|
| 141 | | |
|---|
| 142 | | set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=128m |
|---|
| 143 | | |
|---|
| 144 | | Restart JBoss. |
|---|
| 145 | | |
|---|
| 146 | | |
|---|
| 147 | | The default Nuxeo5 build setup expects to find JBoss in |
|---|
| 148 | | `/opt/jboss`. If you choose to install it elsewhere it is recommended |
|---|
| 149 | | to symlink `/opt/jboss` to your jboss installation directory. |
|---|
| 150 | | |
|---|
| 151 | | .. _JBoss: http://www.jboss.org |
|---|
| 152 | | .. _`Jems installer`: http://sourceforge.net/project/showfiles.php?group_id=22866&package_id=193295 |
|---|
| 153 | | |
|---|
| 154 | | |
|---|
| 155 | | Installing a subversion client |
|---|
| 156 | | ============================== |
|---|
| 157 | | |
|---|
| 158 | | |
|---|
| 159 | | Generic subversion clients |
|---|
| 160 | | -------------------------- |
|---|
| 161 | | |
|---|
| 162 | | The Nuxeo 5 source repository is a subversion_ repository thus you |
|---|
| 163 | | will need a subversion client to access the source code. Most linux |
|---|
| 164 | | distributions provide the ``svn`` command line tool. To install it under |
|---|
| 165 | | Ubuntu / Debian:: |
|---|
| 166 | | |
|---|
| 167 | | $ sudo apt-get install subversion |
|---|
| 168 | | |
|---|
| 169 | | Under Fedora Core this should become:: |
|---|
| 170 | | |
|---|
| 171 | | $ yum subversion |
|---|
| 172 | | |
|---|
| 173 | | You can then download the Nuxeo Enterprise Platform complete bundle with the following command:: |
|---|
| 174 | | |
|---|
| 175 | | $ svn checkout http://svn.nuxeo.org/nuxeo/nuxeo-ep/trunk nuxeo-ep |
|---|
| 176 | | |
|---|
| 177 | | You can now check the contents: |
|---|
| 178 | | |
|---|
| 179 | | $ ls nuxeo-ep |
|---|
| 180 | | |
|---|
| 181 | | The official svnbook_ is a very good reference for both beginners and advanced |
|---|
| 182 | | subversion users. |
|---|
| 183 | | |
|---|
| 184 | | You can also browse the repository with any web browser using the trac |
|---|
| 185 | | interface: |
|---|
| 186 | | |
|---|
| 187 | | http://svn.nuxeo.org/trac/nuxeo |
|---|
| 188 | | |
|---|
| 189 | | Under windows the recommended client is TortoiseSVN_. |
|---|
| 190 | | |
|---|
| 191 | | .. _subversion: http://en.wikipedia.org/wiki/Subversion |
|---|
| 192 | | .. _TortoiseSVN: http://tortoisesvn.tigris.org/ |
|---|
| 193 | | .. _svnbook: http://svnbook.red-bean.com/ |
|---|
| 194 | | |
|---|
| 195 | | |
|---|
| 196 | | Installing and using Apache Maven |
|---|
| 197 | | ================================= |
|---|
| 198 | | |
|---|
| 199 | | What is Maven? |
|---|
| 200 | | -------------- |
|---|
| 201 | | |
|---|
| 202 | | Quoting the `Wikipedia entry for Maven`_: |
|---|
| 203 | | |
|---|
| 204 | | Maven is a software tool for Java programming language project |
|---|
| 205 | | management and automated software build. It is similar in functionality |
|---|
| 206 | | to the Apache Ant tool, but has a simpler build configuration model, |
|---|
| 207 | | based on an XML format. Maven is hosted by the Apache Software |
|---|
| 208 | | Foundation, where it was formerly part of the Jakarta Project. |
|---|
| 209 | | |
|---|
| 210 | | Maven uses a construct known as a Project Object Model (POM) to describe |
|---|
| 211 | | the software project being built, its dependencies on other external |
|---|
| 212 | | modules and components, and the build order. It comes with pre-defined |
|---|
| 213 | | targets for performing certain well defined tasks such as compilation |
|---|
| 214 | | of code and its packaging. |
|---|
| 215 | | |
|---|
| 216 | | A key feature of Maven is that it is network-ready. The core engine can |
|---|
| 217 | | dynamically download plugins from a repository, the same repository |
|---|
| 218 | | that provides access to many versions of different Open Source Java |
|---|
| 219 | | projects, from Apache and other organisations and developers. This |
|---|
| 220 | | repository and its reorganized successor the Maven 2 repository are the |
|---|
| 221 | | de facto distribution mechanism for Java applications. Maven provides |
|---|
| 222 | | built in support not just for retrieving files from this repository, |
|---|
| 223 | | but to upload artifacts at the end of the build. A local cache of |
|---|
| 224 | | downloaded artifacts acts as the primary means of synchronizing the |
|---|
| 225 | | output of projects on a local system. |
|---|
| 226 | | |
|---|
| 227 | | .. _`Wikipedia entry for Maven`: http://en.wikipedia.org/wiki/Apache_Maven |
|---|
| 228 | | |
|---|
| 229 | | |
|---|
| 230 | | Nuxeo currently uses maven to manage *build dependencies* both inside eclipse |
|---|
| 231 | | using the m2eclipse plugin (see later) and to build and deploy with ant. |
|---|
| 232 | | |
|---|
| 233 | | In the future maven will be used for the build and deployment step as well |
|---|
| 234 | | instead of ant. |
|---|
| 235 | | |
|---|
| 236 | | Nuxeo holds a maven repository here:: |
|---|
| 237 | | |
|---|
| 238 | | http://svn.nuxeo.org/maven/repo |
|---|
| 239 | | |
|---|
| 240 | | Installing the `felix` plugin |
|---|
| 241 | | ----------------------------- |
|---|
| 242 | | |
|---|
| 243 | | This maven plugin is used to package modules as OSGi_ bundle:: |
|---|
| 244 | | |
|---|
| 245 | | $ svn co http://svn.apache.org/repos/asf/incubator/felix/trunk/tools/maven2/maven-osgi-plugin |
|---|
| 246 | | $ cd maven-osgi-plugin |
|---|
| 247 | | $ mvn clean install |
|---|
| 248 | | |
|---|
| 249 | | .. _OSGi: http://en.wikipedia.org/wiki/Osgi |
|---|
| 250 | | |
|---|
| 251 | | |
|---|
| 252 | | TODO: 2 lines to explain what a Maven repository is and how to setup the |
|---|
| 253 | | jboss-* properties. |
|---|
| 254 | | |
|---|
| 255 | | |
|---|
| 256 | | Fetching the dependencies using the `mvn` command line utility |
|---|
| 257 | | -------------------------------------------------------------- |
|---|
| 258 | | |
|---|
| 259 | | You should then install Maven 2 on your dev box by downloading the latest |
|---|
| 260 | | tarball from http://maven.apache.org/download.html and then untar the archive |
|---|
| 261 | | in ``/opt`` for instance. |
|---|
| 262 | | |
|---|
| 263 | | Then add the ``bin/`` subdir in your PATH by adding something like the |
|---|
| 264 | | following in your ``.bashrc``:: |
|---|
| 265 | | |
|---|
| 266 | | export PATH=/opt/maven-2.0.4/bin:$PATH |
|---|
| 267 | | |
|---|
| 268 | | In a new shell you can then test:: |
|---|
| 269 | | |
|---|
| 270 | | $ mvn --version |
|---|
| 271 | | Maven version: 2.0.4 |
|---|
| 272 | | |
|---|
| 273 | | You can then use it on your Nuxeo EP checkout to download the dependency and launch |
|---|
| 274 | | the unit tests:: |
|---|
| 275 | | |
|---|
| 276 | | $ cd nuxeo-ep |
|---|
| 277 | | $ mvn install |
|---|
| 278 | | |
|---|
| 279 | | |
|---|
| 280 | | Using a command-line Ant |
|---|
| 281 | | ======================== |
|---|
| 282 | | |
|---|
| 283 | | Installing |
|---|
| 284 | | ---------- |
|---|
| 285 | | |
|---|
| 286 | | Download the Ant package from http://ant.apache.org |
|---|
| 287 | | Untar it for example in /opt and have the executable (bin/ant) |
|---|
| 288 | | accessible in your PATH. |
|---|
| 289 | | |
|---|
| 290 | | Deploying |
|---|
| 291 | | --------- |
|---|
| 292 | | |
|---|
| 293 | | From the top of your nuxeo-ep checkout, you must first do a successful |
|---|
| 294 | | maven build (although it's recommended that you don't skip the tests):: |
|---|
| 295 | | |
|---|
| 296 | | $ cd nuxeo-ep |
|---|
| 297 | | $ mvn -Dmaven.test.skip=true install |
|---|
| 298 | | $ ant clean |
|---|
| 299 | | |
|---|
| 300 | | The clean step is required to remove spurious files lef |
|---|
| 301 | | |
|---|
| 302 | | Then you can ask ant to do the deployment:: |
|---|
| 303 | | |
|---|
| 304 | | $ ant deploy |
|---|
| 305 | | |
|---|
| 306 | | You must have write permissions on the default server directory |
|---|
| 307 | | (/opt/jboss/server/default) |
|---|
| 308 | | |
|---|
| 309 | | If ant crashes or stops and doesn't answer ^C anymore, you may need to |
|---|
| 310 | | define the following environment variable:: |
|---|
| 311 | | |
|---|
| 312 | | $ export ANT_OPTS="-XX:MaxPermSize=128m" |
|---|
| 313 | | |
|---|
| 314 | | Once deployed you should be able to run nuxeo with:: |
|---|
| 315 | | |
|---|
| 316 | | $ /opt/jboss/bin/run.sh |
|---|
| 317 | | |
|---|
| 318 | | Or ``run.bat`` under windows. |
|---|
| 319 | | |
|---|
| 320 | | Then test the application by pointing your browser to: |
|---|
| 321 | | |
|---|
| 322 | | http://localhost:8080/nuxeo |
|---|
| 323 | | |
|---|
| 324 | | And use Administrator / Administrator to log in. |
|---|
| 325 | | |
|---|
| 326 | | |
|---|
| 327 | | Running the tests |
|---|
| 328 | | ----------------- |
|---|
| 329 | | |
|---|
| 330 | | In the nuxeo-ep folder:: |
|---|
| 331 | | |
|---|
| 332 | | $ mvn test |
|---|
| 333 | | |
|---|
| 334 | | Note that tests will take some time to complete (5 minutes on a recent laptop), |
|---|
| 335 | | since there are currently 3000 tests and some of them are a bit slow. |
|---|
| 336 | | |
|---|
| 337 | | You can also install it to be able to run specifically on one module:: |
|---|
| 338 | | |
|---|
| 339 | | $ mvn install |
|---|
| 340 | | $ cd org.nuxeo.ecm.core |
|---|
| 341 | | $ mvn test |
|---|
| 342 | | |
|---|
| 343 | | Since you are now running only a subset of all the tests, it will take less |
|---|
| 344 | | time to complete. |
|---|
| 345 | | |
|---|
| 346 | | |
|---|
| 347 | | Installing Eclipse |
|---|
| 348 | | ================== |
|---|
| 349 | | |
|---|
| 350 | | Eclipse is both used as an IDE and a set of base components to build Rich |
|---|
| 351 | | Clients (Eclipse RCP). |
|---|
| 352 | | |
|---|
| 353 | | Some Linux distributions also include Eclipse but the Ubuntu packages |
|---|
| 354 | | I installed tended to be too much gcj oriented thus chose to download |
|---|
| 355 | | the tarball from eclipse.org: |
|---|
| 356 | | |
|---|
| 357 | | http://www.eclipse.org/downloads/ |
|---|
| 358 | | |
|---|
| 359 | | Then untar the archive in /opt for instance and then add a starter script such |
|---|
| 360 | | as the following somewhere in your PATH (eg. /usr/local/bin or ~/bin):: |
|---|
| 361 | | |
|---|
| 362 | | #!/bin/bash |
|---|
| 363 | | |
|---|
| 364 | | CMDLINEARGS="" |
|---|
| 365 | | VMARGS="-Djava.net.preferIPv4Stack=true -Xms256m -Xmx1024m -XX:MaxPermSize=128m" |
|---|
| 366 | | INSTALL="/opt/eclipse" |
|---|
| 367 | | STARTUP="/opt/eclipse/startup.jar" |
|---|
| 368 | | |
|---|
| 369 | | exec ${INSTALL}/eclipse \ |
|---|
| 370 | | -install "${INSTALL}" \ |
|---|
| 371 | | -startup "${STARTUP}" \ |
|---|
| 372 | | ${CMDLINEARGS} \ |
|---|
| 373 | | -vmargs ${VMARGS} |
|---|
| 374 | | |
|---|
| 375 | | Note on the vmargs: |
|---|
| 376 | | |
|---|
| 377 | | - the " -Xms256m -Xmx1024m" options are used to set the memory usage you allow |
|---|
| 378 | | for the JVM used by eclipse (please adjust depending on your hardware) |
|---|
| 379 | | |
|---|
| 380 | | - the "-XX:MaxPermSize=128m" option is Sun specific is used to workaround a |
|---|
| 381 | | `probable memory leak in the Sun JVM`_ (IBM/Jrockit should not be affected |
|---|
| 382 | | by that bug and should not need that option) |
|---|
| 383 | | |
|---|
| 384 | | - the -Djava.net.preferIPv4Stack=true is useful, and sometimes mandatory, under linux to make jgroups work (useful for the cache system) |
|---|
| 385 | | |
|---|
| 386 | | .. _`probable memory leak in the Sun JVM`: http://eclipsezone.com/eclipse/forums/t77021.html |
|---|
| 387 | | |
|---|
| 388 | | Then open a shell and try:: |
|---|
| 389 | | |
|---|
| 390 | | $ eclipse |
|---|
| 391 | | |
|---|
| 392 | | The included tutorials are a good to familiarize your self with eclipse look and |
|---|
| 393 | | feel. |
|---|
| 394 | | |
|---|
| 395 | | The default build setup of Nuxeo 5 assumes that eclipse is installed in |
|---|
| 396 | | `/opt/eclipse`. If this is not the case, add a symlink there pointing to your |
|---|
| 397 | | installation or you will be required to update all the default build configuration |
|---|
| 398 | | files. |
|---|
| 399 | | |
|---|
| 400 | | |
|---|
| 401 | | Eclipse setup |
|---|
| 402 | | ============= |
|---|
| 403 | | |
|---|
| 404 | | You can find useful tips and tools to better setup you eclipse environment in |
|---|
| 405 | | the following folder from the subversion repository:: |
|---|
| 406 | | |
|---|
| 407 | | $ svn co http://svn.nuxeo.org/nuxeo/tools/eclipse-config |
|---|
| 408 | | |
|---|
| 409 | | You should especially look at the following. |
|---|
| 410 | | |
|---|
| 411 | | |
|---|
| 412 | | Subversive plugin |
|---|
| 413 | | ----------------- |
|---|
| 414 | | |
|---|
| 415 | | Subversive_ is an eclipse plugin to manage source code with subversion directly |
|---|
| 416 | | from the eclipse IDE. |
|---|
| 417 | | |
|---|
| 418 | | To install it, add a new remote site for Subversive with the software |
|---|
| 419 | | update manager using the following parameters:: |
|---|
| 420 | | |
|---|
| 421 | | Name: Subversive |
|---|
| 422 | | URL: http://www.polarion.org/projects/subversive/download/1.1/update-site/ |
|---|
| 423 | | |
|---|
| 424 | | This requires a write permission on /opt/eclipse/plugins. |
|---|
| 425 | | |
|---|
| 426 | | If you have never used the software manager before please follow these |
|---|
| 427 | | detailed instructions: |
|---|
| 428 | | |
|---|
| 429 | | http://www.polarion.org/projects/subversive/download/Installation_Instructions.pdf |
|---|
| 430 | | |
|---|
| 431 | | Another subversion plugin named Subclipse_ is also available, although Nuxeo 5 |
|---|
| 432 | | developers tend to recommend subversive instead:: |
|---|
| 433 | | |
|---|
| 434 | | Name: Subclipse |
|---|
| 435 | | URL: http://subclipse.tigris.org/update_1.2.x |
|---|
| 436 | | |
|---|
| 437 | | .. _Subversive: http://www.polarion.org/index.php?page=overview&project=subversive |
|---|
| 438 | | .. _Subclipse: http://subclipse.tigris.org/ |
|---|
| 439 | | |
|---|
| 440 | | |
|---|
| 441 | | Installing the Maven2 eclipse plugin |
|---|
| 442 | | ------------------------------------ |
|---|
| 443 | | |
|---|
| 444 | | As previously, use the Update Manager:: |
|---|
| 445 | | |
|---|
| 446 | | Name: m2eclipse |
|---|
| 447 | | URL: http://m2eclipse.codehaus.org/update/ |
|---|
| 448 | | |
|---|
| 449 | | You will need the most recent version of m2eclipse (0.0.10 at the time of |
|---|
| 450 | | writing this doc). |
|---|
| 451 | | |
|---|
| 452 | | You will now be able to run "mvn install" from inside eclipse by using the |
|---|
| 453 | | right click / "Run as" menu. |
|---|
| 454 | | |
|---|
| 455 | | |
|---|
| 456 | | Setup your Maven2 preferences within Eclipse |
|---|
| 457 | | -------------------------------------------- |
|---|
| 458 | | |
|---|
| 459 | | In Window > Preferences, select the Maven2 tab and set the repository to the |
|---|
| 460 | | one in your personal home folder (e.g. $HOME/.m2/repository). You can select |
|---|
| 461 | | all the options, and let the checksum policy to "warning". Then click on |
|---|
| 462 | | "reindex local repository" and apply changes. |
|---|
| 463 | | |
|---|
| 464 | | |
|---|
| 465 | | Install the AnyEdit Eclipse plugin |
|---|
| 466 | | ---------------------------------- |
|---|
| 467 | | |
|---|
| 468 | | AnyEdit_ is used to replace tabs with spaces and to remove trailing whitespaces. |
|---|
| 469 | | Feed the Update Manager with the following url:: |
|---|
| 470 | | |
|---|
| 471 | | Name: Andrei Loskutov |
|---|
| 472 | | URL: http://andrei.gmxhome.de/eclipse/ |
|---|
| 473 | | |
|---|
| 474 | | On the same site you will also find the JDepend4Eclipse plugin that is also |
|---|
| 475 | | worth installing to automate dependency analysis between packages. |
|---|
| 476 | | |
|---|
| 477 | | Note: apparently AnyEdit_ conflicts with the graphical process editor (JBPM) |
|---|
| 478 | | of the JBossIDE_ plugin. You might want to disable the AnyEdit while working |
|---|
| 479 | | on process definitions. |
|---|
| 480 | | |
|---|
| 481 | | .. _AnyEdit: http://andrei.gmxhome.de/anyedit/ |
|---|
| 482 | | |
|---|
| 483 | | |
|---|
| 484 | | Install the JBossIDE_ eclipse plugin |
|---|
| 485 | | ------------------------------------ |
|---|
| 486 | | |
|---|
| 487 | | This is a plugin to help build applications running on the JBoss_ application |
|---|
| 488 | | server. Quoting from the site, JBossIDE_ features: |
|---|
| 489 | | |
|---|
| 490 | | - EJB 3.0 Project Wizard |
|---|
| 491 | | - Hibernate Tools |
|---|
| 492 | | - Aspect Oriented Programming (AOP) Tools |
|---|
| 493 | | - JBoss jBPM Graphical Process Designer |
|---|
| 494 | | - Wizards to ease and simplify J2EE development |
|---|
| 495 | | - Integrated debugging, monitoring, and lifecycle control of JBoss servers |
|---|
| 496 | | - JSP, HTML, XML, CSS, and Javascript editors with syntax highlighting |
|---|
| 497 | | - Easy configuration and deployment of package archives |
|---|
| 498 | | |
|---|
| 499 | | Note that JBossIDE 2.x is *not* required to work with Nuxeo 5. |
|---|
| 500 | | |
|---|
| 501 | | As usual, here are the references for the Update Manager:: |
|---|
| 502 | | |
|---|
| 503 | | Name: EMF Update Manager Site |
|---|
| 504 | | URL: http://download.eclipse.org/modeling/emf/updates/ |
|---|
| 505 | | |
|---|
| 506 | | NB : This url seems to be dead :http://download.eclipse.org/tools/emf/updates/site.xml |
|---|
| 507 | | |
|---|
| 508 | | |
|---|
| 509 | | Name: JBossIDE |
|---|
| 510 | | URL: http://download.jboss.org/jbosside/updates/development |
|---|
| 511 | | |
|---|
| 512 | | The second site has dependencies on the first one: use the "Select required" |
|---|
| 513 | | to compute the dependencies automatically when selecting JBossIDE. |
|---|
| 514 | | |
|---|
| 515 | | .. _JBossIDE: http://labs.jboss.com/portal/jbosside/ |
|---|
| 516 | | |
|---|
| 517 | | |
|---|
| 518 | | Eclipse configuration |
|---|
| 519 | | --------------------- |
|---|
| 520 | | |
|---|
| 521 | | Import the file ``nuxeo_codetemplates.xml`` into Eclipse:: |
|---|
| 522 | | |
|---|
| 523 | | In menu: Window > Preferences |
|---|
| 524 | | Go to Java > Code Style > Code Templates |
|---|
| 525 | | Click on import and select the ``nuxeo_codetemplates.xml`` file |
|---|
| 526 | | |
|---|
| 527 | | Import the file ``nuxeo_formatter.xml`` into Eclipse:: |
|---|
| 528 | | |
|---|
| 529 | | In menu: Window > Preferences |
|---|
| 530 | | Go to Java > Code Style > Formatter |
|---|
| 531 | | Click on import and select the ``nuxeo_formatter.xml`` file |
|---|
| 532 | | |
|---|
| 533 | | Set the preferences so that other files use spaces (not tabs), and set |
|---|
| 534 | | indenting to 2 spaces instead of 4 for XML-like files (XML files but also |
|---|
| 535 | | build files for instance):: |
|---|
| 536 | | |
|---|
| 537 | | In menu: Window > Preferences |
|---|
| 538 | | Go to General > Editors > AnyEdit Tools |
|---|
| 539 | | Select all useful options (Remove trailing whitespaces, convert tabs to |
|---|
| 540 | | spaces,... in "Auto-Convert" and "Misc. options" tabs) |
|---|
| 541 | | Go to Ant > Editor > Formatter |
|---|
| 542 | | Indent with size 2 and use spaces (no tabs). |
|---|
| 543 | | Go to Web and XML |
|---|
| 544 | | Go through sub directories (CSS files, HTML files, XML files, ...) and |
|---|
| 545 | | select the source related preferences (CSS Source, HTML Source, XML |
|---|
| 546 | | Source,...) |
|---|
| 547 | | Repeat steps to set indenting using 2 spaces. |
|---|
| 548 | | |
|---|
| 549 | | When these settings are set, files can be reformatted easily in Eclipse: in |
|---|
| 550 | | menu, go to Source and select Format. |
|---|
| 551 | | |
|---|
| 552 | | Beware when formatting XHTML files, formatting is not always very legible. |
|---|
| 553 | | |
|---|
| 554 | | |
|---|
| 555 | | Optional Eclipse Plugins |
|---|
| 556 | | ------------------------ |
|---|
| 557 | | |
|---|
| 558 | | Check the "Improving code with Eclipse plugins" article on DeveloperWorks: |
|---|
| 559 | | |
|---|
| 560 | | http://www-128.ibm.com/developerworks/java/library/j-ap01117/ |
|---|
| 561 | | |
|---|
| 562 | | For a tutorial on 5 useful plugins related to code quality (coding standards, |
|---|
| 563 | | code duplication, code coverage, dependency analysis and complexity monitoring). |
|---|
| 564 | | |
|---|
| 565 | | These plugins are useful to keep up with the high standard of quality of the |
|---|
| 566 | | Nuxeo codebase. |
|---|
| 567 | | |
|---|
| 568 | | |
|---|
| 569 | | Load / checkout the org.nuxeo.* projects into eclipse |
|---|
| 570 | | ===================================================== |
|---|
| 571 | | |
|---|
| 572 | | First create a new workspace make it point to the ``nuxeo-ep`` folder on you |
|---|
| 573 | | file system where you checked out the nuxeo source code:: |
|---|
| 574 | | |
|---|
| 575 | | File > Switch workspace > Other... |
|---|
| 576 | | |
|---|
| 577 | | Then register the nuxeo svn repository with subversive by going to the SVN |
|---|
| 578 | | repository perspective:: |
|---|
| 579 | | |
|---|
| 580 | | Help > Open perspective > Other... > SVN repository exploring |
|---|
| 581 | | |
|---|
| 582 | | The register the nuxeo repository with the following URL: |
|---|
| 583 | | |
|---|
| 584 | | https://svn.nuxeo.org/nuxeo |
|---|
| 585 | | |
|---|
| 586 | | Then go back to the Java perspective and import the projects you have previously |
|---|
| 587 | | checked out as eclipse projects:: |
|---|
| 588 | | |
|---|
| 589 | | File > Import > General > Existing Projects Into Workspace |
|---|
| 590 | | |
|---|
| 591 | | This method is useful if you do not want to manage SVN through Eclipse, |
|---|
| 592 | | would like to have a checkout of the bundle, and would like to run tests |
|---|
| 593 | | using Maven within it (see below). |
|---|
| 594 | | |
|---|
| 595 | | Subversive should automatically reconnect all the projects to the SVN. |
|---|
| 596 | | |
|---|
| 597 | | Then it is recommended to:: |
|---|
| 598 | | |
|---|
| 599 | | Project > Clean ... > Clean on all projects |
|---|
| 600 | | |
|---|
| 601 | | |
|---|
| 602 | | Deploying from eclipse |
|---|
| 603 | | ====================== |
|---|
| 604 | | |
|---|
| 605 | | Once all the org.nuxeo.* projects build correctly in eclipse, you can deploy them on |
|---|
| 606 | | your JBoss instance directly from the IDE. |
|---|
| 607 | | |
|---|
| 608 | | In eclipse, add the ant view:: |
|---|
| 609 | | |
|---|
| 610 | | Window > Show View > Ant |
|---|
| 611 | | |
|---|
| 612 | | Then drag and drop the ``build.xml`` of the ``org.nuxeo.ecm.webapp`` to the ant view |
|---|
| 613 | | and then trigger the following target named ``deploy-ecm-all``. |
|---|
| 614 | | |
|---|
| 615 | | (Re)-start JBoss:: |
|---|
| 616 | | |
|---|
| 617 | | /opt/jboss/bin/run.sh |
|---|
| 618 | | |
|---|
| 619 | | If all went well, you should be able to access the application at: |
|---|
| 620 | | |
|---|
| 621 | | http://localhost:8080/nuxeo |
|---|
| 622 | | |
|---|
| 623 | | Login with user name: Administrator (password: Administrator) |
|---|
| 624 | | |
|---|
| 625 | | |
|---|
| 626 | | Remote debugging in eclipse |
|---|
| 627 | | =========================== |
|---|
| 628 | | |
|---|
| 629 | | Use case: suppose you just deployed Nuxeo 5 on your JBoss server and run into |
|---|
| 630 | | a new crash or any unexpected behavior. Instead of stopping the server and |
|---|
| 631 | | rerunning inside eclipse to reproduce the bug in the debugger, you can setup |
|---|
| 632 | | a new remote debugging profile for eclipse. |
|---|
| 633 | | |
|---|
| 634 | | - Linux:: |
|---|
| 635 | | |
|---|
| 636 | | First edit `/opt/jboss/bin/run.conf` and add the following line at the |
|---|
| 637 | | end of the file:: |
|---|
| 638 | | |
|---|
| 639 | | JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n" |
|---|
| 640 | | |
|---|
| 641 | | Restart JBoss. |
|---|
| 642 | | |
|---|
| 643 | | - Windows:: |
|---|
| 644 | | |
|---|
| 645 | | Edit '$JBOSS/bin/run.bat' and modify the line: |
|---|
| 646 | | |
|---|
| 647 | | rem set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y %JAVA_OPTS% |
|---|
| 648 | | |
|---|
| 649 | | by erasing the remark ('rem'), and disabling the suspend ('suspend=n'). |
|---|
| 650 | | |
|---|
| 651 | | You should have:: |
|---|
| 652 | | |
|---|
| 653 | | set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n %JAVA_OPTS% |
|---|
| 654 | | |
|---|
| 655 | | Restart JBoss. |
|---|
| 656 | | |
|---|
| 657 | | Then from eclipse create a new debugger profile in menu: `Run > Debug ...` |
|---|
| 658 | | create a new `Remote Java Application` profile and set the source to the filesystem |
|---|
| 659 | | directory that host your complete eclipse workspace and set the port to `8787`. |
|---|
| 660 | | |
|---|
| 661 | | Then edit the offending source code file and set breakpoints and run your |
|---|
| 662 | | new remote debug profile. From your web browser, refresh the page that was |
|---|
| 663 | | crashing and look back into eclipse: the debug perspective should open |
|---|
| 664 | | automatically at your fist breakpoint. |
|---|
| 665 | | |
|---|
| 666 | | |
|---|
| 667 | | |
|---|
| 668 | | |
|---|
| 669 | | Getting to understand the Nuxeo 5 architecture |
|---|
| 670 | | ============================================== |
|---|
| 671 | | |
|---|
| 672 | | The ``/doc/`` folder as some interesting pieces of architectural overview such |
|---|
| 673 | | as following document: |
|---|
| 674 | | |
|---|
| 675 | | https://svn.nuxeo.org/nuxeo/doc/Nuxeo-EP-5-Technical-Overview-1.0.odt |
|---|
| 676 | | |
|---|
| 677 | | Some important modules such as NXCore also have their own ``doc/`` subfolder: |
|---|
| 678 | | |
|---|
| 679 | | https://svn.nuxeo.org/nuxeo/nuxeo-ep/trunk/org.nuxeo.ecm.core.repository/doc |
|---|
| 680 | | |
|---|
| 681 | | The wiki gathers pointers to the main tutorials and documentation: |
|---|
| 682 | | |
|---|
| 683 | | http://svn.nuxeo.org/trac/nuxeo |
|---|
| 684 | | |
|---|
| 685 | | You can also browse the API with javadoc on the maven site. |
|---|
| 686 | | |
|---|
| 687 | | http://maven.nuxeo.org/apidocs/ |
|---|
| 688 | | |
|---|