- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在关注Atlassian's Tutorial - Custom message (mail) handler for JIRA
我在倒数第二步中碰壁了:
3) Create a new file named EditDemoHandlerDetailsWebAction.java in src/main/java/com/example/plugins/tutorial/jira/mailhandlerdemo directory, and give it the following contents:
package com.example.plugins.tutorial.jira.mailhandlerdemo;
import com.atlassian.configurable.ObjectConfigurationException;
import com.atlassian.jira.plugins.mail.webwork.AbstractEditHandlerDetailsWebAction;
import com.atlassian.jira.service.JiraServiceContainer;
import com.atlassian.jira.service.services.file.AbstractMessageHandlingService;
import com.atlassian.jira.service.util.ServiceUtils;
import com.atlassian.jira.util.collect.MapBuilder;
import com.atlassian.plugin.PluginAccessor;
import java.util.Map;
public class EditDemoHandlerDetailsWebAction extends AbstractEditHandlerDetailsWebAction {
private final IssueKeyValidator issueKeyValidator;
public EditDemoHandlerDetailsWebAction(PluginAccessor pluginAccessor, IssueKeyValidator issueKeyValidator) {
super(pluginAccessor);
this.issueKeyValidator = issueKeyValidator;
}
private String issueKey;
public String getIssueKey() {
return issueKey;
}
public void setIssueKey(String issueKey) {
this.issueKey = issueKey;
}
// this method is called to let us populate our variables (or action state)
// with current handler settings managed by associated service (file or mail).
@Override
protected void copyServiceSettings(JiraServiceContainer jiraServiceContainer) throws ObjectConfigurationException {
final String params = jiraServiceContainer.getProperty(AbstractMessageHandlingService.KEY_HANDLER_PARAMS);
final Map<String, String> parameterMap = ServiceUtils.getParameterMap(params);
issueKey = parameterMap.get(DemoHandler.KEY_ISSUE_KEY);
}
@Override
protected Map<String, String> getHandlerParams() {
return MapBuilder.build(DemoHandler.KEY_ISSUE_KEY, issueKey);
}
@Override
protected void doValidation() {
if (configuration == null) {
return; // short-circuit in case we lost session, goes directly to doExecute which redirects user
}
super.doValidation();
issueKeyValidator.validateIssue(issueKey, new WebWorkErrorCollector());
}
}
The class inherits from AbstractEditHandlerDetailsWebAction which allows us to concentrate on parameter validation. It takes care of the add, edit, and cancel handler lifecycle itself.
本教程应该支持 JIRA 5.0+,包括最新版本到 7.2
我使用的是 JIRA 7.1.8
我的问题是maven无法找到
的依赖项import com.atlassian.jira.plugins.mail.webwork.AbstractEditHandlerDetailsWebAction;
经过大量挖掘,我发现 com.atlassian.jira.plugins.mail
exists in the specs for up to JIRA 5.1.8
但是,in the specs for 5.2-m03以后,这个文件夹就不存在了,这就是为什么maven找不到它。
此外,我找不到任何说明这些类已被弃用的信息,也找不到任何关于我应该用什么来替换我的 JIRA 版本的代码的建议。
那么,我可以使用什么来代替上面类中看似已弃用的 com.atlassian.jira.plugins.mail.webwork.AbstractEditHandlerDetailsWebAction;
?
最佳答案
无论出于何种原因,JIRA 邮件插件的版本号与 JIRA 本身的版本号变得分离。一旦确保引用了正确版本的邮件插件,您就可以构建项目。
我能够按如下方式构建它:
git clone https://bitbucket.org/atlassian_tutorial/jira-add-email-handler.git
您可以通过查看 JIRA 安装目录轻松完成此操作。在我安装的 JIRA 7.1 中,邮件插件是 v9.0.3:
$ find <PATH_TO_JIRA_INSTALL>/atlassian-jira -name '*jira-mail-plugin*.jar'
<your path here>/atlassian-jira/WEB-INF/atlassian-bundled-plugins/jira-mail-plugin-9.0.3.jar
这是我针对 pom.xml 应用的补丁:
diff --git a/pom.xml b/pom.xml
index f493ef2..a3bbb8f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -54,7 +54,7 @@
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-mail-plugin</artifactId>
- <version>${jira.version}</version>
+ <version>${jira.mail.plugin.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -104,8 +104,9 @@
</build>
<properties>
- <jira.version>6.0.4</jira.version>
- <amps.version>4.2.0</amps.version>
+ <jira.version>7.1.8</jira.version>
+ <jira.mail.plugin.version>9.0.3</jira.mail.plugin.version> <!-- the version of the mail plugin shipped with your version of JIRA -->
+ <amps.version>5.0.4</amps.version> <!-- Adjust this to the specific version of the plugin SDK you have installed -->
<plugin.testrunner.version>1.1.1</plugin.testrunner.version>
<!-- TestKit version 5.x for JIRA 5.x, 6.x for JIRA 6.x -->
<testkit.version>5.2.26</testkit.version>
DemoHandler 中还有另一个引用,您必须将其从 User
更改为 ApplicationUser
。
之后,它就为我构建了。
关于java - 替换 7.X 版 Atlassian JIRA 插件中已弃用的 AbstractEditHandlerDetailsWebAction,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39670569/
我是一名优秀的程序员,十分优秀!