kingdom578 / maven-android-plugin

Automatically exported from code.google.com/p/maven-android-plugin
0 stars 0 forks source link

Unable to pre-process assets before Generate-Sources runs #451

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use the Maven resources plugin to copy assets to custom directory
2. Run mvn install
3.

What is the expected output?
When using 3.8.1, my merged assets would appear in the apk

What do you see instead?
since upgrading to 3.8.2+ my merged assets are no longer picked up

What version of maven-android-plugin are you using?
3.8.2+

What are the complete output lines of "mvn -version" on your machine?
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 
16:22:22
+0100)
Maven home: F:\Tools\Maven\apache-maven-3.1.1
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_51\jre
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

Please provide any additional information below.
I use the resources plugin to collate some custom resources for me depending on 
the profile, however since the upgrade the assets for the APK are processed 
before the resources plugin runs to create my custom assets directory. 

I appreciate this might not be a bug and that there is some functionality of 
Maven I am missing here, I would love to know what.

Original issue reported on code.google.com by Cookie0...@gmail.com on 10 Mar 2014 at 11:20

GoogleCodeExporter commented 9 years ago
Post a link to project that fails.

Original comment by william....@xandar.com.au on 11 Mar 2014 at 3:26

GoogleCodeExporter commented 9 years ago
Essentially I have a project that has this in the build section of my POM:

<resources>
    <resource>
        <directory>${project.basedir}/../assets</directory>               
        <targetPath>${project.build.directory}/merged-assets</targetPath>
    </resource>
    <resource>
        <directory>${project.basedir}/../second_assets</directory>               
        <targetPath>${project.build.directory}/merged-assets</targetPath>
    </resource>
</resources>

Then in the maven-android-plugin specifying this:

<assetsDirectory>${project.build.directory}/merged-assets</assetsDirectory>

However with v3.8.1 of the plugin the assets were copied during the invocation 
of the APKMojo, since v3.8.2 it appears that this functionality has been moved 
to the GenerateSourcesMojo.

Which in essence causes the problem, as the generate-sources phase happens 
before the process-resources phase, the merged-assets directory doesn't exist.

I wanted to know if there was a way I could have the GenerateSourcesMojo happen 
during the process-resources phase but after the copy-resources goal of the 
resources plugin - Or is there more sensible approach to this?

Original comment by Cookie0...@gmail.com on 11 Mar 2014 at 1:18

GoogleCodeExporter commented 9 years ago
Android Assets are not (Java) resources. And I think configuring them as such 
in order to  get the resources-plugin to copy them to \target\merged-assets in 
the wrong approach.

You are better off configuring an instance of the maven-ant-task to copy those 
folders to \target\merged-assets at whichever lifecycle phase you want.

Original comment by william....@xandar.com.au on 11 Mar 2014 at 1:34

GoogleCodeExporter commented 9 years ago
Thanks for the feedback and advice. I will look in to taking that approach.

Original comment by Cookie0...@gmail.com on 11 Mar 2014 at 2:05

GoogleCodeExporter commented 9 years ago

Original comment by william....@xandar.com.au on 11 Mar 2014 at 2:08