Creating a Mule Project with maven is very simple and easy . Here is the sample example maven pom file for mule project .
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com</groupId> <artifactId>javaroots</artifactId> <version>1.0</version> <name>muleMavenSample</name> <packaging>mule</packaging> <description>This is a sample pom file for mule project</description> <properties> <muleVersion>3.3.1</muleVersion> <project.build.sourceEncoding>Cp1252</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>org.mule</groupId> <artifactId>mule-core</artifactId> <version>${muleVersion}</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-core</artifactId> <version>1.6</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-json</artifactId> <version>1.6</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-client</artifactId> <version>1.6</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc5</artifactId> <version>11.2.0</version> </dependency> <!-- Active MQ Dependency --> <dependency> <groupId>org.apache.activemq</groupId> <artifactId>activemq-client</artifactId> <version>5.8.0</version> </dependency> <!-- Core Spring dependency for task executor --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>3.1.0.RELEASE</version> <scope>provided</scope> </dependency> <!-- Junit dependency --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>3.1.0.RELEASE</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>3.1.0.RELEASE</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>3.1.0.RELEASE</version> <scope>test</scope> </dependency> </dependencies> <repositories> <repository> <id>codehaus</id> <name>Codehaus Release Repository</name> <url>http://repository.codehaus.org</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>codehaus-snapshots</id> <name>Codehaus Snapshots Repository</name> <url>http://snapshots.repository.codehaus.org</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>false</enabled> </releases> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>apache-plugin-snapshots</id> <name>Apache Maven Plugins Snapshot Repository</name> <url>http://people.apache.org/maven-snapshot-repository</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>false</enabled> </releases> </pluginRepository> </pluginRepositories> <build> <defaultGoal>install</defaultGoal> <finalName>${project.artifactId}</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <groupId>org.mule.tools</groupId> <artifactId>maven-mule-plugin</artifactId> <version>1.7</version> <extensions>true</extensions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.12.4</version> <configuration> <skipTests>true</skipTests> </configuration> </plugin> </plugins> </build> <profiles> <profile> <id>dev</id> <activation> <activeByDefault>true</activeByDefault> </activation> <build> <resources> <resource> <directory>src/main/app</directory> </resource> <resource> <directory>src/main/resources/dev</directory> </resource> <resource> <directory>src/main/resources/common</directory> </resource> </resources> </build> </profile> <profile> <id>test</id> <build> <resources> <resource> <directory>src/main/app</directory> </resource> <resource> <directory>src/main/resources/test</directory> </resource> <resource> <directory>src/main/resources/common</directory> </resource> </resources> </build> </profile> <profile> <id>prod</id> <build> <resources> <resource> <directory>src/main/app</directory> </resource> <resource> <directory>src/main/resources/prod</directory> </resource> <resource> <directory>src/main/resources/common</directory> </resource> </resources> </build> </profile> </profiles> </project>If you try to create it with mule studio , please remove following lines from generated pom.xml
<dependency> <groupId>com.mulesoft.muleesb</groupId> <artifactId>mule-core-ee</artifactId> <version>${mule.version}</version> <scope>provided</scope> </dependency> <!-- Xml configuration --> <dependency> <groupId>com.mulesoft.muleesb.modules</groupId> <artifactId>mule-module-spring-config-ee</artifactId> <version>${mule.version}</version> <scope>provided</scope> </dependency>Otherwise you get error like this :
The following artifacts could not be resolved: com.mulesoft.muleesb:mule-core-ee:jar:3.3.1, com.mulesoft.muleesb.modules:mule-module-spring-config-ee:jar:3.3.1: Failure to find com.mulesoft.muleesb:mule-core-ee:jar:3.3.1 in http://repository.jboss.com/ was cached in the local repository, resolution will not be reattempted until the update interval of jboss has elapsed or updates are forced -> [Help 1]Post comments and suggestions !!