搭建windows下openfire调试环境

来源:互联网 发布:新东方 网络家教 编辑:程序博客网 时间:2024/06/03 13:50

转载自: http://blog.csdn.net/kl222/article/details/22404079


在eclipse中用ant进行编译、调试:

下载openfire源码:

svn co http://svn.igniterealtime.org/svn/repos/openfire/trunk openfire

 

导入工程:

File->New->project:

选择“Java project from existing ant buildfile”

打开ant编译工程:


在这过程中,有可能会报错:

Specified buildfile does not contain a javac task

解决方法为:

加入下面一行:

<javac srcdir="src" destdir="bin" />


 

再从菜单windows->show view->ant 打开ant工具对话框:

打开ant编译文件build.xml:

 

当编译完成后,在源码根目录下会生成一个target目录:

 

选择run选项点运行,就开始了用ant运行openfire了。也可以直接运行target/openfire/bin/openfire.bat

 


------------------------------------------------------------------------------------------------------------------------------------------------

上面方法可以在eclipse 中编译运行openfire,但是不能调试。现在设置eclipse来调试openfire:

禁止自动编译:Project->build automatically:


建立openfire 工程,打开菜单:File->New->java project


点下一步:


设置编译者:Project->properties:





修改编译者名字:





修改编译目标:默认只编译openfire核心。如果要编译插件,需要选上 plugins 目标。




禁用默认的java编译者,使用新建立的openfire_build编译者,并移动顶端:



现在可以在工程点右键,并点build project (或者 菜单中 project->build project),编译工程。


设置调试,工程右键->Debug As->Debug Configurations(或 菜单->Run->Debug Configurations):

弹出一个对话框,在左侧菜单中右键点击Java Application,选择New创建启动配置



 

1.在Debug窗口的Main选项卡中, 修改最上面Name文本框中的值,改成包含要启动的类的工程名openfire

(没什么用,就是一个标识,随便起名字。)

 

2.在Run窗口的Main选项卡中,

project框中填写:openfire

Main class 填写:org.jivesoftware.openfire.starter.ServerStarter  (这个需要先设置了Arguments才会有)

点击Apply应用。

 

3.点击进入Arguments选项卡,在上面那个框(VM arguments:)中填写

-DopenfireHome="d:\source\Openfire\Openfire\target\openfire"

这里是我的openfire用ant编译后生成的目标位置,你的 openfire要根据你的项目位置来进行同步修改。

-Dopenfire.lib.dir="d:\source\Openfire\Openfire\target\openfire\lib"

点击Apply应用。

 

4.点击进入Classpath选项卡,选中User Entries,然后点击右侧的Advanced按钮,会弹出一个小框,选择Add External Folders,单击OK。

选择 d:\source\Openfire\Openfire\i18n点OK 按钮将这个文件夹加入到Classpath选项卡中

选择 d:\source\Openfire\Openfire\target\openfire\resources目录也加到 Classpath选项卡中

选择Add External Jars:


选择 d:\source\Openfire\Openfire\target\openfire\lib

d:\source\Openfire\Openfire\target\openfire\plugins\

中所有的jar文件。


点击Apply应用。

5.点击进入Common选项卡中,勾选Debug复选框。

点击Apply应用。

 

在进行这些配置之后,就算是基本完工了。

可以直接点击配置框最下方的Run按钮,或者单击菜单栏Run->Run开始跑程序。

 

工程->右键->Debug as->debug configurations:

 

 

 

 设置好后,点debug,就可以开始有eclipse中调试openfire了。

 

其它操作详见:http://blog.csdn.net/kl222/article/details/7043130

用eclipse工程进行编译调试:http://www.micmiu.com/opensource/openfire/openfire-src-config/

Eclipse中集成和调试Ant工程:http://www.uml.org.cn/j2ee/201205103.asp

官网:https://community.igniterealtime.org/docs/DOC-1020


原创粉丝点击