Asset file filtering - android

I am trying to filter a properties file in the resource directory of my project. This means that I do not need to change the values ​​between the versions of my application, SIT and prod. I use maven and intelliJ IDEA with (ultimately) different profiles, but at the moment I'm just trying to get the build process to get a catalog of filtered assets (if at all possible).

I added these resource strings to my POM:

<resource> <filtering>true</filtering> <directory>assets</directory> <includes> <include>**/*.properties</include> </includes> <targetPath> ../assets </targetPath> </resource> <resource> <filtering>false</filtering> <directory>assets</directory> <excludes> <exclude>**/*.properties</exclude> </excludes> <targetPath> ../assets </targetPath> </resource> 

Is there a way in which the assembly process can be viewed in the catalog of filtered assets?

+2
android maven
source share
1 answer

Try the following:

 <build> <resources> <resource> <directory>${project.basedir}/assets</directory> <filtering>true</filtering> <targetPath>${project.build.directory}/filtered-assets</targetPath> <includes> <include>**/*.properties</include> </includes> </resource> </resources> <plugins> <plugin> <artifactId>maven-resources-plugin</artifactId> <executions> <execution> <phase>initialize</phase> <goals> <goal>resources</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId> <artifactId>maven-android-plugin</artifactId> <extensions>true</extensions> <configuration> <sdk> <platform>7</platform> </sdk> <undeployBeforeDeploy>true</undeployBeforeDeploy> <resourceDirectory>${project.build.directory}/filtered-assets</resourceDirectory> </configuration> </plugin> </plugins> </build> 

Check out the MorseFlash sample project here .

+4
source share

All Articles