gpt4 book ai didi

java - 如何在Intellij中使用Gradle构建OpenFire插件?

转载 作者:行者123 更新时间:2023-12-03 06:19:01 26 4
gpt4 key购买 nike

根据OpenFire文档(https://www.igniterealtime.org/builds/openfire/docs/latest/documentation/plugin-dev-guide.html)构建自定义插件,我需要使用以下文件夹结构创建一个jar:

myplugin/
|- plugin.xml <- Plugin definition file
|- readme.html <- Optional readme file for plugin, which will be displayed to end users
|- changelog.html <- Optional changelog file for plugin, which will be displayed to end users
|- logo_small.gif <- Optional small (16x16) icon associated with the plugin (can also be a .png file)
|- logo_large.gif <- Optional large (32x32) icon associated with the plugin (can also be a .png file)
|- classes/ <- Resources your plugin needs (i.e., a properties file)
|- database/ <- Optional database schema files that your plugin needs
|- i18n/ <- Optional i18n files to allow for internationalization of plugins.
|- lib/ <- Libraries (JAR files) your plugin needs
|- web <- Resources for Admin Console integration, if any
|- WEB-INF/
|- web.xml <- Generated web.xml containing compiled JSP entries
|- web-custom.xml <- Optional user-defined web.xml for custom servlets
|- images/

我知道有一个Ant构建脚本可以帮助完成此任务,但是我找不到它,而且我在Gradle和Maven上度过了很辛苦的时间,我宁愿不必再去学习Ant和处理XML。杂务 list 。因此,我试图制作一个Gradle构建脚本。不幸的是,Gradle对我仍然没有任何意义,在Intellij中,它似乎可以做任何想做的事情。

无论如何,这是我想出的Gradle脚本。
task buildPluginJar {
group 'build'
description 'Builds OpenFire Plugin Jar'
println 'Clean old libs and classes.'
delete 'pluginDefinition/lib/*'
delete 'pluginDefinition/classes/*'
println 'Copy libs.'
copy {
into 'pluginDefinition/lib'
from configurations.runtime
}
println 'Copy classes.'
copy {
into 'pluginDefinition/classes'
from 'build/classes'
}
println 'Build jar.'
String outputPath = 'build/out/' + project.name + '.jar';

jar {
into outputPath
from fileTree('pluginDefinition/').include('**/*').collect { zipTree it }
}
}

我设法使文件复制正常工作,但是应该将其全部放入信号 jar 的末尾无法正常工作。它完成了,但是没有jar输出。我究竟做错了什么?

最佳答案

我不知道如何用Gradle做到这一点。但是我确实弄清楚了如何使用Intellij构建jar。我遵循了本教程:
http://blog.jetbrains.com/idea/2010/08/quickly-create-jar-artifact/

我浏览了File> Project Structure菜单,并添加了两个 Artifact 。一种使用我的pluginDefinition / lib文件夹中的所有Java代码构建jar,另一种使用我可以安装在Openfire服务器上的pluginDefinition文件夹的全部内容构建jar。

不过,如果我可以使用Gradle做到这一点,那将还是不错的。

关于java - 如何在Intellij中使用Gradle构建OpenFire插件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27671434/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com