Maven archetype for an application to run on a Bug Labs YT device or simulator
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
LICENSE
README.mkd
pom.xml

README.mkd

buglabs-maven-archetype

This archetype for Maven 2/3 sets up a skeleton application intended to be built and deployed to a Bug Labs BUG device. It can be used in place of the Dragonfly SDK that Bug Labs kindly distributes to develop in Eclipse.

Requirements

  • A working installation of Maven 2 or 3
  • BUG JAR files provided by Bug Labs - I copied these from /usr/share/java/bundle on a BUG
    • com.buglabs.common.jar
    • com.buglabs.bug.module.XXXfor each module you will be using
  • Either a BUG on the local network or a simulator running in the Dragonfly SDK (through Eclipse)

Installation

First, clone this repo and install the archetype into your local Maven repository:

$ git clone https://peplin@github.com/peplin/buglabs-maven-archetype.git
$ cd buglabs-maven-archetype
$ mvn install

Next, go to where you have the Bug JAR files, and install each one to your repository as well. For example, using SDK version 2.2.1 and the com.buglabs.common.jar package:

mvn install:install-file -Dfile=com.buglabs.common.jar -DgroupId=com.buglabs \
    -DartifactId=com.buglabs.common -Dversion=2.2.1 -Dpackaging=jar

If you have access to an internal Maven repository besides the one on your local machine, deploying these to that server is a good idea.

Usage

Use the archetype to initialize a new project - you should now see the bug-archetype in the quickstart list:

mvn archetype:generate
[INFO] Scanning for projects...
...
Choose archetype:
...
425: local -> bug-archetype (bug-archetype)
Choose a number: 113: 425

Building

The standard Maven lifecycle works as you would expect. mvn package will build an OSGi bundled JAR for you in target/.

Deploying

This archetype also includes a small post-build script that will deploy your app's JAR to a BUG. You can find the script at bin/send-to-bug.sh. It uses the HTTP deploy process described by aturley over at Bug Labs (thanks!).

The script will run as a part of the mvn deploy goal, and it gives some limited output to let you know if the transfer was successful. You can run it by itself if the JAR is already built with mvn exec:exec.

The script looks for a BUG_ADDRESS environment variable and will use that as the deploy target if present. If you're deploying to a physical BUG, make sure to set this value to its IP address. If the variable isn't set, it deploys to localhost:8082, which is where the BUG simulator will be listening if one is running.

License

This project is available under the BSD license.