Skip to content

Commit

Permalink
Merge pull request #49 from rciovati/master
Browse files Browse the repository at this point in the history
Revamped archetypes
  • Loading branch information
ebiermann committed Apr 17, 2013
2 parents 047633a + 65a700c commit 9effb58
Show file tree
Hide file tree
Showing 110 changed files with 2,515 additions and 1,707 deletions.
70 changes: 39 additions & 31 deletions README.md
Expand Up @@ -4,7 +4,7 @@ android-archetypes
This projects provides several Maven archetypes for Android. Those archetypes allows to quickly bootstrap a Maven project
to develop an android application.

These artifacts are based on the android-maven-plugin (http://code.google.com/p/maven-android-plugin/). It currently uses the 3.5.0 version.
These artifacts are based on the android-maven-plugin (http://code.google.com/p/maven-android-plugin/). It currently uses the 3.5.3 version.

The android-quickstart archetype
--------------------------------
Expand All @@ -20,17 +20,17 @@ way to initiate an android project:

You can also set three optional properties :

* The created 'package' with '-Dpackage=your.company.android'. By default it uses the given groupId.
* The Android emulator's name to use with '-Demulator=my-avd'. If none specified the property <emulator> will be ignored in the pom file.
* The targeted Android platform with '-Dplatform=7'. The Android SDK version will be automatically fetched to fit the corresponding API level. Available API Level are 3, 4, 7, 8, 9, 10, 14 and 16. By default, it uses 16 (android 4.1.1.4).
* The created 'package' with `-Dpackage=your.company.android`. By default it uses the given groupId.
* The Android emulator's name to use with `-Demulator=my-avd`. If none specified the property <emulator> will be ignored in the pom file.
* The targeted Android platform with `-Dplatform=X`. The Android SDK version will be automatically fetched to fit the corresponding API level. Available API Level are 3, 4, 7, 8, 9, 10, 14 and 16. By default, it uses 16 (android 4.1.1.4).

Once generated, the application is ready to be built and deployed (you may need to configure your ANDROID_HOME environment variable to point to your Android SDK). Start an android emulator, or plug an Android dev phone,
Once generated, the application is ready to be built and deployed (you may need to configure your `ANDROID_HOME`environment variable to point to your Android SDK). Start an android emulator, or plug an Android dev phone,
and launch:

cd my-android-application
mvn clean install android:deploy
mvn clean install android:deploy android:run

The application will be built and deployed on the device.
The application will be built, deployed and launched on the device.

The android-with-test archetype
-------------------------------
Expand All @@ -46,8 +46,11 @@ This archetype creates a multi-module project containing an android application
-DartifactId=my-android-project \
-Dpackage=com.foo.bar.android

The 'package' value is optional (by default use the groupId). You can also set the targeted Android platform with
'-Dplatform=x'. By default, it uses 16 (android 4.1.1.4).
You can also set three optional properties :

* The created 'package' with `-Dpackage=your.company.android`. By default it uses the given groupId.
* The Android emulator's name to use with `-Demulator=my-avd`. If none specified the property <emulator> will be ignored in the pom file.
* The targeted Android platform with `-Dplatform=X`. The Android SDK version will be automatically fetched to fit the corresponding API level. Available API Level are 3, 4, 7, 8, 9, 10, 14 and 16. By default, it uses 16 (android 4.1.1.4).

Once generated, the application is ready to be built and tested. Start an android emulator, or plug an Android dev phone,
and launch:
Expand All @@ -56,10 +59,14 @@ and launch:
mvn clean install

The application will be built, then the integration-tests will be built and executed on the Android device.
If you whish to launch just the application:

cd my-android-project
mvn clean install android:deploy android:run

The android-library-quickstart archetype
----------------------------------------
The library quickstart archetype creates a simple android library ready to be used with another android application. It's a pretty simple
The library quickstart archetype creates a simple Android library ready to be used with another Android application. It's a pretty simple
way to initiate an android project:

mvn archetype:generate \
Expand All @@ -71,15 +78,13 @@ way to initiate an android project:

You can also set three optional properties :

* The created 'package' with '-Dpackage=your.company.android'. By default it uses the given groupId.
* The Android emulator's name to use with '-Demulator=my-avd'. If none specified the property <emulator> will be ignored in the pom file.
* The targeted Android platform with '-Dplatform=7'. The Android SDK version will be automatically fetched to fit the corresponding API level. Available API Level are 3, 4, 7, 8, 9, 10 and 14. By default, it uses 10 (android 2.3.3).
* The created 'package' with `-Dpackage=your.company.android`. By default it uses the given groupId.
* The targeted Android platform with `-Dplatform=7`. The Android SDK version will be automatically fetched to fit the corresponding API level. Available API Level are 3, 4, 7, 8, 9, 10 and 14. By default, it uses 10 (android 2.3.3).

Once generated, the library is ready to be built:

cd my-android-application
mvn clean install

The android-release archetype
----------------------------

Expand All @@ -93,19 +98,29 @@ This archetype extends `android-with-test` with release management.
-DartifactId=my-android-project \
-Dpackage=com.foo.bar.android

The 'package' value is optional (by default use the groupId). You can also set the targeted Android platform with
'-Dplatform=x'. By default, it uses 16 (android 4.1.1.4).
You can also set three optional properties :

* The created 'package' with `-Dpackage=your.company.android`. By default it uses the given groupId.
* The Android emulator's name to use with `-Demulator=my-avd`. If none specified the property <emulator> will be ignored in the pom file.
* The targeted Android platform with `-Dplatform=X`. The Android SDK version will be automatically fetched to fit the corresponding API level. Available API Level are 3, 4, 7, 8, 9, 10, 14 and 16. By default, it uses 16 (android 4.1.1.4).

Once generated, the application is ready to be built and tested. Start an android emulator, or plug an Android dev phone,
Once generated, the application is ready to be built and tested. Start an Android emulator, or plug an Android dev phone,
and launch:

cd my-android-project
mvn clean install

The application will be built, then the integration-tests will be built and executed on the Android device.

If you whish to launch just the application:

cd my-android-project
mvn clean install android:deploy android:run

By default the app is built in "debug mode". This means `BuildCongif.DEBUG` is `true` and `android:debuggable="true"` and the apk is signed with the debug key (`~/.android/debug.keystore`).

When you release your application, it will generate a signed, zipaligned and [ProGuard](http://proguard.sourceforge.net)-processed apk.
You will have to add a profile to your `settings.xml` containing the signing informations:
You will have to add a profile to your `~/.m2/settings.xml` file containing the signing informations:

<profile>
<id>android-release</id>
Expand All @@ -117,22 +132,15 @@ You will have to add a profile to your `settings.xml` containing the signing inf
</properties>
</profile>

or directly pass those properties through the command line:
At this point you can generate a signed apk using the Maven release plugin:

mvn release:prepare
mvn release:perform -Dsign.keystore=/path/to/keystore \
-Dsign.alias=key-alias \
-Dsign.storepass=keystore-password \
-Dsign.keypass=key-password
mvn release:perform -DreleaseProfiles=android release,release
mvn release:clean

The archetype contains a test key store which *MUST NOT BE USED IN PRODUCTION*. However you can use it for testing:
Or, if you wish to generate a signed apk without performing the whole release process:

mvn clean install -Prelease \
-Dsign.keystore=PATH_OF_THE_PROJECT/my-android-project/test-key.keystore \
-Dsign.alias=mykey \
-Dsign.storepass=testtest \
-Dsign.keypass=testtest
mvn clean deploy -Pandroid-release,release

Be aware that Android cannot re-deploy artifacts using a different key, so be sure to undeploy all artifacts before running the
release.
Expand All @@ -151,15 +159,15 @@ The android-gcm-quickstart creates a simple Google Cloud Messaging application.

The 'senderId' value is found in the [Google APIs console](https://code.google.com/apis/console).
You can also set one optional property :
* The URL of your GCM server, with '-DgcmReceiverUrl=http://my-gcm-server'. By default it uses the local test server provided by the gcmutils-maven-plugin.
* The URL of your GCM server, with `-DgcmReceiverUrl=http://my-gcm-server`. By default it uses the local test server provided by the gcmutils-maven-plugin.

Generated files includes the assets/gcmutils.properties configuration file, containing GCM specific values.
Once generated, the library is ready to be built with:

cd my-android-application
mvn clean install

Before starting the test server add the API Key configuration. This can be added in the user settings file, .m2/settings.xml, by system property '-DapiKey=' or in the pom.xml (not recommended).
Before starting the test server add the API Key configuration. This can be added in the user settings file, `~/.m2/settings.xml`, by system property `-DapiKey=` or in the pom.xml (not recommended).
When the key is added, you can start the GCM test server:

mvn gcmutils:run-server
Expand Down
112 changes: 56 additions & 56 deletions android-archetypes-it/pom.xml
@@ -1,59 +1,59 @@
<!--
Copyright 2010 akquinet
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
<!-- Copyright 2010 akquinet Licensed under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied. See the License for
the specific language governing permissions and limitations under the License. -->
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>android-archetype-project</artifactId>
<groupId>de.akquinet.android.archetypes</groupId>
<version>1.0.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>de.akquinet.android.archetypes</groupId>
<artifactId>android-archetypes-it</artifactId>
<version>1.0.10-SNAPSHOT</version>
<name>Akquinet Android Archetype - Integration Tests</name>
<description>Android Archetypes Integration Tests</description>

http://www.apache.org/licenses/LICENSE-2.0
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-verifier</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>1.1.0</version>
<scope>test</scope>
</dependency>
</dependencies>

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>android-archetype-project</artifactId>
<groupId>de.akquinet.android.archetypes</groupId>
<version>1.0.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>de.akquinet.android.archetypes</groupId>
<artifactId>android-archetypes-it</artifactId>
<version>1.0.10-SNAPSHOT</version>
<name>Akquinet Android Archetype - Integration Tests</name>
<description>Android Archetypes Integration Tests</description>

<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-verifier</artifactId>
<version>1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<configuration>
<parallel>true</parallel>
<systemPropertyVariables>
<archetype.version>${project.version}</archetype.version>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<parallel>true</parallel>
<systemPropertyVariables>
<archetype.version>${project.version}</archetype.version>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 9effb58

Please sign in to comment.