Reputation: 1474
In our Mule projects we have a common properties file that is referenced from a number of Mule projects. To do this we put the file in the Mule installation directory and reference it in a flow in each project:
<spring:beans>
<context:property-placeholder
location="file:///${mule.home}/conf/common.properties" />
</spring:beans>
This works fine for running the projects in Mule and from Anypoint Studio as in both cases mule.home
is defined. It also works for running the MUnit test suites defined in the project from Anypoint Studio.
However when running the tests from Maven mule.home
is not defined and the tests fail. I've tried adding a definition to mule.home
to the Maven settings.xml
file, but that doesn't work.
Any suggestions on how I can run the tests from Maven and keep the mule.home
reference in the property flow? Or perhaps is there a way to have an alternative configuration in the property flow for when the flow is called from the test suite?
Alternatively how should we reference a common property file from multiple Mule projects?
Versions: Mule runtime: 3.6.2
Munit: 1.1.0
Maven 3.3.1
Upvotes: 1
Views: 1803
Reputation: 220
Alternatively you can set mule.home programmatically perhaps in a parent Abstract test class:
@BeforeClass
public static void setUp() {
System.setProperty("mule.home", "whatever");
}
Upvotes: 0
Reputation: 5128
Try this:
mvn -Dmule.home=yourpath test
This should do the trick. Hope this helps.
Upvotes: 3