Intellij make build maven resources filtering

I've been trying to use IntelliJ IDEA CE 11.1 (#IC-177.177) to do resources filtering for my Android project.

If I compile the android app using maven directly "mvn clean package", resource filtering is applied successfully to my final apk.
If I build the android app using the Intellij make process, the resources that gets packaged in the apk don't get filtered.

For example if I had a file under "src/main/resources" with this content, it doesn't get replaced by intellij build process but
works perfectly with maven.

app_version ${version}

I know the build process for IntelliJ is a bit different than maven but I'm not entirely sure where it differs.
Am I doing something wrong here or is this an issue?

Maven pom used:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi=""





Comment actions Permalink

Resource filtering in maven is performed by the resource plug-in. IDEA has no direct mapping for that functionality that would allow it to do such filtering and token replacement. While IDEA's build abilities are a bit more robust than simply compiling code, it is in the end an IDE and not a build system like Ant, Maven, or Gradle. So if your build requirements are more than basic, it's best to leave the work to those tools. Since you are configured to use maven, just do all your builds via maven. You can run it right from within IDEA. Is there a reason why you need to use the IDEA make command? Note that run/debug configurations, including ones for unit tests, can be configured to run a maven goal rather than the IDEA make prior to running.

Comment actions Permalink

Hi Mark,

Thanks for taking the time to answer my question.  The differences between IntelliJ make command an the maven is a bit clearer now.  The reason that I was actually trying to use the IntelliJ make command process was because I wasn't aware that I could get a run / debug configuation running though IntelliJ while still using maven.  I've only been using maven for a few months now and IntelliJ for a few weeks.

If I'm trying to achieve this for Android, the idea would be that maven is used for the build portion.  It would generate the apk and then IntelliJ would come in and use it to launch the application on a device or emulator for debugging.  Do I have this right?

Would you happen to know where I could get a good example of how to acheive this?

Thanks again for the help

Comment actions Permalink

Alright so I had time to do a little bit of testing and I think I was able to figure out most of the changes that I needed to do to get this working.

I created a run configuation for "Android Application" and I simply unselected the "Make" option from the "Before Launch" section in the "General" tab.  I then simply checked the "Run Maven Goal" and then went and browsed and selected the "Package" lifecycle.  The package lifecyle seems to take care of the full process from generating resource to building the apk, seemed like the right one to choose from.

The only other thing that I needed to change what the name of the "APK" to run when launching the app from IntelliJ.  Since maven by default will append the "-XX-SNAPSHOT.apk" to your apk, IntelliJ wasn't finding my apk.  I did that from the "Facet" section in the project configuation window under the "Compiler" tab.

And voila!

Comment actions Permalink

I've followed your answer with a little change.
I'm running a J2EE under tomcat, I've removed Make and added Clean and Package before deploy and everything is running fine


Please sign in to leave a comment.