Docker环境搭建Jira:合适性评估


系统 Mac 语言 JAVA JIRA 6.4.6 


1、首先安装本地开发环境,JIRA提供SDK,供本地运行及开发。

SDK安装参考文档: https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project/install-the-atlassian-sdk-on-a-linux-or-mac-system

 

2、环境搭建好就可以开发插件了。


SDK中 JIRA 版本和 实际使用的JIRA版本比对。以防代码不可用的情况出现。

插件开发使用的 maven 项目,可通过其中引入的 JIRA 包版本来比对。

这里重点:SDK 中默认引入的是:jira-api 包,可用于web界面开发;功能开发的话,需要放开已注释的jira-core包。

而 jira-core 包 maven 中央仓库是不提供的。可在 pom.xml 文件中添加如下配置:

 

<repositories>

<repository>
            <id>atlassian-public</id>
            <url>https://maven.atlassian.com/repository/public</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
                <checksumPolicy>warn</checksumPolicy>
            </snapshots>
            <releases>
                <enabled>true</enabled>
                <checksumPolicy>warn</checksumPolicy>
            </releases>
        </repository>
        <repository>
            <id> central</id>
            <name> Maven Repository Switchboard</name>
            <layout> default</layout>
            <url> http://repo1.maven.org/maven2</url>
            <snapshots>
                <enabled> false</enabled>
            </snapshots>
        </repository>
    </repositories>
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.

 

如上导包之后还有问题:jndi 包导入不成功,是因为jndi 的使用需要许可,直接 maven 不可引入。我的处理办法是,JIRA SDK安装目录下有个 repository文件,从中可以找到 jndi 的 jar 包,把这个 jar 包拷贝到项目 maven jar的目录下,假装下载下来了。

官方说明: https://developer.atlassian.com/jiradev/jira-platform/jira-architecture/building-jira-from-source

jira 用docker 合适吗 jira搭建环境_JIRA

 


 

 插件开发参考文档: https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project/create-a-helloworld-plugin-project

该插件 DEMO 文档对应的是 JIRA 菜单栏的开发。

 

功能开发以 workflow 开发为例, 参考文档: https://developer.atlassian.com/jiradev/jira-platform/guides/workflow/tutorial-creating-workflow-extensions#Tutorial-Creatingworkflowextensions-Part2.Createtheworkflowpostfunction

 

以下实践步骤为workflow中post function开发:

1️⃣不需要输入参数的 post function:

根据文档中,插件使用WorkflowNoInputPluginFactory类,然后把原来的父类删除。插件编译没有问题,但是上传之后出现不可用的情况。

解决办法:(从网上搜索得,方法不太好,但是解决了办法)

插件包下创建Factory类,内容为:

public class Factory extends AbstractWorkflowPluginFactory implements WorkflowPluginFactory {
    protected void getVelocityParamsForInput(Map<String, Object> map) {
 
    }
 
    protected void getVelocityParamsForEdit(Map<String, Object> map, AbstractDescriptor abstractDescriptor) {
 
    }
 
    protected void getVelocityParamsForView(Map<String, Object> map, AbstractDescriptor abstractDescriptor) {
 
    }
 
    public Map<String, ?> getDescriptorParams(Map<String, Object> map) {
        return null;
    }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.

2️⃣需要输入参数的post function:

直接使用生成的 factory类,但是运行时,到输入参数部分报错,WorkflowManager类自动注入不成功。问题解决通过文档: https://bitbucket.org/atlassian/atlassian-spring-scanner/src/1.2.x/README.md?at=1.2.x&fileviewer=file-view-default

主要的部分是在pom.xml 文件中:

找到这部分:

<plugins>
    <plugin>
        <groupId>com.atlassian.maven.plugins</groupId>
        <artifactId>maven-jira-plugin</artifactId>
修改<Import-Package>中的内容为:
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
com.atlassian.plugin.osgi.bridge.external,
*;resolution:=optional
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.

 

同时需要在 生成的Factory类中类名上加:

jira 用docker 合适吗 jira搭建环境_jira 用docker 合适吗_02

构造函数中:

在头部添加 @Autowired 注解。

即可。


添加自定义的邮件通知

1、添加自定义事件

参考文档:   https://confluence.atlassian.com/jira064/adding-a-custom-event-720412690.html

2、添加自定义邮件模板

参考文档: https://confluence.atlassian.com/adminjiraserver071/customizing-email-content-802592932.html

 

问题点是:

1、自定义的事件使用自定义的邮件模板。

在:Adding a custom event 步骤中,选择 Template 时,选择自定义的模板。

2、自定义的 vm 文件按相同名称在 html、text、subject分别设置一份。(各文件夹下的格式可参考同文件夹下的其他文件) 

 

 


弹出界面中都会带有备注框,很杂乱。可以通过配置去除掉。

在字段配置中选取 在弹出框中含有的字段,点编辑,然后在描述中添加如下 js:

<script type="text/javascript">
if(AJS.$('#issue-workflow-transition-submit').val() =='一评会邀'){
AJS.$('div.comment-input').css('display', 'none');
}
</script>
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.

即可。 



QR Code
微信扫一扫,欢迎咨询~

联系我们
武汉格发信息技术有限公司
湖北省武汉市经开区科技园西路6号103孵化器
电话:155-2731-8020 座机:027-59821821
邮件:tanzw@gofarlic.com
Copyright © 2023 Gofarsoft Co.,Ltd. 保留所有权利
遇到许可问题?该如何解决!?
评估许可证实际采购量? 
不清楚软件许可证使用数据? 
收到软件厂商律师函!?  
想要少购买点许可证,节省费用? 
收到软件厂商侵权通告!?  
有正版license,但许可证不够用,需要新购? 
联系方式 155-2731-8020
预留信息,一起解决您的问题
* 姓名:
* 手机:

* 公司名称:

姓名不为空

手机不正确

公司不为空