The Maven build fails with MuleSoft applications, resulting in the exception of type "Unknown packaging: mule-application" when using multiple profiles in the pom.xml file.
The "Unknown packaging: mule-application" exception might happen when there are multiple build segments loading the "org.mule.tools.maven" Mule Maven plugin in the different profiles defined the pom.xml as demonstrated below:
<profiles>
<!-- Profile for environment-1 -->
<profile>
<id>profile-1</id>
<activation>
<property>
<name>ENV</name>
<value>environment-1</value>
</property>
</activation>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/app</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
.......
.......
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-maven-plugin</artifactId>
.......
.......
</plugin>
</plugins>
</build>
</profile>
</profiles>
<profiles>
<!-- Profile for environment-2 -->
<profile>
<id>profile-2</id>
<activation>
<property>
<name>ENV</name>
<value>environment-2</value>
</property>
</activation>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/app</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
.......
.......
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-maven-plugin</artifactId>
.......
.......
</plugin>
</plugins>
</build>
</profile>
</profiles>
With the Mulesoft Maven plugin, resolve the "Unknown packaging: mule-application" exception, by having one build segment defined in the "pom.xml" for all the profiles created. Here is a sample solution:
<profiles>
<!-- Profile for environment-1 -->
<profile>
<id>profile-1</id>
<activation>
<property>
<name>ENV</name>
<value>environment-1</value>
</property>
</activation>
</profile>
</profiles>
<profiles>
<!-- Profile for environment-2 -->
<profile>
<id>profile-2</id>
<activation>
<property>
<name>ENV</name>
<value>environment-2</value>
</property>
</activation>
</profile>
</profiles>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/app</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
.......
.......
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-maven-plugin</artifactId>
.......
.......
</plugin>
</plugins>
</build>
001115753

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.