Examples of compiling and importing Mule

Source: Internet
Author: User
This article describes how to compile the built-in examples of Mule and import them to the eclispe project.
1. Prepare
Install Mule: the previous article in my blog: A simple example of Mule installation and development and deploymentThis section describes how to install Mule and develops a simple example. Here we will not introduce the installation of mule. You can refer to the previous article.
2. Compile the Hello example in the Mule built-in example.
Use the command line to go to the directory: C: \ Mule \ mule-2.1.2 \ examples \ hello, and enter mvn. Maven needs to be installed here, which is described in the previous article.
3. Import the Eclipse project
Enter the command mvn eclipse: After eclipse is successful, you can import eclipse.
4. Import this project to eclipse
(1) Select File> Import.
(2) Select: Expand "General" and select "Existing Projects into Workspace"
(3) Select Browse. After the import, select Finish. Complete.
5. Configure the Elipse Project (build path)
(1) Right-click the project and select "Build Path->
Configure Build ":

(2) Select "Libraries-> Add Library"
(3) Click "User Library" and "Next"
(4) Click "User Libraries" and click "New"
(5) Enter MULE_LIB and click "OK"
(6) Click "Add JARs", select \ lib \ Mule under the mule main directory, select all jar packages, and click "Open"
(7) Click "OK" and click "Finish"
(8) Click "Add Variable", click "Configure Variables", and click "New"
(9) Enter M2_REPO and select a directory. By default, Maven will put the downloaded jar package in: C: \ Documents ents and Settings \ Administrator \. in the m2 \ repository directory, Administrator is my User Name. Here, the directory I set is C :\. m2 \ repository, you can copy all the files in that directory to this directory. Click "Folder" and select C: \. m2 \ repository.

(10) Click "OK", click "yes", and click "OK ". The settings are complete.
6. Run the project
(1) Right-click the project and select "Run-> Run deployments"
(2) double-click "Java Application" and change the name to "Hello". Select org. mule. MuleServer as the main class.

(3) In the Arguments option table, enter-config conf \ hello-config.xml in the Program Arguments box
(4) Click "Apply" and "Run ". Running example,


7. Description
When you use the mvn command to compile an example project, you may encounter a problem where the jar file is not successfully downloaded. You can manually download it and put it in that directory. I have compiled all the examples provided by Mule and imported them to the eclipse project. If the reader does not compile the example project successfully and the example project is required, leave a mailbox. I will send it to my mailbox.

Well, I have read several Mule examples over the past few days. I feel that the loanbroker example is quite good and representative. I will explain this example in future articles. The next article is about the Mule source code. I have imported the Mule source code into the eclipse project. Now, the task is to read the mule source code. If you are interested, you can study it together.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.