我的 atlassian 插件中的 jcraft.jsch 在我的 webitem 操作中不起作用,并且未显示按钮
进程生成类.java
public class processGenerateClass extends JiraWebActionSupport{
/**
*
*/
private static final long serialVersionUID = 1L;
@SuppressWarnings("unused")
private static final Logger log = LoggerFactory.getLogger(processGenerateClass.class);
@Override
public String execute() throws Exception {
return super.execute(); //returns SUCCESS
}
public void doRunCommand() throws Exception{
System.out.println("*******************************************************");
final String HOST = "*************";
final String USERNAME = "*************";
final String PASSWORD = "************";
JSch jsch = new JSch();
String[] commandes = { "5","log","subon","","JA002","","","","","","","","","Y"};
System.out.println("Connexion");
try {
/**
* Ouverture d'une session
*/
Session session = jsch.getSession(USERNAME, HOST, 22);
session.setConfig("StrictHostKeyChecking", "no");
session.setPassword(PASSWORD);
session.connect(30000);
/**
* Ouverture d'un channel pour executer les commandes
*/
Channel channel = (Channel) session.openChannel("shell");
OutputStream in = channel.getOutputStream();
channel.connect(3 * 1000);
Thread.sleep(3000);
channel.setOutputStream(System.out);
System.out.println("Ecriture");
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(in));
for (int i = 0; i < commandes.length; i++) {
System.out.println("\nExecution de la commande ==> " + commandes[i]);
System.out.println("----------------------------------");
writer.write(commandes[i] + "\n");
writer.flush();
Thread.sleep(1000);
System.out.println("\n----------------------------------");
}
writer.close();
in.close();
channel.disconnect();
session.disconnect();
} catch (Exception e) {
System.out.println("Erreur : " + e);
}
System.out.println("\nFin Connexion");
} }
atlassian-plugin.xml
<web-item name="Generate Process" key="generate-process" weight="20" section="transitions-all" i18n-name-key="generate-process.name">
<description key="generate-process.description">The generateprocess Plugin</description>
<label key="Generate Process"/>
<link linkId="generate-process-link">/secure/processGenerateClass!RunCommand.jspa</link>
processGenerate 插件 /templates/process-generate/processgenerateclass/success.vm