Maven profiles and filtered resources in IntelliJ 9

I have a properties file whose contents are filtered based on properties defined in a series of Maven profiles.  The properties define database connection information (driver, username, etc).  It is used to run JUnit tests.  IntelliJ+Maven is working great so long as I run the tests with the default profile.  However as soon as I try to use one of the other profiles I have problems.  The issue is that it does not use the properly filtered property file.

In fact, I switched the profile in the Maven tool window and ran the "process-test-resources" phase (again via the Maven tool window).  I verified that the properties file was filtered correctly and moved to the target directory.  However as soon as I try to run the test something regenerates that resource filtering back in the default profile values.  Quite frustrating.

What do I need to do in order to run tests in IntelliJ under a different Maven profile?  Is that even possible in IntelliJ?

BTW, here is the resource file: http://fisheye.jboss.org/browse/Hibernate/core/trunk/testsuite/src/test/resources/hibernate.properties?r=16397
and here is the pom containing the profiles: http://fisheye.jboss.org/browse/Hibernate/core/trunk/parent/pom.xml?r=19358#l557

It is the h2 profile with which I am trying to run.

And yes it works fine from both command line and hudson which are the other 2 environments I utilize.

Any thoughts?

2 comments
Comment actions Permalink

Old question, but for anyone running across this it from google (I ended up here after having the same issue):

Open the maven projects window and deselect all but the test specific profile. The unit tests will then run under that one.

0
Comment actions Permalink

Your solution doesn't work for me and I made issue for this http://youtrack.jetbrains.net/issue/IDEA-74508

0

Please sign in to leave a comment.