Set Up Environment

From WebLab Wiki
Jump to navigationJump to search

Tools installation

To set up your environment, you need to install the following tools:

  • Java (http://www.java.com/). We rely on latest Java Development Kit 7 versions.
  • Apache Maven (http://maven.apache.org/). We rely on Apache Maven 3.1.3. Often latest old 2.2.1 version can be used but it is not recommended, but when you need a warpath dependency (i.e. extending an existing service without relying on war+jar pattern).
  • An Integrated Development Environment like Eclipse (http://www.eclipse.org/). We encourage you to use latest version of Eclipse like Kepler.
  • If you wish to develop a Web service, you will also need a Servlet container like Apache Tomcat (http://tomcat.apache.org/). We rely either on Tomcat 6 or 7. (If you want to deploy a service).


Tools configuration

Environment variable

  • Set the JAVA_HOME variable to the root of your JDK
  • You can also define the MAVEN_OPTS variable with some parameters like: -Xms128m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=256m -Dfile.encoding=UTF-8


Maven Configuration

In your home folder, Maven should have created a .m2 folder. In this one, you can create (or edit) a settings.xml file. If you need to create it, you can start by copy pasting the one in the conf folder of the Maven installation.

The ~/.m2/settings/ will be used to override properties defined in the root configuration folder. It contains informations like the path to the location where Maven stores your dependencies (the repository) and technical information on how to retrieve dependencies (proxy, address of new repository...). Feel free to customize this file with your needs. But to ensure the compilation of a WebLab project you will need some specific parameters.

Add new repositories

In the profile section of your settings you can add a WebLab based profile as follows.

It defines a profile named WebLab which is always active (you can set the activation to false and use the -P WebLab parameter when launching mvn command to activate it). This profile is made up of two repositories and two plugin repositories that points to the WebLab Maven repositories. This is the place where Maven can download WebLab dependencies need to compile a new project.


<profile>
	<id>WebLab</id>
	<activation>
		<activeByDefault>true</activeByDefault>
	</activation>
	<repositories>
		<repository>
			<id>weblab</id>
			<url>http://maven.weblab-project.org/</url>
			<releases>
				<enabled>true</enabled>
			</releases>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository> 
		<repository>
			<id>weblab-SNAPSHOT</id>
			<url>http://maven-snapshot.weblab-project.org</url>
			<releases>
				<enabled>false</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
	</repositories>
	<pluginRepositories>
		<pluginRepository>
			<id>OW2</id>
			<url>http://maven.ow2.org/maven2</url>
			<releases>
				<enabled>true</enabled>
			</releases>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</pluginRepository> 
		<pluginRepository>
			<id>OW2-SNAPSHOT</id>
			<url>http://maven.ow2.org/maven2-snapshot</url>
			<releases>
				<enabled>false</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</pluginRepository>
	</pluginRepositories>
</profile>

Add WebLab plugin group

If you wish to use the WebLab plugin (see WebLab_Archetype_Plugin) you will also need to set up the pluginGroup part of the settings.xml.

<pluginGroups>
	<pluginGroup>org.ow2.weblab.tools.maven</pluginGroup>
</pluginGroups>

Eclipse configuration

As defined in the How_To_Contribute#Follow_the_code_style_guidelines a checkstyle file is available and should be used when contributing to the WebLab project. If you plan to develop your own services, without contributing to the Open source project, you can skip this part. Otherwise, to ease the application of checkstyle rules we provide on the WebLab OW2 SVN two files that can be imported into Eclipse. One configures the formatter and a second one is a template for class file headings. See weblab-build-tools

We are also providing an Eclipse Plugin that can be used while developing WebLab services. See WebLab_Eclipse_Plugin.