Difference between revisions of "1.3 Maven Build"

From RifidiWiki

Jump to: navigation, search
(Add the required project(s) into eclipse.)
m (Install the Sun-SDK)
Line 21: Line 21:
  
 
* 1) In the command prompt, type  
 
* 1) In the command prompt, type  
sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk
+
[code]sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk[/code]
 
* 2) In the command prompt, type
 
* 2) In the command prompt, type
 
sudo update-java-alternatives -s java-6-sun
 
sudo update-java-alternatives -s java-6-sun
Line 43: Line 43:
 
java version "1.6.0_03"
 
java version "1.6.0_03"
 
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
 
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Server VM (build 1.6.0_03-b05, mixed mode)  
+
Java HotSpot(TM) Server VM (build 1.6.0_03-b05, mixed mode)
  
 
==Add the required project(s) into eclipse.==
 
==Add the required project(s) into eclipse.==

Revision as of 20:31, 9 January 2012

Under Construction!

Check back later!

Before beginning

The Maven Build tutorial below is designed to be used on a Debian built operating system. The maven build is capable of generating the binary files for both Windows and Macintosh, but the steps for producing an executible file for Windows or Mac are not included in this release.

What you'll need to do:

  • 1) Install the Sun-JDK [Scripted]
  • 2) Add the required project(s) into eclipse.
  • 3) Install Maven3 [Scripted]
  • 4) Install Tomcat6 [Scripted]
  • 5) Create a p2 repository for plugins
  • 6) Build the project.


Install the Sun-SDK

Optionally, there is a script for this section, RifidiMavenBuild.sh. Navigate to the script and type sudo sh RifidiMavenBuild.sh

  • 1) In the command prompt, type

[code]sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk[/code]

  • 2) In the command prompt, type

sudo update-java-alternatives -s java-6-sun

  • 3) Open /etc/jvm and add the top line to read

/usr/lib/jvm/java-6-sun The bottom of the file should read /urs/lib/jvm/java-6-sun /usr/lib/jvm/java-gcj /usr/lib/jvm/ia32-java-1.5.0-sun /usr/lib/jvm/java-1.5.0-sun /usr Make sure you save and close the file.

  • 4) Set up the environment variable by editing the file $HOME/.bash_profile and appending

export JAVA_HOME=/usr/lib/jvm/java-6-sun export PATH=$PATH:$JAVA_HOME/bin

  • 5) You may need to restart the computer at this point to ensure the operating system recognizes

the changes that have been made.

  • 6) Verify the version is installed correctly by typing (in the shell prompt)

java -version The output should be similar to java version "1.6.0_03" Java(TM) SE Runtime Environment (build 1.6.0_03-b05) Java HotSpot(TM) Server VM (build 1.6.0_03-b05, mixed mode)

Add the required project(s) into eclipse.

We recommend and support Eclipse Galileo (3.5) as the programming environment. You'll need to use the SVN repository system to access the open code repository. In the SVN tab, add the repository https://svn.rifidi.rog/svn/rep-edgepublic to gain access to the required base program. The projects you will need to check out are:

  • 1) org.rifidi.edge
  • 2) org.rifidi.edge.adapter.llrp
  • 3) org.rifidi.edge.adapter.alien
  • 4) org.rifidi.edge.api
  • 5) org.rifidi.edge.init
  • 6) org.rifidi.edge.tools
  • 7) Rifidi-SDK

3)Install Maven3

Optionally, there is a script for this section, RifidiMavenBuild2.sh. Navigate to the script and type sudo sh RifidiMavenBuild2.sh

1) Download the maven 3 tar from: http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0.3-bin.tar.gz 2) In the shell prompt, move the direcotory where the download is stored and enter tar -xzvf apache-maven-3.0.3-bin.tar.gz 3) In the shell prompt, type sudo mkdir /usr/local/apache-maven 4) In the shell prompt, type sudo cp -r apache-maven-3.0.3 /usr/local/apache-maven/ 5) Add the maven 3 PATH variables to the environment file located at /etc/environment

   NOTE: You'll want you make sure your JAVA_HOME variable points to java-6-sun

The lines you'll need to add are: M2_HOME = /usr/local/apache-maven/apache-maven-3.0.3 MAVEN_HOME = /usr/local/apache-maven/apache-maven-3.0.3 M2 = /usr/local/apache-maven/apache-maven-3.0.3/bin 6) Add the following location to the PATH variable, separated by a ' : ' usr/local/apache-maven/apache-maven-3.0.3/bin 7) Restart the computer to allow all the changes to this point to take effect. 8) In the shell prompt, type mvn -version the output should look similar to the following Apache-maven 3.0.3 (r1075438; 2011-02-28 12:31:09-05000) Maven home: /usr/local/apache-maven/apache-maven-3.0.3 Java version: 1.6.0_24, vender: sun Microsystems Inc. Java home: /usr/lib/jvm/java-6-sun-1.6.0.24/jre

4)Install Tomcat6

Optionally, there is a script for this section, RifidiMavenBuild2.sh. Navigate to the script and type sudo sh RifidiMavenBuild2.sh

Simply type into the shell propmt sudo apt-get install tomcat6

5)Create a p2 repository for plugins

Background We use existing OSGi bundles which we intend to consume binaries that are generated using Maven3/tycho. The P2-based depndancy resolution that is implemented in Tycho can only search in two locations for these binaries. 1) Public P2 repositories and eclipse update sites that have been configured with the P2 layout. 2) Maven2 repositories with additional P2 encoded metadata (Found at .meta/p2-metadata.properties within the ./repo/ directory). All bundles built using Maven3/tycho are published via this methood.

This implies that anthing we wish to be usable with Tycho needs to be made available in one of the above two forms. Unfortunately, this means direct consumption of bundles built with maven2/Felix is not supported due to the missing P2 metadata in the build result. At the present, we have a manual process for making external bundles available to Tycho. This is acceptbale as long as the external content remains stable and does not require frequent changes. The process may become automated in the future. To publish the P2 repositories, we will be using an Eclipse provided feature, FeaturesAndBundlesPublisher that is available from command line. More reading on how this application works can be found here.

The steps to create a P2 repository 1) Set the Eclipse target platform to be the Running platform. To do this, click Windows → preferences → Plugin Development → Target Platform → select Running Platform → Apply → Ok 2) Open the Run Configuration tab and select Eclipse Application, then create new. We recommend naming the new run-configuration p2plugins for clarity. 3) Change the 'Run an Application:' drop down to select org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher Reffer to Fig-1 below for a screen shot of how the run configuration should appear. 4) Switch to the arguments tab of the present configuration and add the following arugments Where BUNDLE_PATH is the path of Rifdi-SDK project -metadataRepository file:/<BUNDLE_PATH>/repo -artifactRepository file:/<BUNDLE_PATH>/repo -source <BUNDLE_PATH>/rifidi/debian/usr/local/sbin/rifidi -compress -publishArtifacts Refference Fig-2 to verify that the arguments are correct. 5) Apply and run the configuration. If an error propmt comes up, click to proceed. This configuration will create a folder called repo in the Rifidi-SDK project. Make sure that it contains a folder titled plugins as well as artifacts.jar and content.jar. 6) In a shell prompt, move to the eclipse workspace that this project is located in and enter sudo cp -r /Rifidi-SDK/repo /var/lib/tomcat6/webapps/ 7) In the shell prompt, type

ls /var/lib/tomcat6/webapps/

the output should contain repo.

Personal tools