I'm a newbie on MuleSoft. I created a Maven Mule Project and one of my flows have the component Http Request. This component has the attribute "host". However, I have 2 environments: Test and Production. Is it possible to dynamically change the "host" attribute value, depending the profile created on maven?
@Sudarshan helped me a lot! However, the maven solution was not working. What I did was:
On maven, I added the following plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>write-active-profile-properties</goal>
</goals>
<configuration>
<outputFile>
${project.build.outputDirectory}/conf-app.properties
</outputFile>
</configuration>
</execution>
</executions>
</plugin>
To create the profile on maven, what I did was:
<profile>
<id>qa</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<host>999.999.999.999</host>
<port>8080</port>
<basePath>/v1</basePath>
</properties>
</profile>
</profiles>
Then, in the xml flow located on src/main/app my HTTP Request is as the following:
<http:request-config name="HTTP_Request_Configuration" host="${host}" port="${port}" basePath="${basePath}" doc:name="HTTP Request Configuration"
connectionIdleTimeout="180000" />
To run the profile created, use the following command on maven:
mvn clean package -Paq -X
After that, you will be good to go!