IM即时聊天系统-Openfire爬坑之路二 运行源码

工具和源码

  • 编辑器工具是IDEA ,
  • 管理构建工具Maven,
  • openfire源码4.6.0-SNAPSHOT

将项目导入IDEA

建项目用IDEA打开后需要进行一下配置:

步骤:

Run -> Edit Configurations... -> Add Application

填一下值

Name: Openfire
Use classpath of module: starter
Main class: org.jivesoftware.openfire.starter.ServerStarter
VM options (adapt accordingly):将以下代码,替换你的项目地址,填入

-DopenfireHome="换成你项目文件的目录\distribution\target\distribution-base" 
-Xverify:none
-server
-Dlog4j.configurationFile="换成你项目文件的目录\distribution\target\distribution-base\lib\log4j2.xml"
-Dopenfire.lib.dir="换成你项目文件的目录\distribution\target\distribution-base\lib"
-Dfile.encoding=UTF-8

结果如下图:

openfire idea运行配置.png

构建

在Terminal终端运行以下代码:

./mvnw verify

如果值改了主模块,那么只需要运行:

./mvnw verify -pl distribution -am 

将项目导入后,很多依赖的插件和库,下载不了,报红
解决方案,以下两种:

  1. 在有报红的pom文件中添加阿里云的maven仓库
<repositories>
    <repository>
        <id>central</id>
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        <layout>default</layout>
        <!-- 是否开启发布版构件下载 -->
        <releases>
            <enabled>true</enabled>
        </releases>
        <!-- 是否开启快照版构件下载 -->
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>
  1. maven 手动下载命令


    举个栗子:maven-assembly-plugin
mvn dependency:get -DremoteRepositories=https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-assembly-plugin
-DgroupId=org.apache.maven.plugins
-DartifactId=maven-assembly-plugin
-Dversion=3.2.0
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容