<settings>
<pluginGroups>
<pluginGroup>org.mule.tools</pluginGroup>
</pluginGroups>
...
</settings>
Creating Project Archetypes
Mule provides Maven archetypes that you can use as code templates for your Mule projects. These templates include a set of implementation notes and "to-do" pointers that help you get started quickly. The Mule project archetype helps you generate a tailored boilerplate project in seconds.
Follow the instructions below to create template files for a new project, including all the necessary Java boilerplate and detailed implementation instructions.
To create an APIKit project using an APIKit archetype check the Creating APIKit projects with Maven. |
Configuring Maven
Add the following to the settings.xml
file (usually in your Maven $HOME/.m2
or conf
directory, for example, /usr/local/apache-maven/apache-maven-<version>/conf
) so that Maven allows you to execute Mule plug-ins.
Using the Archetype
First, open a command shell and change to the directory where you want to create your project.
cd yourDir
Next, execute the archetype and generate the code. If this is your first time running this command, Maven downloads the archetype for you.
mvn mule-project-archetype:create -DartifactId=xxx -DmuleVersion=3.1.1
At minimum, you pass in two system parameters:
-
artifactId
: The short name for the project (such as 'myApp'). This must be a single word in lower case with no spaces, periods, hyphens, etc. -
muleVersion
: The version of the Mule project archetype you want to use. This is the default Mule version used for the generated artifact.Running the archetype
By default, Maven uses the latest available version of the archetype. This can cause problems if you want to create a project for an earlier version of Mule. In this case, run the mule-project-archetype specifying the full version of the plug-in like this:
mvn org.mule.tools:mule-project-archetype:3.1.1:create ...
artifactId
The
artifactid
can contain characters such as underscore or hyphen. However, the plug-in will convert the name into a usable form suitable for Java. For example, if the argument is specified as-DartifactId=My#Awesome-Mule_Project
, the project is created in a directory of that name, but the project name will beMyAwesomeMuleProject
and the package name is.myawesomemuleproject
.
The plug-in asks various questions (described below) and then generates the files. You can also use this plug-in without user prompts by entering all the arguments at the command line.
Example Console Output
The plug-in prompts you to answer several questions about the project you are creating. These may vary according to the options you select. An example of the output is shown below.
[INFO] description:
********************************************************************************
Provide a description of what the project does:
[default:]
********************************************************************************
[INFO] muleVersion:
********************************************************************************
Which version of Mule is this module targeted at?
[default: 3.1.0]
********************************************************************************
[INFO] package:
********************************************************************************
What is the base Java package path for this project? (i.e. com/mycompany/project):
[default:]
********************************************************************************
[INFO] transports:
********************************************************************************
Which Mule transports do you want to include in this project?
(options: axis,cxf,ejb,file,ftp,http,https,imap,imaps,jdbc,
jetty,jms,multicast,pop3,pop3s,quartz,rmi,servlet,smtp,
smtps,servlet,ssl,tls,stdio,tcp,udp,vm,xmpp):
[default: cxf,file,http,jdbc,jms,stdio,vm]
********************************************************************************
[INFO] modules:
********************************************************************************
Which Mule modules do you want to include in this project?
(options: builders,client,jaas,jbossts,management,ognl,pgp,scripting,
spring-extras,sxc,xml):
[default: client,management,scripting,sxc,xml]
********************************************************************************
OGNL is deprecated in Mule 3.6 and will be removed in Mule 4.0. |
After you have answered all the questions, the archetype creates a directory using the project name you specified that includes a POM file for building with Maven, a Mule configuration file (src\main\resources\mule-config.xml
) that includes the namespaces for the transports and modules you specified and has placeholder elements for creating your first flow, and a package.html
file under src\main\java
using the package path you specified. Lastly, it creates some template files under src\test
to help you get started creating a unit test for the project. A new MULE-README.txt
file will be created in the root of your project explaining what files were created.
The Questions Explained
Provide a description of what the project does:
You should provide an accurate description of the project with any high-level details of what you can or cannot do with it. This text will be used where a description of the project is required.
Which version of Mule is this project targeted at?
The version of Mule you want to use for your project. This will default to the archetype version passed in on the command line.
What is the base Java package path for this project?
This should be a Java package path for you project, such as com/mycompany/project. Note that you must use slashes for separators, not periods.
Command Line Options
By default, this plug-in runs in interactive mode, but it’s possible to run it in 'silent' mode by using the following option:
-DinteractiveMode=false
The following options can be passed in:
Name | Example | Default Value |
---|---|---|
|
|
|
|
|
none |
|
|
|
|
|
none |
|
|
none |
|
|
none |
|
|
|
|
|
|
|
|
none |
|
|
|
|
|
|
You need to use double quotes when passing values with spaces in between. |