resource overlay directories and apklib

390 views
Skip to first unread message

Tim Hepner

unread,
Oct 26, 2012, 1:41:31 PM10/26/12
to maven-androi...@googlegroups.com
Hello,

I'd like use different resources based on maven profiles in my apklib.
In my plugin configuration I have a tag like this:

<resourceOverlayDirectory>partners/${partner}/res</resourceOverlayDirectory>

This generates the R.java properly but when it comes time to jar up the
apklib this tag seems to be ignored. Looking at the source I don't see
it used.

I'm looking at:
com.jayway.maven.plugins.android.phase09package.ApklibMojo.createApkLibraryFile()


and I see this:

JarArchiver jarArchiver = new JarArchiver();
jarArchiver.setDestFile( apklibrary );

jarArchiver.addFile( androidManifestFile,
"AndroidManifest.xml" );
addDirectory( jarArchiver, assetsDirectory, "assets" );
addDirectory( jarArchiver, resourceDirectory, "res" );
addDirectory( jarArchiver, sourceDirectory, "src" );
addJavaResources( jarArchiver,
project.getBuild().getResources(), "src" );

// Lastly, add any native libraries
addNativeLibraries( jarArchiver );


Shouldn't there be one for resourceOverlayDirectory as well?

thanks,
Tim

Manfred Moser

unread,
Oct 26, 2012, 4:10:21 PM10/26/12
to maven-androi...@googlegroups.com
I have a feeling yes... want to test and send a pull request?

manfred

Domain Admin

unread,
Oct 26, 2012, 6:51:51 PM10/26/12
to maven-androi...@googlegroups.com
Yes that was it.  I'll send a pull request.


manfred

--



Manfred Moser

unread,
Oct 27, 2012, 12:15:36 AM10/27/12
to maven-androi...@googlegroups.com, Domain Admin
Great. It will be in the next release then ;-)
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Tim Hepner

unread,
Oct 29, 2012, 4:13:12 PM10/29/12
to Manfred Moser, maven-androi...@googlegroups.com
Ok I submitted a pull request.  Looking at the diff it looks like I screwed something up.  It shows all lines as deleted and then added. I chose to keep the same line endings as the project when commiting. This is my first time using github or git for that matter so I may have missed something simple.

thanks,
Tim

Manfred Moser

unread,
Nov 5, 2012, 1:36:53 PM11/5/12
to maven-androi...@googlegroups.com, Manfred Moser
Merged, added to changelog and built on the ci server.

manfred
> --
>
>
>

Tim Hepner

unread,
Nov 5, 2012, 2:23:05 PM11/5/12
to maven-androi...@googlegroups.com, Manfred Moser
Great. I'd like to have the rest of my team use this without a bunch of
manual steps. Can I use the snapshots repo listed here? Whats the best
way to get the latest change before release?

http://code.google.com/p/maven-android-plugin/wiki/SnapshotRepo

thanks,
Tim

Manfred Moser

unread,
Nov 5, 2012, 2:38:02 PM11/5/12
to Tim Hepner, maven-androi...@googlegroups.com, Manfred Moser
Let me push to the snapshot repo... one sec.

Manfred Moser

unread,
Nov 5, 2012, 2:42:26 PM11/5/12
to man...@mosabuam.com, Tim Hepner, maven-androi...@googlegroups.com
Alright... 3.4.1-SNAPSHOT is there now.

Just configure the snapshot repo in your repo manager and your devs should
be ready to use it.

manfred

Manfred Moser

unread,
May 24, 2013, 12:39:03 PM5/24/13
to maven-androi...@googlegroups.com, man...@mosabuam.com, Tim Hepner
I believe this should work but have not tested it. Maybe file an issue
with more details and let us know. And potentially debug the plugin and
provide a fix..

manfred

> I'm still seeing this issue on 3.5.4-SNAPSHOT. This is ever make it into
> the final version? was the issue reintroduced? or am I doing something
> wrong?
>
> what I see is the the original resource from /res is kept and the
> overlayed
> version of the same resource in res-overlay gets ignored. shouldn't it
> merge/replace it?
>
> On Monday, November 5, 2012 2:42:28 PM UTC-5, Manfred Moser (simpligility)
>> <javascript:><mailto:man...@mosabuam.com<javascript:>>>
> --
> You received this message because you are subscribed to the Google Groups
> "Maven Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to maven-android-deve...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

Roberto Andrade

unread,
May 24, 2013, 12:44:42 PM5/24/13
to maven-androi...@googlegroups.com, man...@mosabuam.com, Tim Hepner
I did submit an issue for it:
https://code.google.com/p/maven-android-plugin/issues/detail?id=384&q=apkli
b%20overlay&colspec=ID%20Type%20Component%20OpSys%20Status%20Priority%20Mil
estone%20Owner%20Summary

And tried to debug this and it looks like it's something deeper within the
JarArchiver or the way it's instantiated and parametrized (file overwrite
rules?). I'm not too familiar with maven source or plugins source for that
matter so wouldn't risk trying to provide a fix for it at this point in
time but thought the fine gentlemen in this thread that already touched it
to attempt fixing it initially would have some good insights.

Right now I'm fixing it by adding the overlay resources onto the JAR
manually after the plugin completes :\ I know lame, but I wish I had a bit
more time to dig into this and figure it out (and hopefully help fix it).

Cheers,

Roberto
>You received this message because you are subscribed to a topic in the
>Google Groups "Maven Android Developers" group.
>To unsubscribe from this topic, visit
>https://groups.google.com/d/topic/maven-android-developers/bxmcH4JLAfg/uns
>ubscribe?hl=en-US.
>To unsubscribe from this group and all its topics, send an email to
Reply all
Reply to author
Forward
0 new messages