diff --git a/src/main/java/hudson/plugins/mavendeploymentlinker/MavenDeploymentLinkerAction.java b/src/main/java/hudson/plugins/mavendeploymentlinker/MavenDeploymentLinkerAction.java
index 055f5c2..331288c 100644
--- a/src/main/java/hudson/plugins/mavendeploymentlinker/MavenDeploymentLinkerAction.java
+++ b/src/main/java/hudson/plugins/mavendeploymentlinker/MavenDeploymentLinkerAction.java
@@ -3,7 +3,6 @@
import hudson.model.Action;
import org.apache.commons.lang.StringUtils;
-import org.kohsuke.stapler.export.Exported;
import java.util.ArrayList;
import java.util.List;
@@ -11,44 +10,48 @@
public class MavenDeploymentLinkerAction implements Action {
- /*package*/ static class ArtifactVersion {
+ public static class ArtifactVersion {
private static final String SNAPSHOT_PATTERN = ".*-SNAPSHOT.*";
private static final Pattern p = Pattern.compile(SNAPSHOT_PATTERN);
private ArtifactVersion(String url) {
+ this.name = extractName(url);
this.url = normalize(url);
- snapshot = p.matcher(url).matches();
+ this.snapshot = p.matcher(url).matches();
}
private final String url;
private boolean snapshot;
+ private String name;
+ private String extractName(String s) {
+ return s.substring(s.lastIndexOf('/') + 1, s.length());
+ }
private String normalize(String url) {
- // JENKINS-9114 : Remove "dav:" when Maven uses webdav deployment
+ // JENKINS-9114 : Remove "dav:" when Maven uses webdav deployment
return StringUtils.removeStart(url, "dav:");
}
public boolean isSnapshot() {
return snapshot;
}
+ public String getName() {
+ return name;
+ }
public String getUrl() {
return url;
}
- public String getText() {
- StringBuilder textBuilder = new StringBuilder();
- textBuilder.append("\n
");
- textBuilder.append("");
- textBuilder.append(url.substring(url.lastIndexOf('/') + 1, url.length()));
- textBuilder.append("");
- textBuilder.append("\n");
- return textBuilder.toString();
+
+ protected Object readResolve() {
+ if (name == null) {
+ name = extractName(url);
+ }
+ return this;
}
}
private List deployments = new ArrayList();
- private transient String text;
-
@Deprecated
private transient boolean snapshot;
@@ -71,20 +74,6 @@ public String getUrlName() {
return "";
}
- @Exported
- public String getText() {
- if (text == null) {
- StringBuilder textBuilder = new StringBuilder();
- textBuilder.append("");
- for (ArtifactVersion artifact : deployments) {
- textBuilder.append(artifact.getText());
- }
- textBuilder.append("
");
- text = textBuilder.toString();
- }
- return text;
- }
-
public void addDeployment(String url) {
ArtifactVersion artifactVersion = new ArtifactVersion(url);
deployments.add(artifactVersion);
@@ -93,7 +82,7 @@ public void addDeployment(String url) {
/**
* @return list of all linked deployments
*/
- /*package*/ List getDeployments() {
+ public List getDeployments() {
return deployments;
}
}
diff --git a/src/main/resources/hudson/plugins/mavendeploymentlinker/MavenDeploymentLinkerAction/summary.jelly b/src/main/resources/hudson/plugins/mavendeploymentlinker/MavenDeploymentLinkerAction/summary.jelly
index 14c99fc..0d5ca0f 100644
--- a/src/main/resources/hudson/plugins/mavendeploymentlinker/MavenDeploymentLinkerAction/summary.jelly
+++ b/src/main/resources/hudson/plugins/mavendeploymentlinker/MavenDeploymentLinkerAction/summary.jelly
@@ -1,6 +1,11 @@
+
${%deployments}
- ${it.text}
+
\ No newline at end of file
diff --git a/src/main/resources/hudson/plugins/mavendeploymentlinker/MavenDeploymentProjectLinkerAction/jobMain.jelly b/src/main/resources/hudson/plugins/mavendeploymentlinker/MavenDeploymentProjectLinkerAction/jobMain.jelly
index ff65942..831237e 100644
--- a/src/main/resources/hudson/plugins/mavendeploymentlinker/MavenDeploymentProjectLinkerAction/jobMain.jelly
+++ b/src/main/resources/hudson/plugins/mavendeploymentlinker/MavenDeploymentProjectLinkerAction/jobMain.jelly
@@ -1,14 +1,24 @@
+
${%latestDeployments}
- ${it.latestDeployments.text}
+
+
${%latestReleaseDeployments}
- ${it.latestReleaseDeployments.text}
+