Maven Archetypes for Android

360 views
Skip to first unread message

Clement Escoffier

unread,
Dec 7, 2010, 5:26:56 AM12/7/10
to maven-androi...@googlegroups.com
Hello,

I'm pleased to announce the availability of Maven Archetypes for Android.
They are available from Maven Central and the documentation is available
from
https://github.com/akquinet/android-archetypes/wiki

Those archetypes are relying (of course) of the maven-android-plugin
(2.8.0 for now, will be updated to 2.8.1 ASAP).

Two archetypes are available:
* A quick-start archetype creating a ready to deploy Hello World
application.
* An android-with-test archetype creating a multi-module project
containing an Android application and a project running instrumentation
tests of the application

Using those archetypes is quite easy:
For the quickstart:
mvn archetype:generate \
-DarchetypeArtifactId=android-quickstart \
-DarchetypeGroupId=de.akquinet.android.archetypes \
-DarchetypeVersion=1.0.0 \
-DgroupId=your.company \
-DartifactId=my-android-application

And then (you must plug an android device or launch an emulator first):
cd my-android-application
mvn clean install android:deploy


For the android-with-test:
mvn archetype:generate \
-DarchetypeArtifactId=android-with-test \
-DarchetypeGroupId=de.akquinet.android.archetypes \
-DarchetypeVersion=1.0.0 \
-DgroupId=com.foo.bar \
-DartifactId=my-android-project \
-Dpackage=com.foo.bar.android


And then (you must plug an android device or launch an emulator first):
cd my-android-project
mvn clean install


Regards,

Clement Escoffier


Ricardo Gladwell

unread,
Dec 7, 2010, 7:31:38 AM12/7/10
to maven-androi...@googlegroups.com
Hi Clement

Looks good, thanks for the work on this. Usable android-archetypes are
something I'd really like for m2eclipse-android-intergration so that I
can automatically generate a pom.xml for existing Android projects
that do not already have them

Only slight problem is that it defaults to Android 2.2. How do you
generate projects for other Android versions? I imagine you'd have to
have a separate archetype for each version of Android.

Regards...

--
Ricardo Gladwell <ricardo....@gmail.com>
http://www.google.com/profiles/ricardo.gladwell
Twitter: @rgladwell - MSN: axo...@gmail.com

> --
> You received this message because you are subscribed to the Google Groups "Maven Android Developers" group.
> To post to this group, send email to maven-androi...@googlegroups.com.
> To unsubscribe from this group, send email to maven-android-deve...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/maven-android-developers?hl=en.
>
>

Clement Escoffier

unread,
Dec 7, 2010, 8:43:39 AM12/7/10
to maven-androi...@googlegroups.com
Hi,

On 07.12.10 13:31, "Ricardo Gladwell" <ricardo....@gmail.com> wrote:

>Hi Clement
>
>Looks good, thanks for the work on this. Usable android-archetypes are
>something I'd really like for m2eclipse-android-intergration so that I
>can automatically generate a pom.xml for existing Android projects
>that do not already have them
>
>Only slight problem is that it defaults to Android 2.2. How do you
>generate projects for other Android versions? I imagine you'd have to
>have a separate archetype for each version of Android.

The quickstart targets the 2.2 because it our default platform (at
akquinet). So, yes, we have to provide one per platform. That's pretty
easy to do.

The 'with-test' supports several targets. You can use -Dplatform=... to
set the platform. By default it's 7.

Why one is configurable and one not ?
It's because the main pom generated using archetypes cannot be really
filtered (unfortunately), only the GAV are replaced. For the second
archetype, as it's a multi-module project, the sub-poms can be filtered
correctly.

Regards,

Clement

Clement Escoffier

unread,
Dec 7, 2010, 9:09:27 AM12/7/10
to maven-androi...@googlegroups.com
Hello,

Just to announce the availability of the 1.0.1 version (in Maven Central)
using the maven-android-plugin 2.8.1 and so supporting Android 2.3.

Regards,

Clement

Ricardo Gladwell

unread,
Dec 7, 2010, 9:22:16 AM12/7/10
to maven-androi...@googlegroups.com
On 7 December 2010 13:43, Clement Escoffier <clement....@gmail.com> wrote:
> The quickstart targets the 2.2 because it our default platform (at
> akquinet). So, yes, we have to provide one per platform. That's pretty
> easy to do.

Cool, let me know if you need any help with this.

Clement Escoffier

unread,
Dec 9, 2010, 3:45:56 AM12/9/10
to maven-androi...@googlegroups.com
Hello,

I've just deployed a new version of the archetypes (1.0.3) using the
maven-android-plugin 2.8.3.
Another improvement is the ability to configure the targeted Android
platform inside the archetype with -Dplatform= for both archetypes (that
was not possible for the quickstart). By default it uses 7.

Regards,

Clement

qmx

unread,
Dec 20, 2010, 9:14:35 PM12/20/10
to Maven Android Developers
I'm getting a strange error trying to generate the project:

Expected root element 'archety
pe-descriptor' but found 'archetype' (position: START_TAG seen
<archetype>... @1:11)

Both maven 2.2.1 and maven 3.0.1 gives me this

Am I missing something?

Thanks

On Dec 9, 6:45 am, Clement Escoffier <clement.escoff...@gmail.com>
wrote:
> Hello,
>
> I've just deployed a new version of the archetypes (1.0.3) using the
> maven-android-plugin 2.8.3.
> Another improvement is the ability to configure the targeted Android
> platform inside the archetype with -Dplatform= for both archetypes (that
> was not possible for the quickstart). By default it uses 7.
>
> Regards,
>
> Clement
>
> On 07.12.10 15:09, "Clement Escoffier" <clement.escoff...@gmail.com> wrote:
>
>
>
>
>
>
>
> >Hello,
>
> >Just to announce the availability of the 1.0.1 version (in Maven Central)
> >using the maven-android-plugin 2.8.1 and so supporting Android 2.3.
>
> >Regards,
>
> >Clement
>
> >On 07.12.10 11:26, "Clement Escoffier" <clement.escoff...@gmail.com>

Clement Escoffier

unread,
Dec 21, 2010, 4:38:09 AM12/21/10
to maven-androi...@googlegroups.com
Hi,

On 21.12.10 03:14, "qmx" <q...@qmx.me> wrote:

>I'm getting a strange error trying to generate the project:
>
>Expected root element 'archety
>pe-descriptor' but found 'archetype' (position: START_TAG seen
><archetype>... @1:11)
>
>Both maven 2.2.1 and maven 3.0.1 gives me this

Which command are you using ?
You need to use archetype:generate and not archetype:create because the
archetypes are using the 'new' archetype format (archetype:create is
deprecated and does not support the new format).

Regards,

Clement

Douglas Campos

unread,
Dec 21, 2010, 7:36:21 AM12/21/10
to maven-androi...@googlegroups.com
than it is weirder than I thought because I **was** running archetype:generate

Clement Escoffier

unread,
Dec 21, 2010, 7:37:49 AM12/21/10
to maven-androi...@googlegroups.com


From: Douglas Campos <q...@qmx.me>
Reply-To: <maven-androi...@googlegroups.com>
Date: Tue, 21 Dec 2010 10:36:21 -0200
To: <maven-androi...@googlegroups.com>
Subject: Re: [maven-android-developers] Re: Maven Archetypes for Android 1.0.3

than it is weirder than I thought because I **was** running archetype:generate

Could you give me the command you're using? 
I will try to reproduce the issue.

Regards,

Clement
Reply all
Reply to author
Forward
0 new messages