提交 09c6316e 编写于 作者: K kohsuke

added hyperlinking to plugin details.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@2934 71c3de6d-444a-0410-be80-ed276b4c234a
上级 e477d65c
......@@ -9,6 +9,7 @@ import hudson.model.Items;
import hudson.model.JobPropertyDescriptor;
import hudson.model.Job;
import hudson.model.Action;
import hudson.maven.ExecutedMojo;
import org.kohsuke.stapler.Ancestor;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
......@@ -375,4 +376,8 @@ public class Functions {
if(o==null) return 0;
return ASTSizeFunction.sizeOf(o);
}
public static ExecutedMojo.Cache createExecutedMojoCache() {
return new ExecutedMojo.Cache();
}
}
package hudson.maven;
import hudson.Util;
import hudson.model.Hudson;
import hudson.remoting.Which;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.kohsuke.stapler.Stapler;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.Serializable;
import java.util.Map;
import java.util.HashMap;
/**
* Persisted record of mojo execution.
......@@ -80,4 +84,42 @@ public final class ExecutedMojo implements Serializable {
if(executionId==null) return "-";
else return executionId;
}
/**
* Returns a hyperlink for the plugin name if there's one.
* Otherwise null.
*/
public String getPluginLink(Cache c) {
MavenModule m = c.get(this);
if(m!=null)
return Stapler.getCurrentRequest().getContextPath()+m.getUrl();
if(groupId.equals("org.apache.maven.plugins"))
return "http://maven.apache.org/plugins/"+artifactId+'/';
return null;
}
public String getGoalLink(Cache c) {
if(groupId.equals("org.apache.maven.plugins"))
return "http://maven.apache.org/plugins/"+artifactId+'/'+goal+"-mojo.html";
return null;
}
/**
* Used during the HTML rendering to cache the index.
*/
public static final class Cache {
/**
* All maven modules in this Hudson by their names.
*/
public final Map<ModuleName,MavenModule> modules = new HashMap<ModuleName,MavenModule>();
public Cache() {
for( MavenModule m : Hudson.getInstance().getAllItems(MavenModule.class))
modules.put(m.getModuleName(),m);
}
public MavenModule get(ExecutedMojo mojo) {
return modules.get(new ModuleName(mojo.groupId,mojo.artifactId));
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册