I\'m newbie in maven and trying to configure it to build my android project with android-maven-plugin. I have an application.properties file in assets directory which contai
Now it works, i change <resourceDirectory>${project.build.directory}/filtered-assets</resourceDirectory>
to <assetsDirectory>${project.build.directory}/filtered-assets</assetsDirectory>
. Results POM:
<properties>
<myProperty>MY PROPERTY!!!!111</myProperty>
</properties>
<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>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<sdk>
<platform>8</platform>
</sdk>
<emulator>
<avd>2.3.3_API-10</avd>
</emulator>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
<assetsDirectory>${project.build.directory}/filtered-assets</assetsDirectory>
</configuration>
<extensions>true</extensions>
</plugin>
If you are specifying the property in your pom you shouldn't have it declared in a separate file as well. Conversely, if you want to specify it in a separate file you shouldn't declare it in your POM.
However, I am not sure exactly what you are trying to do - maven properties are only valid within your pom file and are for use during the build process. You can't access them from within your application. Android/java have no idea they exist and can't see them, so the reason you see the ${helloFromPOM}
in your code instead of MY PROPERTY
is that android/java is just displaying the text - it doesn't know that it stands for a property and it has no way to parse it into a variable or other value.
Sometimes it's caused by an inappropriate platform version. Try to set it right in your pom file. Look for smthg like
<sdk>
<platform>17</platform>
</sdk>