Project

From Touchbase

Jump to: navigation, search

This page outlines the steps required to initialise your new touchbase project. Upon completion of these steps you will have a runnable OSGi environment incorporating the core touchbase modules.

Install Maven 2

Touchbase, like all base architectures, employs Maven 2 to manage dependencies and generate build artifacts. Install Maven 2 as follows:

  1. Download Maven 2 and extract to an appropriate location. As per the installation instructions add a MAVEN_HOME environment variable and ensure that $MAVEN_HOME\bin and $JAVA_HOME\bin are both included in your system execution PATH.
    NOTE: I find it is also useful to initialise the MAVEN_OPTS environment variable with a value of "-Xmx512m".
  2. Create a directory ".m2" under your ${user.home} path. On Windows this would be "C:\Documents and Settings\<username>\.m2". Create a new file called "settings.xml" in the new directory, and add the following:
<settings>
  <profiles>

    <profile>
      <id>modularity-releases</id>
      <repositories>
        <repository>
          <id>modularity-releases</id>
          <name>Modularity Releases</name>
          <url>http://m2.modularity.net.au/releases</url>
        </repository>
      </repositories>
    </profile>

    <profile>
      <id>modularity-snapshots</id>
      <repositories>
        <repository>
          <id>modularity-snapshots</id>
          <name>Modularity Snapshots</name>
          <url>http://m2.modularity.net.au/snapshots</url>
        </repository>
      </repositories>
    </profile>

    <profile>
      <id>apache-snapshots</id>
      <repositories>
        <repository>
          <id>apache-snapshots</id>
          <name>Apache Snapshots</name>
          <url>http://people.apache.org/repo/m2-snapshot-repository</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>apache-plugin-snapshots</id>
          <name>Apache Plugin Snapshots</name>
          <url>http://people.apache.org/repo/m2-snapshot-repository</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>

  </profiles>

  <activeProfiles>
    <activeProfile>modularity-releases</activeProfile>
  </activeProfiles>
</settings>

Create the project

Creating a new touchbase project is best performed using the Maven Archetype Plugin. This is achieved as follows:

  1. Open a command prompt/terminal window at the location you would like to create your project. Enter the following, replacing <project-groupId>, <project-artifactId> and <project-version> with appropriate values for your project:
% mvn archetype:create -DgroupId=<project-groupId> -DartifactId=<project-artifactId> -Dversion=<project-version> \
        -DarchetypeGroupId=net.modularity.touchbase -DarchetypeArtifactId=touchbase-project-archetype -DarchetypeVersion=1.0

Build the OSGi Environment

The final runnable application is represented by an OSGi environment containing the applicable touchbase bundles and your own custom and/or third-party bundles. This environment can be constructed using the Maven Assembly Plugin as follows:

  1. Open a command prompt/terminal window in your project root directory. Execute the following command:
% mvn assembly:directory [-P {equinox|felix}]

You will now see a new directory structure under <project_root>/target/<project-name>-<project-version>-{equinox|felix} that contains the OSGi bundles and application launcher. You can launch the application by changing to the sub-directory named <project-name>-<project-version> found directly under this new directory and executing the following:

% java -jar osgi-launcher.jar
Personal tools