Using Eclipse for OPA Development¶
Prerequisites:¶
- Java 6 JDK (IcedTea is ideal, the one from Sun Microsystems should also work)
- Eclipse 3.4 (Ganymede), JEE version (includes all necessary plugins already installed), from: http://www.eclipse.org
- Eclipse Git Plugin ("egit"), from: http://git.or.cz/gitwiki/EclipsePlugin
- Apache Tomcat 6 zip or tarball (you may not use the version installed with your GNU/Linux distro)
- MySQL 5
Procedure:¶
1. Set up the OPA code from the git repository inside Eclipse:¶
- Create a new Eclipse workspace
- Clone the OPA git repository by either:
- File->Import->Git->Git Repository, click Next, and type:
git://code.credil.org/opa in the URI field, and finish the Wizard
- Open a terminal and change to the Eclipse workspace directory, and type:
git clone git://code.credil.org/opa
- Now you should be back at the Eclipse window, and the Project Explorer treeview should still be blank
- File->Import->General->Existing Projects Into Workspace, and import the "opa" directory, newly created inside your workspace directory
- Right-click the opa project (the top-level item in the Project Explorer treeview), and choose Team->Share...
- Select repository type "Git", and click Next
- Select "Search for Existing Git Repositories", and click Next
2. Create MySQL schema and load default data:¶
- Create a MySQL user account "opa", and a schema "opa", and grant the "opa" user all rights to that schema (refer to MySQL documentation)
- Load the schema file,
opa.database/opa.create_db.sql, into your MySQL database with:
mysql -u opa -p < opa.database/opa.create_db.sql
- NB. if you wish to use a different schema name and/or credentials, edit
WebContent/META-INF/context.xml
- Load the default values file,
opa.database/opa.insert_ref_data.sql with the same method
3. Set up Tomcat inside Eclipse:¶
- Extract the Tomcat archive into your opt/ directory, or another appropriate place
- File->New->Other, and open the "Server" tree, and select "Server", and click Next
- Choose Apache/Tomcat v6.0 Server, and then click the blue "Add" hyperlink in order to add a new server runtime environment, and select your Tomcat directory, and click Finish
- Click Next, and make sure the opa project is moved to the "Configured projects" list
- Click Finish, and press the Run button in the toolbar to start OPA in Tomcat
- Navigate your browser to http://localhost:8080/opa/admin, and login as a Coordinator. Default username/password is "admin"/"opajava"
Loading...