第四章 Openfire 源码导入以及开发

1.源码下载

下载地址:http://download.igniterealtime.org/openfire/openfire_src_4_0_2.zip

2.解压,导入

一.解压

源码目录 解压出来的目录结构如上

然后我们进入build目录,将eclipse目录下的文件复制到上面的目录下面,修改复制过来的三个文件名称,统一加上 . 开头。名字的话需要进入CMD,然后用rename命令来修改。 之后

上面就是修改之后的目录。

二。导入Eclipse

将上面的文件目录修改成我们需要的名字,然后复制一份到我们的工作空间。然后直接import

具体步骤打开Eclipse,选择 File –> Import… –> Existing Projects into Workspace 选择F:\workspace\Openfire 导入即可:

导入之后,就是解决掉x号,有的jar包缺失直接删掉,我们暂时用不到他们。然后将build目录下的lib目录下的所有JAR包全部导入。正常的话就基本没有问题了。

然后用ant来编译项目,直接选择,build 目录下的build.xml run as ant build即可,然后我们就会发现目录下面多出一个work,target目录。

三。运行Openfire

在Build Path配置中把 /openfire_src/src/i18n 、/openfire_src/src/resources/jar 、/openfire_src/build/lib/dist 文件夹添加到 Source 中

配置启动参数

选择Run –> Run Configurations… 左边的Java Application,单击右键,选择 New: run

把默认name:New_configuration 修改成:ServerStarter。

选中Main选项卡,点击Browse按钮选择 openfire_src 项目;单击Search 按钮输入:ServerStarter 自动过滤后选择:ServerStarter – org.jivesoftware.openfire.starter: run

选中Arguments选项卡,在VM arguments中填入:

-DopenfireHome="${workspace_loc:Openfire}/target/Openfire"

注意:项目路径 ${workspace_loc:Openfire}

选中Common选项卡,将Debug和Run打钩(方便之后快速启动),然后点击apply,再点击run:

!!!!!注意填写上自己的项目名字。 run 然后我们看控制台日志:

SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/D:/xqWorkSpace/openfire/Openfire/build/lib/dist/slf4j-log4j12.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/D:/xqWorkSpace/openfire/Openfire/build/lib/ant/slf4j-simple.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] Openfire 4.0.2 [2016-6-27 13:17:59] 管理平台开始监听: http://f48e38942ce0:9090 https://f48e38942ce0:9091 Starting Fastpath Server

我们的Openfire源码就跑了起来。

results matching ""

    No results matching ""