- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在创建 confluence 宏,它应该执行我的 Java xml-rpc 客户端。
我测试了我的 Java xml-rpc 客户端,在 eclipse 中终止它(主要功能)- 它工作完美,
但是当我尝试将其与 confluence 连接时,我收到错误:
(宏已成功安装 - 输出出现错误)
Error rendering macro 'TESTLINK PLUGIN' : Could not initialize class org.apache.xmlrpc.util.SAXParsers
有人可以帮我理解这里发生了什么吗?我读到这可能是外部 jar 的问题 - 但给出的答案并不能解决我的问题。
我还使用mvn-install命令安装了我的xmlrpc,并将依赖项添加到我的pom.xml中,SAXParsers应该包含在那里......
这是我到目前为止所做的代码:
teSTLink.java:
package com.project.testlink.api;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Map;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
public class testlink {
public testlink() {
// TODO Auto-generated constructor stub
}
// Substitute your Dev Key Here
public static final String DEV_KEY = "zzzzZZz";
// Substitute your Server URL Here
public static final String SERVER_URL = "zzzZZZZ/xmlrpc.php";
public static String testLinkReport(String link)
{
String title="Error Ocurred";
String tcid = link.substring(link.lastIndexOf("=")+1);
try
{
XmlRpcClient rpcClient;
XmlRpcClientConfigImpl config;
config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL(SERVER_URL));
rpcClient = new XmlRpcClient();
rpcClient.setConfig(config);
ArrayList<Object> params = new ArrayList<Object>();
Hashtable<String, Object> executionData = new Hashtable<String, Object>();
executionData.put("devKey", DEV_KEY);
executionData.put("testcaseexternalid", tcid);
params.add(executionData);
Object[] result = (Object[]) rpcClient.execute("tl.getTestCase", params);
Map item = (Map)result[0];
title = tcid+":"+ item.get("name").toString();
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
catch (XmlRpcException e)
{
e.printStackTrace();
}
return title;
}
}
mymacro.java:
package com.project.testlink.api;
import java.util.Map;
import com.atlassian.confluence.content.render.xhtml.ConversionContext;
import com.atlassian.confluence.macro.Macro;
import com.atlassian.confluence.macro.MacroExecutionException;
public class mymacro implements Macro {
public mymacro() {
// TODO Auto-generated constructor stub
}
@Override
public String execute(Map<String, String> arg0, String arg1, ConversionContext arg2)
throws MacroExecutionException {
// TODO Auto-generated method stub
return testlink.testLinkReport("HL&item=testcase&id=7780");
}
@Override
public BodyType getBodyType() {
// TODO Auto-generated method stub
return BodyType.NONE;
}
@Override
public OutputType getOutputType() {
// TODO Auto-generated method stub
return OutputType.BLOCK;
}
/*
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(testlink.testLinkReport("HL&item=testcase&id=7780"));
}
*/
}
atlassian-plugin.xml:
<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}" />
<param name="plugin-icon">images/pluginIcon.png</param>
<param name="plugin-logo">images/pluginLogo.png</param>
</plugin-info>
<!-- add our i18n resource -->
<resource type="i18n" name="i18n" location="testlink"/>
<xhtml-macro name="TESTLINK PLUGIN" class="com.project.testlink.api.mymacro" key="mymacro" icon="/download/resources/${project.groupId}.${project.artifactId}/images/pluginIcon.png">
<category name="external-content"/>
<parameters>
<parameter name="Testlink" type="string" required="true"/>
</parameters>
<description>Inserts a calendar for the week into the current page</description>
</xhtml-macro>
<!-- add our web resources -->
<web-resource key="testlink-resources" name="testlink Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<resource type="download" name="testlink.css" location="/css/testlink.css"/>
<resource type="download" name="testlink.js" location="/js/testlink.js"/>
<resource type="download" name="images/" location="/images"/>
<context>testlink</context>
</web-resource>
</atlassian-plugin>
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.project.testlink</groupId>
<artifactId>testlink</artifactId>
<version>1.0.0-SNAPSHOT</version>
<organization>
<name>Example Company</name>
<url>http://www.example.com/</url>
</organization>
<name>testlink</name>
<description>This is the com.project.testlink:testlink plugin for Atlassian Confluence.</description>
<packaging>atlassian-plugin</packaging>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.atlassian.confluence</groupId>
<artifactId>confluence</artifactId>
<version>${confluence.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-runtime</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
<!-- WIRED TEST RUNNER DEPENDENCIES -->
<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-osgi-testrunner</artifactId>
<version>${plugin.testrunner.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2-atlassian-1</version>
</dependency>
<dependency>
<groupId>org.apache.xmlrpc</groupId>
<artifactId>xml-common</artifactId>
<version>3.1.3</version>
</dependency>
<dependency>
<groupId>org.apache.xmlrpc</groupId>
<artifactId>xml-client</artifactId>
<version>3.1.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-confluence-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${confluence.version}</productVersion>
<productDataVersion>${confluence.data.version}</productDataVersion>
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
<!-- See here for an explanation of default instructions: -->
<!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<!-- Add package to export here -->
<Export-Package>
com.project.testlink.api,
</Export-Package>
<!-- Add package import here -->
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
*
</Import-Package>
<!-- Ensure plugin is spring powered -->
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>1.2.6</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<scannedDependencies>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-external-jar</artifactId>
</dependency>
</scannedDependencies>
<verbose>false</verbose>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<confluence.version>5.10.2</confluence.version>
<confluence.data.version>5.10.1</confluence.data.version>
<amps.version>6.2.4</amps.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<atlassian.spring.scanner.version>1.2.6</atlassian.spring.scanner.version>
<!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
</properties>
</project>
最佳答案
问题已解决。
向依赖项添加了“排除”,例如 here
之后我必须从 .jar 文件中删除 SAXParsers 类,现在它可以工作了:)
The problem is that the Apache XML-RPC client library you are using has a multitude of other dependencies that it will bundle into your plugin when you compile, and they clash with libraries already shipped in JIRA.
关于java - 渲染宏出错 - 无法初始化类 org.apache.xmlrpc.util.SAXParsers,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38445527/
如何在 Excel 中编写可以在我将打开的任何 Excel 文档上工作(使用快捷方式运行)的宏? 这可能吗? 最佳答案 您需要将宏添加到 Personal.xlsb 以使它们可用于所有 excel 文
我正在研究 problem #74在4clojure.com,我的解决方案如下: (defn FPS [s] (->> (map read-string (re-seq #"[0-9]+"
我还没有完全理解Clojure 箭头宏thread-first -> 和thread-last 宏->> 之间的区别。在阅读 https://clojure.org/guides/threading_
我想将一些调试输出语句插入到大型 C 代码库中。这些调试输出语句将由编译器选项开关控制。 调试输出语句如下所示: #ifdef DEBUG_FLAG Print(someSymbol) #endif
我正在通过宏将代码注入(inject)到 C++ 类中。有没有办法根据访问修饰符的上下文来做到这一点?有点像 #if (we_are_in_public_context) INJECT_PUBLIC_
这应该与 memoize 类似,但有很大不同。虽然 memoize 应该与纯函数一起使用,但它通常对加速 IO 相关函数很有用。 我正在寻找的函数/宏应该表现得像高阶函数。它产生的功能应该: 第一次调
对于下面的代码: let services: [MyServices] = [ MyService(), #if DEBUG DebugService(), #endi
假设我有以下文本文件 name: John Doe description: My name is John Doe and I'm really good at vim! name: John Do
在创建 Excel 宏方面需要帮助。我有一个 Excel 工作表。Excel 工作表不一致。我打算使它统一和结构化。 例如。 A B C
我正在 excel 中设置一个宏,以便在更新单元格时自动发送电子邮件。是否可以在电子邮件正文中包含单元格的内容?例如,如果单元格 G7 已更新,请在电子邮件中包含单元格 B7 的内容?单元格行将是相同
我创建了一个简单的 Excel 工作表。 这是我的宏代码: Sub MyMacro() Sheets("Sheet1").Select A$ = Cells(1, 1) Msg
在 Excel 的 VB 宏中,如何删除所有出现的以某个字符串开头的单词? 例如: 字符串内容为:xxxx $AUD543.43 yyyy 我想搜索以 $AUD 开头的字符串中的任何内容并删除下一个空
我是 Excel 宏的新手.. 谁能告诉我这个宏是做什么的? Sub People_Add_Document() prow = ActiveCell.row num = Cells(p
我对 Excel 中的 VBA 和宏非常陌生。我有一个非常大的 Excel 电子表格,其中 A 列保存日期。我正在尝试删除值小于某个日期的行,这就是我到现在为止的想法。 Sub DELETEDATE(
我在 Excel 2003 中有一个 VBA 对象,当通过流数据获得某些值时,它会触发三个简单的宏。它运行良好。我想打开一个重复的工作表,但具有不同的流数据,并在各自的工作表上触发宏。它现在可以使用,
下面的宏有什么问题?我只想评估一个选项卡中的一个单元格是否大于另一个选项卡中的另一个单元格。然后消息框: Sub Comhouse() If Worksheets("(2.2) TRA works
需要一个简单的 excel 宏的帮助。我在第 1 列 X1 到 X20 中有数据。我想自动将此信息粘贴到 A 列,然后当我更新 X 列中的数字时,我想将此信息粘贴到 B 列,然后再粘贴到 C 列...
我找到了以下代码,效果很好;但是,我必须手动更改月份,以便它转到第二个工作簿的右侧工作表。由于工作表以月为单位,我怎样才能使其自动更改为当月? Sub AlarmSheet() Dim wkb As
很难说出这里问的是什么。这个问题是模棱两可的、模糊的、不完整的、过于宽泛的或修辞的,无法以目前的形式得到合理的回答。如需帮助澄清这个问题以便重新打开它,visit the help center .
我的公司只使用 MS Office 2003 产品,所以我必须坚持下去。由于我的工作性质,我需要使用很多“复制和粘贴”功能。源数据主要来自网站,我将数据粘贴到 Excel 中的单元格中。问题是剪贴板保
我是一名优秀的程序员,十分优秀!