NOTE: This is a crosspost from http://malsserver.blogspot.com/2010/04/galatea-mavenandroid-archetype.html.
After my experience writing an archetype for Red Dwarf; I decided to do the same thing for Android. This archetype is based on the maven-android-plugin. I'd like to thank Hugo for helping me get the configuration correct. So let's get started.
As before...
The resulting files:F:\work>mvn archetype:generate -DarchetypeCatalog=http://kallisti.eoti.org:8081/content/repositories/snapshots/archetype-catalog.xml
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-archetype-plugin:2.0-alpha-5-SNAPSHOT:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: http://kallisti.eoti.org:8081/content/repositories/snapshots/archetype-catalog.xml -> ardor3d-archetype (null)
2: http://kallisti.eoti.org:8081/content/repositories/snapshots/archetype-catalog.xml -> kryten-archetype (null)
3: http://kallisti.eoti.org:8081/content/repositories/snapshots/archetype-catalog.xml -> galatea-archetype (null)
4: http://kallisti.eoti.org:8081/content/repositories/snapshots/archetype-catalog.xml -> kryten-archetype (null)
Choose a number: : 3 ((use whatever number is assigned to galatea))
[INFO] snapshot org.eoti.galatea:galatea-archetype:1.0-SNAPSHOT: checking for updates from eoti-public
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = 'c4696ce0aeee29d53523e63f02230636518f8ad2'; remote = 'deb2361707aa66b51d4055be6452e818b9283be2' - RETRYING
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = 'c4696ce0aeee29d53523e63f02230636518f8ad2'; remote = 'deb2361707aa66b51d4055be6452e818b9283be2' - IGNORING
Define value for property 'groupId': : org.eoti.android.test
Define value for property 'artifactId': : TestAndroid
Define value for property 'version': 1.0-SNAPSHOT: :
Define value for property 'package': org.eoti.android.test: :
Confirm properties configuration:
groupId: org.eoti.android.test
artifactId: TestAndroid
version: 1.0-SNAPSHOT (hit enter)
package: org.eoti.android.test (hit enter)
Y: : (hit enter)
[WARNING] Don't override file F:\work\TestAndroid\src\main\android\res\values\strings.xml
[WARNING] Don't override file F:\work\TestAndroid\src\main\android\res\layout\main.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:02.860s
[INFO] Finished at: Sun Apr 18 19:58:56 PDT 2010
[INFO] Final Memory: 6M/11M
[INFO] ------------------------------------------------------------------------
F:\work> cd TestAndroid
F:\work\TestAndroid>tree /F
Folder PATH listing for volume WINDOWS
Volume serial number is 9827-5E66
F:.
│ pom.xml
│
└───src
│ AndroidManifest.xml
│
└───main
├───android
│ └───res
│ ├───drawable
│ │ icon.png
│ │
│ ├───layout
│ │ main.xml
│ │
│ └───values
│ strings.xml
│
└───java
└───org
└───eoti
└───android
└───test
MyActivity.java *
Make sure you have your emulator running (emulator -avd Device1, in my case):
This will build, package and deploy it to your emulator.F:\work\TestAndroid>mvn install
In addition to cleaning your build tree, that will undeploy your app from the emulator.F:\work\TestAndroid>mvn clean
Update: The repository has been moved from kallisti.eoti.org to repository-malachid.forge.cloudbees.com. As such, the new command line to launch the archetype is:
F:\work>mvn archetype:generate -DarchetypeCatalog=http://repository-malachid.forge.cloudbees.com/public-snapshot/archetype-catalog.xml
No comments:
Post a Comment