Created maven archetype

2 views
Skip to first unread message

Chris Wilkes

unread,
Jan 9, 2009, 3:36:20 AM1/9/09
to Masa Developers
I've uploaded masa-archetype-maven.tar.gz to the "Files" page, it
creates the exact same directory layout and file contents that doing a
"File - New Android Project" does in Eclipse.

To use it untar the contents (I put it at the top level directory, the
same one where maven-aidl-plugin et al live), cd into it and do a "mvn
clean install"

Create a ~/.m2/archetype-catalog.xml file like this:

<?xml version="1.0" encoding="UTF-8"?>
<archetype-catalog>
<archetypes>
<archetype>
<groupId>org.jvending.masa</groupId>
<artifactId>masa-archetype-maven</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Android Archetype</description>
</archetype>
</archetypes>
</archetype-catalog>

Finally you can use it like so:
mvn archetype:generate -DgroupId=foo.bar -DartifactId=android-two
mvn archetype:generate -DgroupId=foo.bar -DartifactId=android-two -
DApplicationName=AppName -DActivityName=ActName
the 2nd one shows how to pass in the parameters of the application and
activity name, otherwise you're prompted for them.

Let me know if there's any bugs. Can this be incorporated into /
trunk? I think others might find it handy.

Coder One

unread,
Jan 13, 2009, 10:51:27 PM1/13/09
to Masa Developers

Looks like a good deal, but I am getting these errors...

C:\myandroids\android-three\target\generated-sources\foo\bar\R.java:
[10,13] duplicate class: foo.bar.R
C:\myandroids\android-three\target\generated-sources\foo\bar\R.java:
[10,13] duplicate class: foo.bar.R

Chris Wilkes

unread,
Jan 14, 2009, 2:32:50 PM1/14/09
to masa-de...@googlegroups.com
I'll look into this more tonight.  The issue is that I create a src/foo/bar/R.java file as there is in an Android project created in Eclipse but the masa maven program makes its own at target/generated-sources/foo/bar/R.java .  Maven then rightly complains that it has two foo.bar.R java classes when there should only be one.

I have some quick ideas for a possible fix: 1) mount target/generated-classes/ as a source directory, 2) write out the R.java to the src/ directory, 3) do some magic in igorning the src/ R.java version and using the target/generated-classes/ one.

Thinking about it I'm a little annoyed that by default the Android Eclipse plugin puts a generated class under src/ .  I don't like to have generated files checked into source control and by putting it under src/ it is likely that file will be checked in.

By removing the src/foo/bar/R.java file I was able to run the aapt package command.  However nothing was created as it doesn't have a bin/ directory.  I'll look into this more tonight.

Thanks for checking out the code!

Shane Isbell

unread,
Jan 14, 2009, 2:37:25 PM1/14/09
to masa-de...@googlegroups.com
In a previous version of Masa, I had the generated source put into the main src directory, but this completely broke the Maven release plugin, which complains that there is a file in source that is not in svn. We definitely need to find a way to make this compatible with eclipse.

Shane

Shane Isbell

unread,
Jan 14, 2009, 2:39:51 PM1/14/09
to masa-de...@googlegroups.com
I'll check it out, if it all works for me, I'll put it into trunk. In the future, a patch (diff) would be best to upload. Thanks!

Shane
Reply all
Reply to author
Forward
0 new messages