首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 开源软件 >

Mule ESB浅析二——源码编译与安装

2013-01-01 
Mule ESB浅析2——源码编译与安装?基于源码进行编译1,从svn获取代码之后,命令行下进入到对应目录执行如下指

Mule ESB浅析2——源码编译与安装

?

基于源码进行编译

1,从svn获取代码之后,命令行下进入到对应目录执行如下指令

mvn –DskipTests install

?

此处mvn会下载所有的依赖库,Win7默认下载到C:\Users\user\.m2\repository目录下(路径修改位置settings.xml),此处需要几个小时的时间。该目录将被用于配置eclipse SDK。

2,从源码生成相应的eclpise工程文件,执行如下指令:

?

mvn eclipse:eclipse 或 mvnidea:idea,为了能够为所有的模块生成相应的工程文件,需要使用JDK6。另外如果需要所依赖包的源文件,则增加-DdownloadSources=true即可。

?

可能遇到的问题包括,

?

1)在执行mvn eclipse:eclipse时出现如下错误:

[ERROR] Javaheap space -> [Help 1]

[ERROR]

[ERROR] To seethe full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-runMaven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For moreinformation about the errors and possible solutions, please read the followingarticles:

[ERROR] [Help 1]http://cwiki.apache.org/confluence/display/MAVEN/OutOfMemoryError

?

解决方法,在执行mvn eclipse:eclipse之前,先执行如下命令:

set MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=128m

?

?

?

2)在执行mvn eclipse:eclipse时出现如下错误:

[ERROR] Failedto execute goal org.apache.maven.plugins:maven-eclipse-plugin:2.5.1:eclipse(default-cli) on proje

ctmule-catalog-archetype: Can't canonicalize system path:E:\mule-3x\tools\mule-catalog-archetype\target\classes

\E:\mule-3x\tools\mule-catalog-archetype\target\classes:文件名、目录名或卷标语法不正确。 -> [Help 1]

[ERROR]

[ERROR] To seethe full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-runMaven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For moreinformation about the errors and possible solutions, please read the followingarticles:

[ERROR] [Help 1]http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

[ERROR]

[ERROR] Aftercorrecting the problems, you can resume the build with the command

[ERROR]?? mvn <goals> -rf:mule-catalog-archetype

?

解决方法:

在出错路径E:\mule-3x\tools\mule-catalog-archetype下找到对应的pom.xml文件,

将Configuration->resources->resource中的directory和targetPath去掉${project.build.directory}前缀。

?

?

3,在eclipse中编译源码

可能出现的问题包括,

?

1)编译出错信息为:

**具有不受限制的类路径变量***

?

解决方法:

增加相关的路径宏定义,具体位置为:窗口à首选项à java->构建路径à 类路径变量

?

2)编译出错信息为:

访问限制:由于对必需的库 C:\Program Files\Java\jre6\lib\rt.jar 具有一定限制,因此无法访问类型 Handler

?

解决方法:

对应项目右击,属性à java构建路径 à 库 à 展开JRE系统库 à 双击Accessrules –> 添加 (分辨率为:可访问,规则模式为:**)

?

3)出错信息:

新导入的工程无法import部分库,直接点击无法导入的类,右击选择“Fixproject setup”,此时会自动搜索到M2_REPO路径下的库,选中即可。

?

?

4,安装eclipse的Mule IDE插件。

?

首先下载Mule IDE 插件:http://dist.muleforge.org/mule-ide/releases/中下载最新版本。

?

使用eclipse的本地插件安装即可。

?

?

可能遇到的问题:

1)提示缺包:org.apache.commons.lang 2.3.0

?

解决方法:

从http://www.mirrorservice.org/sites/download.eclipse.org/eclipseMirror/releases/ganymede/plugins/下载org.apache.commons.lang2.3.0,拷贝到mule ide 的plugin下。

?

?

5,创建Mule工程

Fileà New à Other,展开Mule文件夹,选择Mule Project来生成Mule工程,选择Mule Configuration来生成xml配置文件。只有配置了命名空间,脚本才会生效。

?

6,编译测试代码

1)基于发布包编译

?

编译问题

需要指定测试代码依赖的mule库,否则会报定义找不到。具体添加方法:

右击项目à属性 à java构建路径 à 库 à 添加库 à MuleClasspath 选择”use aproject specific Mule distribution”,全选所有的库。

?

执行问题

出错信息:Could not find the main class org.mule.muleserver

?

解决方法:

此处是由于不是创建mule工程,而是导入了原有的测试工程,因此删除该工程重新创建mule工程2)即可。

?

?

2)基于源码编译

?

新建测试代码工程,增加相关源码的依赖关系,位置propertiesàjavaBuildpathàProjects,主要有mule_core,spring相关工程,实际使用到的transport的相关工程。

?

http://www.mulesoft.org/download-mule-esb-community-edition

下载windows版本或者linux版本,直接解压即可。

?

本地使用windows版本,下需要设置MULE_HOME到解压路径,同时,设置%MULE_HOME%/hin到PATH路径下。

调用populate_m2_repo.cmd c:\.m2\repository,会将本地的Mule Enterprise jar包存放到maven下载的存储库中

命令行启动:mule [-config<your-config.xml>]

?

?

下一篇介绍Mule和tomcat集成的使用与调试。

?

?

?

热点排行