Running MetaboLights locally
Aim: To download and install MetaboLights locally.
Requirements: (For the rest of this guide we assume you use Eclipse on windows.)
1.Eclipse IDE - SVN - Subclipse (http://subclipse.tigris.org/) - SVN connector - svnkit 1.7.5 2.Apache tomcat server 6.0 3.Java - JRE 6 and JDK 1.6 4.MySQL 5.1*. (Oracle is also supported) - MySQL workbench 5.2*. (optional) 5.Maven 2.1
Procedure:
Install Eclipse, SVN on your computer and/or in your chosen IDE. Go to eclipse -> project -> Check ‘build automatically’.
On command line, use the following command:
'svn co https://metabolomes.svn.sourceforge.net/svnroot/metabolomes metabolights'
Note: Last part ‘metabolights’ must be replaced by the full path where the user wants to install MetaboLights.
Create a MetaboLights configuration file for your IDE
If you use your IDE to change or update any files for your local MetaboLights installation, you need to create a configuration file. Open command line and navigate to the ‘MetaboLights’ root folder (you should see the pom.xml file there) and type ‘mvn eclipse:eclipse’. This will download all Maven dependencies. After this is done, type ‘mvn eclipse:clean’.
Click on ‘File’ -> ‘import’ -> ‘General’ -> ‘Existing Project...’ -> ‘Next’ -> click on ‘Browse..’ -> Locate ‘metabolights-webapps’ click ‘ok’. Right click on ‘metabolights-webapps’ project ‘configure’ -> ‘convert to maven...’.
Similar files can be greated for IntelliJ (mvn idea:idea) and NetBeans (mvn netbeans:netbeans)
Server and file configurations:
To enable the MetaboLights application to correctly connect to your database and use your local folders, you need to configure your tomcat servers context.xml file. This is normally under ‘Tomcat’ -> ‘Conf’ -> ‘Catalina’ -> ‘localhost’ -> ‘metabolights.xml’
You should use the template under ‘metabolights\metabolights-webapps\src\main\tomcat config\metabolights.xml’. Copy from this file and replace this in context.xml file.
Create folders under, ‘C:\MTBL\xxxx\DataLocation\’ in your file systems and change ‘data _location.xml’ to point to folders in your local system. Please note that in the xml file the folders should have two back-slash characters, like this ‘\\’.
Create folders ‘C:\MTBL\xxxx\Lucene\’ and change the line ‘luceneIndexDirectoryShort=C:\MTBL\xxxxx\Lucene\’ to point to it in ‘application properties’ file.
Change ‘hibernate.properties.template’ file to ‘hibernate.properties’ and point the ‘hibernate.search.default.indexBase’ to ‘C:\MTBL\xxxxx\Lucene\’.
You must also ensure you have the correct database connection defined here, so the username, password and connection url. (You may also uncomment “hibernate.hbm2ddl.auto=update” to create the required tables in an empty database.)
Build MetaboLights:
Navigate to the ‘MetaboLights root folder’ and run:
mvn clean dependency:copy-dependencies compile cd metabolights-webapps mvn war:inplace war:war
This will create a war file under metabolights-webapps -> target. Please copy or move this file to the “docbase” reference in your “metabolights.xml” config file.
Like this: docBase="c:\user\home\metabolights\deploy\metabolights-webapp.war".
Now you should be ready to run MetaboLights from tomcat, so start up tomcat manually or from your IDE.
Known issues:
If you cannot compile MetaboLights in Eclipse, please make sure that you have java 1.6 defined as your default. Right click on project, go to ‘Properties’ -> ‘Java Compiler’ -> uncheck the ‘use compliance from execution environment…’ and change the ‘Compiler compliance level:’ to 1.6.
* If using mysql, you need to comment, these 2 lines in src.main.java.uk.ac.ebi.metabolights.model.MetabolightsUser: @SequenceGenerator(name="userSeq", sequenceName="USER_DETAIL_SEQ", allocationSize=1) and
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="userSeq")
And uncomment: //@GenaratedValue