I had created a maven build file for i-jetty webapps some time back. Following is the directory structure of the webapp sources:
sampleapp/
|-- pom.xml
`-- src
`-- main
|-- java
| `-- {java sources}
`-- webapp
|-- {html js css sources}
`-- WEB-INF
`-- web.xml
On the command line export two environment variables:
$>export ANDROID_HOME=/path/to/android/sdk
$>export ANDROID_PLATFORM=7 OR 8 or whatever platform you are using
After you have done that, type: (Assumes that you have maven 2.1+ installed)
$>mvn package
This will generate the sampleapp.war file in the target directory. Which can be deployed in i-jetty.
Below is the pom.xml. Change the artifactId and name in pom.xml to suit your needs.
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>sampleapp</groupId>
<artifactId>sampleapp</artifactId>
<packaging>war</packaging>
<name>sampleapp</name>
<description>Sample Web application</description>
<version>1.0-a1</version>
<properties>
<android.home>${env.ANDROID_HOME}</android.home>
<android.platform.version>${env.ANDROID_PLATFORM}</android.platform.version>
<android.platform>platforms/android-${android.platform.version}</android.platform>
<android.framework.aidl>${android.home}/${android.platform}/framework.aidl</android.framework.aidl>
<android.jar>${android.home}/${android.platform}/android.jar</android.jar>
<android.tools.aapt>${android.home}/${android.platform}/tools/aapt</android.tools.aapt>
<android.tools.dx>${android.home}/${android.platform}/tools/dx</android.tools.dx>
<android.tools.apkbuilder>${android.home}/tools/apkbuilder</android.tools.apkbuilder>
<android.tools.aidl>${android.home}/${android.platform}/tools/aidl</android.tools.aidl>
</properties>
<dependencies>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5-20081211</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>android</groupId>
<artifactId>android</artifactId>
<version>2.2_r1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
<excludeArtifactIds>servlet-api,android</excludeArtifactIds>
<excludeTransitive>true</excludeTransitive>
<outputDirectory>${project.build.directory}/generated-classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<!-- Generate any aidl interfaces -->
<!--
<execution>
<id>aidl-generate</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${android.tools.aidl}</executable>
<arguments>
<argument>-I${basedir}/src/</argument>
<argument>-o${project.build.directory}/generated-sources/</argument>
<argument>-p${android.framework.aidl}</argument>
<argument>${basedir}/src/main/java/com/mycompany/MyService.aidl</argument>
</arguments>
</configuration>
</execution>
-->
<!-- Convert the compiled classes into a clases.dex. -->
<execution>
<id>generate-dex</id>
<phase>process-classes</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${android.tools.dx}</executable>
<arguments>
<!--<argument>-JXmx1024M</argument>-->
<argument>--dex</argument>
<!-- argument>\-\-verbose</argument -->
<argument>--core-library</argument>
<argument>--output=${project.build.directory}/classes.dex</argument>
<argument>--positions=lines</argument>
<argument>${project.build.directory}/classes/</argument>
<!-- uncomment this line if you have any generated classes such as aidl interfaces -->
<!-- argument>${project.build.directory}/generated-classes/</argument -->
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copydex</id>
<phase>process-classes</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<mkdir dir="${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/lib"/>
<jar basedir="${project.build.directory}" update="true"
includes="classes.dex"
destfile="${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/lib/classes.zip"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>