= Using Eclipse with SCDB = [[TracNav]] [[TOC(inline)]] Eclipse is an open source, multi-platform IDE (Integrated Development Environment) written in Java that provides a file browser, an editor, a SVN client, access to compilers and lot of other tools. It is neither part of SCDB, nor a requirement to use SCDB. When used with SCDB, it brings a graphical interface for administering SCDB and editing templates. With very few customizations, Eclipse can be used to edit templates, compile them, and deploy machine profiles while taking advantage of all the advanced features you find in Eclipse: local history, file browsing and searching, ability to open a template directly at the line causing an error, and others. Instructions in this page explain how to customize Eclipse for SCDB. This is not an introduction to Eclipse usage itself. Refer to online documentation in Eclipse. Configuration described here has already been tested on Linux, MacOS, and Windows but should work on any other platforms as all components used are pure Java. == Installation == === Installing Eclipse === Eclipse can be downloaded from http://www.eclipse.org. The site provides pre-built distributions for Windows, Linux, and MacOSX making installation trivial. Recent versions of Eclipse offer several different pre-configured versions. For SCDB, the "Eclipse Classic" is the most appropriate. Before being able to run Eclipse, you need to install Java JRE or JDK on your machine. SCDB requires Java 1.5 or later. You need to check on Eclipse site minimum Java version required by Eclipse. As of Eclipse 3.2, it was lower than SCDB. If you have several Java JREs or JDKs installed on your machine, run Eclipse, goto Preferences->Java (in `Window` menu) and check the version used by Eclipse matches both Eclipse and SCDB requirements. ''Note : Java JDK is required only for some advanced operations like generating new OS templates. Java JRE is enough for daily administration of SCDB.'' === Installating Eclipse plugins === For Eclipse to work with SCDB, some additional software, called plugins, needs to be installed. To do this, run Eclipse and use `Software Updates->Find and Install...->Search for New Features to Install -> Next` in `Help` menu. Then add a `new remote site` for each of the following plugins : * Subclipse : used to interact with a SVN client. (To avoid dependency problems, deselect Mylar integration unless Mylar is installed in your version of Eclipse.) * Download URL : http://subclipse.tigris.org/update_1.2.x. * JavaSVN (SVNKit) : pure Java SVN client, providing both Java classes and a set of command line utilities compatible with SVN line mode client (command `jsvn`). * Download URL : http://tmate.org/svn/. * Sunshade : used for error linking between console and editor (useful for opening templates where an error occurred) * Download URL : http://sunshade.sourceforge.net/update. * Colorer (optional): used for syntax coloring in templates. * Download URL : http://colorer.sf.net/eclipsecolorer/. After adding each site, select them and click on `Finish` button. == Configuration == === File Encoding === You are encouraged to change the default encoding for the files that eclipse creates. * To do so, go to `Window -> Preferences -> General -> Workspace`, and change the Text file encoding to something that's supported on the nodes managed by quattor (iso8859-1 ?). * Also, you'll probably want to use UNIX newline styles, which you can choose in `New text file line delimiter` === SVNKit === The default SVN interface chosen by Subclipse is `JavaHL (JNI)`. This needs to be changed to SVNKit. * To do so goto `Window -> Preferences -> Team -> SVN` and select `SVNKit (Pure Java)` in `SVN Interface`. Then press `Apply` and `OK`. * This might prompt an error message saying `Failed to load JavaHL library`. This can be ignored by pressing `OK`. === Colorer === Colorer is used to do syntax coloring when editing PAN templates. Syntax coloring rules are defined in a file `pan.hrc` that can be downloaded from Quattor CVS (in [http://isscvs.cern.ch:8180/cgi-bin/cvsweb.cgi/elfms/quattor/util/eclipse/pan.hrc?cvsroot=elfms elfms/Quattor/utils/eclipse]). This file must be placed in `/path/to/eclipse/plugins/net.sf.colorer_VERSION/colorer/hrc/auto`. Then an entry for these syntax colouring rules must be added to `/path/to/eclipse/plugins/net.sf.colorer_VERSION/colorer/catalog.xml`. This is done by editing this file and adding the following line to the hrc-sets: Last, add an association between `.tpl` file extension and Colorer Editor. To do this, go to Window->Preferences->General->Editors->File Associations, add .tpl and associate the Colorer Editor with it. For the new Colorer configuration to be taken into account, you need to restart Eclipse. === Sunshade === If you have Sunshade installed inside eclipse, then you can hyperlink between errors generated by the pan compiler and the file. To do this you need to add some regular expressions to the Sunshade "Error Link" configuration. Open the Eclipse options panel (using Window->Preferences) and then navigate to the "Sunshade" and then "Error Link" pages. On this page add the following regular expressions: {{{ \[panc\]\s*DEPRECATED:\s+(.*)\s+\[(\d+):(\d+)\] \[([^\[\]]+\.tpl)(?::(\d+)\.(\d+)-\d+\.\d+)\] }}} The links identified with these expressions will take you to the start of the expression causing the error. Note that the error messages give you the full range of the expression in the format "beginLine.beginChar-endLine.endChar". ''Note : The regexp above are intended for panc v7 and later. If you are still using panc v6 or before, you need to use a different set of regular expressions. Both can coexist.'' {{{ \[pan-syntax\]\s*(.*\.tpl):(\d+): \[pan-compile\]\s*(.*\.tpl):(\d+) \[pan-syntax\].*[\s\(](.*\.tpl) }}} === JavaSVN and certificates === When using JavaSVN in combination with certificates, you must add the password in the ~/.subversion/servers file. Make sure that this file has correct access rights (as it contains cleartext password, it must have mode 400). A full example looks like : {{{ [groups] somegroup = some.full.host, *.some.domain [somegroup] ssl-client-cert-file = /bla/bla/bla.p12 ssl-client-cert-password=hahahahaha [global] ssl-authority-files = /bla/bla/bla/ca_local.crt }}} === Configuring Java VM for Ant === Be sure to read instructions about [wiki:Doc/compiler/running running PAN compiler] if you experiment any strange behaviour or slowness. This is recommended to run SCDB Ant tasks in a dedicated Java VM. You can check the current setting by right-clicking on the `build.xml` file in ant pane and choosing `Run As...->External Tools` and then clicking on `JRE` tab. == Known Problems == === WARNING: missing modifyThread permission === Look at PAN compiler [wiki:Doc/compiler/problems#WARNING:missingmodifyThreadpermission FAQ]. Short summary : use Java 1.6 and configure Eclipse to use it (`Windows->Preferences->Jave->Installed JREs`).