diff --git a/core/src/main/java/hudson/DescriptorExtensionList.java b/core/src/main/java/hudson/DescriptorExtensionList.java index 1a4b3e0e45..be2b7c6dc9 100644 --- a/core/src/main/java/hudson/DescriptorExtensionList.java +++ b/core/src/main/java/hudson/DescriptorExtensionList.java @@ -190,6 +190,12 @@ public class DescriptorExtensionList, D extends Descrip return r; } + @Override + public boolean add(D d) { + hudson.getExtensionList(Descriptor.class).add(d); // add it to the master descriptor list as well + return super.add(d); + } + /** * Stores manually registered Descriptor instances. Keyed by the {@link Describable} type. */ diff --git a/core/src/main/java/hudson/ExtensionList.java b/core/src/main/java/hudson/ExtensionList.java index c168789eba..1177876c01 100644 --- a/core/src/main/java/hudson/ExtensionList.java +++ b/core/src/main/java/hudson/ExtensionList.java @@ -80,7 +80,7 @@ public class ExtensionList extends AbstractList { private volatile List> extensions; /** - * Place to store manually registered instances with the per-Hudson scope. + * Place to store manually registered instances with the per-Jenkins scope. * {@link CopyOnWriteArrayList} is used here to support concurrent iterations and mutation. */ private final CopyOnWriteArrayList> legacyInstances; diff --git a/core/src/main/java/hudson/model/AbstractItem.java b/core/src/main/java/hudson/model/AbstractItem.java index 131c51b649..8f0130dfb1 100644 --- a/core/src/main/java/hudson/model/AbstractItem.java +++ b/core/src/main/java/hudson/model/AbstractItem.java @@ -51,7 +51,11 @@ import org.kohsuke.stapler.export.ExportedBean; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; @@ -286,6 +290,44 @@ public abstract class AbstractItem extends Actionable implements Item, HttpDelet else return n+" \u00BB "+getDisplayName(); } + public String getRelativeNameFrom(ItemGroup p) { + // first list up all the parents + Map parents = new HashMap(); + int depth=0; + while (p!=null) { + parents.put(p, depth++); + if (p instanceof Item) + p = ((Item)p).getParent(); + else + p = null; + } + + StringBuilder buf = new StringBuilder(); + Item i=this; + while (true) { + if (buf.length()>0) buf.insert(0,'/'); + buf.insert(0,i.getName()); + ItemGroup g = i.getParent(); + + Integer d = parents.get(g); + if (d!=null) { + String s=""; + for (int j=d; j>0; j--) + s+="../"; + return s+buf; + } + + if (g instanceof Item) + i = (Item)g; + else + return null; + } + } + + public String getRelativeNameFrom(Item item) { + return getRelativeNameFrom(item.getParent()); + } + /** * Called right after when a {@link Item} is loaded from disk. * This is an opporunity to do a post load processing. @@ -335,10 +377,10 @@ public abstract class AbstractItem extends Actionable implements Item, HttpDelet @Exported(visibility=999,name="url") public final String getAbsoluteUrl() { - StaplerRequest request = Stapler.getCurrentRequest(); - if(request==null) - throw new IllegalStateException("Not processing a HTTP request"); - return Util.encode(Jenkins.getInstance().getRootUrl()+getUrl()); + String r = Jenkins.getInstance().getRootUrl(); + if(r==null) + throw new IllegalStateException("Root URL isn't configured yet. Cannot compute absolute URL."); + return Util.encode(r+getUrl()); } /** diff --git a/core/src/main/java/hudson/model/AbstractProject.java b/core/src/main/java/hudson/model/AbstractProject.java index c111792991..b9c70791a5 100644 --- a/core/src/main/java/hudson/model/AbstractProject.java +++ b/core/src/main/java/hudson/model/AbstractProject.java @@ -1954,13 +1954,22 @@ public abstract class AbstractProject

,R extends A * Finds a {@link AbstractProject} that has the name closest to the given name. */ public static AbstractProject findNearest(String name) { - List projects = Jenkins.getInstance().getItems(AbstractProject.class); + return findNearest(name,Hudson.getInstance()); + } + + /** + * Finds a {@link AbstractProject} whose name (when referenced from the specified context) is closest to the given name. + * + * @since 1.419 + */ + public static AbstractProject findNearest(String name, ItemGroup context) { + List projects = Hudson.getInstance().getAllItems(AbstractProject.class); String[] names = new String[projects.size()]; for( int i=0; i REVERSE_INTEGER_COMPARATOR = new Comparator() { diff --git a/core/src/main/java/hudson/model/Descriptor.java b/core/src/main/java/hudson/model/Descriptor.java index d721417d0f..f57f467506 100644 --- a/core/src/main/java/hudson/model/Descriptor.java +++ b/core/src/main/java/hudson/model/Descriptor.java @@ -662,7 +662,7 @@ public abstract class Descriptor> implements Saveable { } private String getViewPage(Class clazz, Collection pageNames, String defaultValue) { - while(clazz!=Object.class) { + while(clazz!=Object.class && clazz!=null) { for (String pageName : pageNames) { String name = clazz.getName().replace('.', '/').replace('$', '/') + "/" + pageName; if(clazz.getClassLoader().getResource(name)!=null) diff --git a/core/src/main/java/hudson/model/Item.java b/core/src/main/java/hudson/model/Item.java index 7128488621..ced23eef62 100644 --- a/core/src/main/java/hudson/model/Item.java +++ b/core/src/main/java/hudson/model/Item.java @@ -124,6 +124,22 @@ public interface Item extends PersistenceRoot, SearchableModelObject, AccessCont */ String getFullDisplayName(); + /** + * Gets the relative name to this item from the specified group. + * + * @since 1.419 + * @return + * String like "../foo/bar" + */ + String getRelativeNameFrom(ItemGroup g); + + /** + * Short for {@code getRelativeNameFrom(item.getParent())} + * + * @since 1.419 + */ + String getRelativeNameFrom(Item item); + /** * Returns the URL of this item relative to the context root of the application. * diff --git a/core/src/main/java/hudson/model/ItemGroupMixIn.java b/core/src/main/java/hudson/model/ItemGroupMixIn.java index c626c850e4..7225ab6089 100644 --- a/core/src/main/java/hudson/model/ItemGroupMixIn.java +++ b/core/src/main/java/hudson/model/ItemGroupMixIn.java @@ -208,6 +208,7 @@ public abstract class ItemGroupMixIn { add(result); ItemListener.fireOnCopied(src,result); + Hudson.getInstance().rebuildDependencyGraph(); return result; } diff --git a/core/src/main/java/hudson/model/ListView.java b/core/src/main/java/hudson/model/ListView.java index ab07befdba..2937955517 100644 --- a/core/src/main/java/hudson/model/ListView.java +++ b/core/src/main/java/hudson/model/ListView.java @@ -24,6 +24,8 @@ */ package hudson.model; +import com.infradna.tool.bridge_method_injector.BridgeMethodsAdded; +import com.infradna.tool.bridge_method_injector.WithBridgeMethods; import hudson.Extension; import hudson.Util; import hudson.model.Descriptor.FormException; @@ -120,8 +122,9 @@ public class ListView extends View implements Saveable { public DescribableList> getJobFilters() { return jobFilters; } - - public Iterable getColumns() { + + @WithBridgeMethods(Iterable.class) + public DescribableList> getColumns() { return columns; } diff --git a/core/src/main/java/hudson/model/Run.java b/core/src/main/java/hudson/model/Run.java index 3a6cae16b7..9d7de95d8b 100644 --- a/core/src/main/java/hudson/model/Run.java +++ b/core/src/main/java/hudson/model/Run.java @@ -787,10 +787,9 @@ public abstract class Run ,RunT extends RunNEVER be used during HTML page rendering, as it won't work with - * network set up like Apache reverse proxy. - * This method is only intended for the remote API clients who cannot resolve relative references - * (even this won't work for the same reason, which should be fixed.) + * This method shall NEVER be used during HTML page rendering, as it's too easy for + * misconfiguration to break this value, with network set up like Apache reverse proxy. + * This method is only intended for the remote API clients who cannot resolve relative references. */ @Exported(visibility=2,name="url") public final String getAbsoluteUrl() { diff --git a/core/src/main/java/hudson/model/View.java b/core/src/main/java/hudson/model/View.java index 33d92bda67..6ab753e3c2 100644 --- a/core/src/main/java/hudson/model/View.java +++ b/core/src/main/java/hudson/model/View.java @@ -37,6 +37,8 @@ import hudson.security.ACL; import hudson.security.AccessControlled; import hudson.security.Permission; import hudson.security.PermissionGroup; +import hudson.util.AlternativeUiTextProvider; +import hudson.util.AlternativeUiTextProvider.Message; import hudson.util.DescribableList; import hudson.util.DescriptorList; import hudson.util.RunList; @@ -294,6 +296,10 @@ public abstract class View extends AbstractModelObject implements AccessControll return getViewName(); } + public String getNewPronoun() { + return AlternativeUiTextProvider.get(NEW_PRONOUN, this, Messages.AbstractItem_Pronoun()); + } + /** * By default, return true to render the "Edit view" link on the page. * This method is really just for the default "All" view to hide the edit link @@ -837,4 +843,10 @@ public abstract class View extends AbstractModelObject implements AccessControll p.setView(getOwner()); } } + + /** + * "Job" in "New Job". When a view is used in a context that restricts the child type, + * It might be useful to override this. + */ + public static final Message NEW_PRONOUN = new Message(); } diff --git a/core/src/main/java/hudson/security/NoopFilter.java b/core/src/main/java/hudson/security/NoopFilter.java new file mode 100644 index 0000000000..36e6e78420 --- /dev/null +++ b/core/src/main/java/hudson/security/NoopFilter.java @@ -0,0 +1,49 @@ +/* + * The MIT License + * + * Copyright (c) 2011, CloudBees, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package hudson.security; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import java.io.IOException; + +/** + * {@link Filter} that does nothing. + * + * @author Kohsuke Kawaguchi + */ +public class NoopFilter implements Filter { + public void init(FilterConfig filterConfig) throws ServletException { + } + + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + chain.doFilter(request,response); + } + + public void destroy() { + } +} diff --git a/core/src/main/java/hudson/tasks/BuildTrigger.java b/core/src/main/java/hudson/tasks/BuildTrigger.java index 5e0d409101..ad22e62c51 100644 --- a/core/src/main/java/hudson/tasks/BuildTrigger.java +++ b/core/src/main/java/hudson/tasks/BuildTrigger.java @@ -45,6 +45,8 @@ import hudson.model.Result; import hudson.model.Run; import hudson.model.TaskListener; import hudson.model.listeners.ItemListener; +import hudson.security.AccessControlled; +import hudson.tasks.BuildTrigger.DescriptorImpl.ItemListenerImpl; import hudson.util.FormValidation; import net.sf.json.JSONObject; import org.apache.commons.lang.StringUtils; @@ -327,7 +329,8 @@ public class BuildTrigger extends Recorder implements DependecyDeclarer { if (StringUtils.isNotBlank(projectName)) { Item item = Jenkins.getInstance().getItem(projectName,project,Item.class); if(item==null) - return FormValidation.error(Messages.BuildTrigger_NoSuchProject(projectName,AbstractProject.findNearest(projectName).getName())); + return FormValidation.error(Messages.BuildTrigger_NoSuchProject(projectName, + AbstractProject.findNearest(projectName,project.getParent()).getRelativeNameFrom(project))); if(!(item instanceof AbstractProject)) return FormValidation.error(Messages.BuildTrigger_NotBuildable(projectName)); hasProjects = true; diff --git a/core/src/main/java/hudson/util/HttpResponses.java b/core/src/main/java/hudson/util/HttpResponses.java new file mode 100644 index 0000000000..16755adc4c --- /dev/null +++ b/core/src/main/java/hudson/util/HttpResponses.java @@ -0,0 +1,43 @@ +/* + * The MIT License + * + * Copyright (c) 2011, CloudBees, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package hudson.util; + +import org.kohsuke.stapler.HttpResponse; + +import java.io.File; +import java.io.IOException; + +/** + * Various {@link HttpResponse} implementations. + * + *

+ * This class extends from Stapler so that we can move implementations from here to Stapler periodically. + * + * @author Kohsuke Kawaguchi + */ +public class HttpResponses extends org.kohsuke.stapler.HttpResponses { + public static HttpResponse staticResource(File f) throws IOException { + return staticResource(f.toURI().toURL()); + } +} diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java index 7d6d096a21..9814947d89 100644 --- a/core/src/main/java/jenkins/model/Jenkins.java +++ b/core/src/main/java/jenkins/model/Jenkins.java @@ -1922,6 +1922,7 @@ public class Jenkins extends AbstractCIBase implements ModifiableItemGroup - + - diff --git a/core/src/main/resources/hudson/model/View/newJob.properties b/core/src/main/resources/hudson/model/View/newJob.properties new file mode 100644 index 0000000000..2b841de29e --- /dev/null +++ b/core/src/main/resources/hudson/model/View/newJob.properties @@ -0,0 +1,3 @@ +NewJob=New {0} +JobName={0} name +CopyExisting=Copy existing {0} diff --git a/core/src/main/resources/hudson/model/View/newJob_da.properties b/core/src/main/resources/hudson/model/View/newJob_da.properties index f232537292..7b2985813f 100644 --- a/core/src/main/resources/hudson/model/View/newJob_da.properties +++ b/core/src/main/resources/hudson/model/View/newJob_da.properties @@ -20,6 +20,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -Copy\ existing\ job=Kopier eksisterende job -Job\ name=Job navn -New\ Job=Nyt job +CopyExisting=Kopier eksisterende {0} +JobName={0} navn +NewJob=Nyt {0} diff --git a/core/src/main/resources/hudson/model/View/newJob_de.properties b/core/src/main/resources/hudson/model/View/newJob_de.properties index 62e69d2675..3f7f038d6f 100644 --- a/core/src/main/resources/hudson/model/View/newJob_de.properties +++ b/core/src/main/resources/hudson/model/View/newJob_de.properties @@ -20,6 +20,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -Job\ name=Job Name -Copy\ existing\ job=Kopiere bestehenden Job -New\ Job=Neuen Job anlegen +JobName={0} Name +CopyExisting=Kopiere bestehenden {0} +NewJob=Neuen {0} anlegen diff --git a/core/src/main/resources/hudson/model/View/newJob_el.properties b/core/src/main/resources/hudson/model/View/newJob_el.properties index b6fd522b77..ccabb0279d 100644 --- a/core/src/main/resources/hudson/model/View/newJob_el.properties +++ b/core/src/main/resources/hudson/model/View/newJob_el.properties @@ -20,5 +20,3 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -Copy\ existing\ job=\u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03B1\u03C6\u03AE \u03C5\u03C0\u03AC\u03C1\u03C7\u03BF\u03C5\u03C3\u03B1\u03C2 \u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1\u03C2 -Job\ name=\u039F\u03BD\u03BF\u03BC\u03B1\u03C3\u03AF\u03B1 \u0395\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1\u03C2 diff --git a/core/src/main/resources/hudson/model/View/newJob_es.properties b/core/src/main/resources/hudson/model/View/newJob_es.properties index 5858160243..ab3c60388a 100644 --- a/core/src/main/resources/hudson/model/View/newJob_es.properties +++ b/core/src/main/resources/hudson/model/View/newJob_es.properties @@ -20,6 +20,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -Job\ name=Nombre del proyecto -Copy\ existing\ job=Copiar un proyecto existente -New\ Job=Nuevo proyecto +JobName=Nombre del {0} +CopyExisting=Copiar un {0} existente +NewJob=Nuevo {0} diff --git a/core/src/main/resources/hudson/model/View/newJob_fr.properties b/core/src/main/resources/hudson/model/View/newJob_fr.properties index a375ab2cec..e83da6a657 100644 --- a/core/src/main/resources/hudson/model/View/newJob_fr.properties +++ b/core/src/main/resources/hudson/model/View/newJob_fr.properties @@ -20,5 +20,5 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -Job\ name=Nom du job -Copy\ existing\ job=Copier un job existant +JobName=Nom du {0} +CopyExisting=Copier un {0} existant diff --git a/core/src/main/resources/hudson/model/View/newJob_it.properties b/core/src/main/resources/hudson/model/View/newJob_it.properties index fc61930fc7..b18711cc33 100644 --- a/core/src/main/resources/hudson/model/View/newJob_it.properties +++ b/core/src/main/resources/hudson/model/View/newJob_it.properties @@ -20,5 +20,5 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -Copy\ existing\ job=Copia job esistente -Job\ name=Nome job +CopyExisting=Copia {0} esistente +JobName=Nome {0} diff --git a/core/src/main/resources/hudson/model/View/newJob_ja.properties b/core/src/main/resources/hudson/model/View/newJob_ja.properties index ec25ad3266..d4fa2f52a8 100644 --- a/core/src/main/resources/hudson/model/View/newJob_ja.properties +++ b/core/src/main/resources/hudson/model/View/newJob_ja.properties @@ -20,6 +20,3 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -Job\ name=\u30B8\u30E7\u30D6\u540D -Copy\ existing\ job=\u65E2\u5B58\u30B8\u30E7\u30D6\u306E\u30B3\u30D4\u30FC -New\ Job=\u65B0\u898F\u30B8\u30E7\u30D6 diff --git a/core/src/main/resources/hudson/model/View/newJob_ko.properties b/core/src/main/resources/hudson/model/View/newJob_ko.properties index ab03e15052..3c50e826e4 100644 --- a/core/src/main/resources/hudson/model/View/newJob_ko.properties +++ b/core/src/main/resources/hudson/model/View/newJob_ko.properties @@ -20,6 +20,4 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -Job\ name=\uC791\uC5C5\uBA85 -Copy\ existing\ job=\uAE30\uC874 \uC791\uC5C5 \uBCF5\uC0AC Copy\ from=\uBCF5\uC0AC \uC704\uCE58 diff --git a/core/src/main/resources/hudson/model/View/newJob_nb_NO.properties b/core/src/main/resources/hudson/model/View/newJob_nb_NO.properties index 099ca9c316..751f289a23 100644 --- a/core/src/main/resources/hudson/model/View/newJob_nb_NO.properties +++ b/core/src/main/resources/hudson/model/View/newJob_nb_NO.properties @@ -20,5 +20,5 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -Copy\ existing\ job=Kopier eksisterende jobb -Job\ name=Jobbnavn +CopyExisting=Kopier eksisterende {0} +JobName={0}navn diff --git a/core/src/main/resources/hudson/model/View/newJob_nl.properties b/core/src/main/resources/hudson/model/View/newJob_nl.properties index 93c1207997..5c7fa71790 100644 --- a/core/src/main/resources/hudson/model/View/newJob_nl.properties +++ b/core/src/main/resources/hudson/model/View/newJob_nl.properties @@ -20,6 +20,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -Job\ name=Jobnaam -Copy\ existing\ job=Kopi\u00EBer bestaande job +JobName={0}naam +CopyExisting=Kopi\u00EBer bestaande {0} Copy\ from=Kopi\u00EBer van diff --git a/core/src/main/resources/hudson/model/View/newJob_pl.properties b/core/src/main/resources/hudson/model/View/newJob_pl.properties index 5dbb2ab842..356f15a5ab 100644 --- a/core/src/main/resources/hudson/model/View/newJob_pl.properties +++ b/core/src/main/resources/hudson/model/View/newJob_pl.properties @@ -20,5 +20,5 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -Copy\ existing\ job=Kopiuj istniej\u0105ce zadanie -Job\ name=Nazwa zadania +CopyExisting=Kopiuj istniej\u0105ce {0} +JobName=Nazwa {0} diff --git a/core/src/main/resources/hudson/model/View/newJob_pt_BR.properties b/core/src/main/resources/hudson/model/View/newJob_pt_BR.properties index b9a9dc4687..5507436540 100644 --- a/core/src/main/resources/hudson/model/View/newJob_pt_BR.properties +++ b/core/src/main/resources/hudson/model/View/newJob_pt_BR.properties @@ -20,6 +20,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -Job\ name=Nome da tarefa -Copy\ existing\ job=Copiar tarefa existente -New\ Job=Nova Tarefa +JobName=Nome da {0} +CopyExisting=Copiar {0} existente +NewJob=Nova {0} diff --git a/core/src/main/resources/hudson/model/View/newJob_ru.properties b/core/src/main/resources/hudson/model/View/newJob_ru.properties index c662e645c3..28899d1655 100644 --- a/core/src/main/resources/hudson/model/View/newJob_ru.properties +++ b/core/src/main/resources/hudson/model/View/newJob_ru.properties @@ -20,6 +20,3 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -Job\ name=\u0418\u043c\u044f \u0437\u0430\u0434\u0430\u0447\u0438 -Copy\ existing\ job=\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 -Copy\ from=\u0421\u043d\u044f\u0442\u044c \u043a\u043e\u043f\u0438\u044e \u0441 diff --git a/core/src/main/resources/hudson/model/View/newJob_sv_SE.properties b/core/src/main/resources/hudson/model/View/newJob_sv_SE.properties index c7b45438e2..fa9d27596d 100644 --- a/core/src/main/resources/hudson/model/View/newJob_sv_SE.properties +++ b/core/src/main/resources/hudson/model/View/newJob_sv_SE.properties @@ -20,5 +20,5 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -Copy\ existing\ job=Kopiera existerande jobb -Job\ name=Namn p\u00E5 jobb +CopyExisting=Kopiera existerande {0} +JobName=Namn p\u00E5 {0} diff --git a/core/src/main/resources/hudson/model/View/newJob_tr.properties b/core/src/main/resources/hudson/model/View/newJob_tr.properties index de96a06518..7172c45a1c 100644 --- a/core/src/main/resources/hudson/model/View/newJob_tr.properties +++ b/core/src/main/resources/hudson/model/View/newJob_tr.properties @@ -20,6 +20,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -Job\ name=\u0130\u015f\ ad\u0131 -Copy\ existing\ job=Varolan\ bir\ i\u015fi\ kopyala -Copy\ from=Kopyalanacak i\u015f +#JobName=\u0130\u015f\ ad\u0131 +#CopyExisting=Varolan\ bir\ i\u015fi\ kopyala +#Copy\ from=Kopyalanacak i\u015f diff --git a/core/src/main/resources/hudson/model/View/newJob_zh_CN.properties b/core/src/main/resources/hudson/model/View/newJob_zh_CN.properties index 67bf9991c9..133ccb8347 100644 --- a/core/src/main/resources/hudson/model/View/newJob_zh_CN.properties +++ b/core/src/main/resources/hudson/model/View/newJob_zh_CN.properties @@ -20,5 +20,5 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -Copy\ existing\ job=\u590D\u5236\u73B0\u6709\u4EFB\u52A1 -Job\ name=\u4EFB\u52A1\u540D\u79F0 +#CopyExisting=\u590D\u5236\u73B0\u6709\u4EFB\u52A1 +#JobName=\u4EFB\u52A1\u540D\u79F0 diff --git a/core/src/main/resources/hudson/model/View/newJob_zh_TW.properties b/core/src/main/resources/hudson/model/View/newJob_zh_TW.properties index dbf48f24d0..bb88ddd0b0 100644 --- a/core/src/main/resources/hudson/model/View/newJob_zh_TW.properties +++ b/core/src/main/resources/hudson/model/View/newJob_zh_TW.properties @@ -20,4 +20,4 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -Job\ name=\u5DE5\u4F5C\u540D\u7A31 +#JobName=\u5DE5\u4F5C\u540D\u7A31 diff --git a/core/src/main/resources/hudson/model/View/sidepanel.jelly b/core/src/main/resources/hudson/model/View/sidepanel.jelly index ecc4b1e6ba..144e6e8d84 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel.jelly +++ b/core/src/main/resources/hudson/model/View/sidepanel.jelly @@ -41,6 +41,7 @@ THE SOFTWARE. + diff --git a/core/src/main/resources/hudson/model/View/sidepanel.properties b/core/src/main/resources/hudson/model/View/sidepanel.properties new file mode 100644 index 0000000000..41d26287d3 --- /dev/null +++ b/core/src/main/resources/hudson/model/View/sidepanel.properties @@ -0,0 +1 @@ +NewJob=New {0} \ No newline at end of file diff --git a/core/src/main/resources/hudson/model/View/sidepanel_da.properties b/core/src/main/resources/hudson/model/View/sidepanel_da.properties index c83089cd5a..effd42a790 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_da.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_da.properties @@ -26,4 +26,4 @@ Delete\ View=Slet visning People=Personer Build\ History=Byggehistorik Edit\ View=Rediger visning -New\ Job=Nyt job +NewJob=Nyt {0} diff --git a/core/src/main/resources/hudson/model/View/sidepanel_de.properties b/core/src/main/resources/hudson/model/View/sidepanel_de.properties index 85e890039a..533ca73bac 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_de.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_de.properties @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -New\ Job=Neuen Job anlegen +NewJob=Neuen {0} anlegen People=Benutzer Build\ History=Build-Verlauf Edit\ View=Ansicht bearbeiten diff --git a/core/src/main/resources/hudson/model/View/sidepanel_el.properties b/core/src/main/resources/hudson/model/View/sidepanel_el.properties index 77ce44a127..2abeb55dcf 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_el.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_el.properties @@ -23,6 +23,5 @@ Build\ History=\u0399\u03C3\u03C4\u03BF\u03C1\u03B9\u03BA\u03CC Build Delete\ View=\u0394\u03B9\u03B1\u03B3\u03C1\u03B1\u03C6\u03AE \u038C\u03C8\u03B7\u03C2 Edit\ View=\u0395\u03C0\u03B5\u03BE\u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1 \u038C\u03C8\u03B7\u03C2 -New\ Job=\u039D\u03AD\u03B1 \u03B5\u03C1\u03B3\u03B1\u03C3\u03AF\u03B1 People=\u039F\u03B9 \u03AC\u03BD\u03B8\u03C1\u03C9\u03C0\u03BF\u03B9 Project\ Relationship=\u03A3\u03C5\u03C3\u03C7\u03B5\u03C4\u03AF\u03C3\u03B5\u03B9\u03C2 \u03C4\u03BF\u03C5 Project diff --git a/core/src/main/resources/hudson/model/View/sidepanel_es.properties b/core/src/main/resources/hudson/model/View/sidepanel_es.properties index 3a0b79f3b2..ad9e6ded48 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_es.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_es.properties @@ -22,7 +22,7 @@ # THE SOFTWARE. Build\ History=Historia de ejecuciones -New\ Job=Crear nueva Tarea +NewJob=Crear nueva {0} People=Actividad Edit\ View=Editar la vista Delete\ View=Borrar la vista diff --git a/core/src/main/resources/hudson/model/View/sidepanel_fi.properties b/core/src/main/resources/hudson/model/View/sidepanel_fi.properties index 015d36faff..084aae47ac 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_fi.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_fi.properties @@ -22,6 +22,6 @@ Build\ History=K\u00E4\u00E4nn\u00F6shistoria Check\ File\ Fingerprint=Tarkasta tiedoston sormenj\u00E4ljet -New\ Job=Uusi ty\u00F6 +NewJob=Uusi {0} People=K\u00E4ytt\u00E4j\u00E4t Project\ Relationship=Projektien riippuvuudet diff --git a/core/src/main/resources/hudson/model/View/sidepanel_fr.properties b/core/src/main/resources/hudson/model/View/sidepanel_fr.properties index a5b8552cd7..37bef36cfa 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_fr.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_fr.properties @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -New\ Job=Nouvelle t\u00E2che +NewJob=Nouvelle {0} People=Personnes Build\ History=Historique des constructions Edit\ View=\u00C9diter la vue diff --git a/core/src/main/resources/hudson/model/View/sidepanel_hu.properties b/core/src/main/resources/hudson/model/View/sidepanel_hu.properties index 5fa04936cf..18a8515fc6 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_hu.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_hu.properties @@ -22,5 +22,5 @@ Build\ History=\u00C9p\u00EDt\u00E9sek T\u00F6rt\u00E9nete Check\ File\ Fingerprint=F\u00E1jl Ujjlenyomat Ellen\u0151rz\u00E9se -New\ Job=\u00FAj feladat +NewJob=\u00FAj {0} Project\ Relationship=Projekt Kapcsolat diff --git a/core/src/main/resources/hudson/model/View/sidepanel_it.properties b/core/src/main/resources/hudson/model/View/sidepanel_it.properties index 2f91d7a24a..ab92c0df7b 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_it.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_it.properties @@ -22,6 +22,6 @@ Build\ History=Cronologia build Check\ File\ Fingerprint=Controlla impronta file -New\ Job=Nuovo job +NewJob=Nuovo {0} People=Utenti Project\ Relationship=Relazioni fra progetti diff --git a/core/src/main/resources/hudson/model/View/sidepanel_ja.properties b/core/src/main/resources/hudson/model/View/sidepanel_ja.properties index e7baec4f7a..023b233f66 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_ja.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_ja.properties @@ -20,7 +20,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -New\ Job=\u65b0\u898f\u30b8\u30e7\u30d6\u4f5c\u6210 People=\u4eba\u3005 Build\ History=\u30d3\u30eb\u30c9\u5c65\u6b74 Edit\ View=\u30d3\u30e5\u30fc\u306e\u5909\u66f4 diff --git a/core/src/main/resources/hudson/model/View/sidepanel_ko.properties b/core/src/main/resources/hudson/model/View/sidepanel_ko.properties index c526e68bd6..8892093430 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_ko.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_ko.properties @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -New\ Job=\uC0C8 \uC791\uC5C5 +NewJob=\uC0C8 {0} Delete\ View=\uBCF4\uAE30 \uC0AD\uC81C People=\uAC1C\uBC1C\uC790 Build\ History=\uBE4C\uB4DC \uAE30\uB85D diff --git a/core/src/main/resources/hudson/model/View/sidepanel_nb_NO.properties b/core/src/main/resources/hudson/model/View/sidepanel_nb_NO.properties index 361921588d..3fe432152a 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_nb_NO.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_nb_NO.properties @@ -24,6 +24,6 @@ Build\ History=Bygghistorie Check\ File\ Fingerprint=Unders\u00F8k fingeravtrykk for filer Delete\ View=Slett visning Edit\ View=Rediger visning -New\ Job=Ny jobb +NewJob=Ny {0} People=Folk Project\ Relationship=Forhold mellom prosjekter diff --git a/core/src/main/resources/hudson/model/View/sidepanel_nl.properties b/core/src/main/resources/hudson/model/View/sidepanel_nl.properties index 69551b5698..e6d2d83e81 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_nl.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_nl.properties @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -New\ Job=Nieuwe job +NewJob=Nieuwe {0} People=Gebruikers Build\ History=Overzicht bouwpogingen Edit\ View=Overzichtsscherm bewerken diff --git a/core/src/main/resources/hudson/model/View/sidepanel_pt_BR.properties b/core/src/main/resources/hudson/model/View/sidepanel_pt_BR.properties index 59c56aea80..dead05bbd9 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_pt_BR.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_pt_BR.properties @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -New\ Job=Nova Tarefa +NewJob=Nova {0} People=Pessoas Build\ History=Hist\u00f3rico de Constru\u00e7\u00e3o Edit\ View=Editar View diff --git a/core/src/main/resources/hudson/model/View/sidepanel_pt_PT.properties b/core/src/main/resources/hudson/model/View/sidepanel_pt_PT.properties index 12a5a196c2..bb4654ff8e 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_pt_PT.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_pt_PT.properties @@ -22,6 +22,6 @@ Build\ History=Historial de compila\u00E7\u00F5es Check\ File\ Fingerprint=Verificar a impress\u00E3o digital de ficheiro -New\ Job=Novo processo +NewJob=Novo {0} People=Pessoal Project\ Relationship=Relacionamento de Projectos diff --git a/core/src/main/resources/hudson/model/View/sidepanel_ru.properties b/core/src/main/resources/hudson/model/View/sidepanel_ru.properties index cce00c52c9..f0cddef278 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_ru.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_ru.properties @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -New\ Job=\u041d\u043e\u0432\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 +NewJob=\u041d\u043e\u0432\u0430\u044f {0} People=\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u0438 Build\ History=\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0441\u0431\u043e\u0440\u043e\u043a Edit\ View=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0438\u0434 diff --git a/core/src/main/resources/hudson/model/View/sidepanel_sv_SE.properties b/core/src/main/resources/hudson/model/View/sidepanel_sv_SE.properties index 5cdc051719..42e7c4bc85 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_sv_SE.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_sv_SE.properties @@ -23,6 +23,6 @@ Build\ History=Bygghistorik Delete\ View=Ta bort vy Edit\ View=Redigera vy -New\ Job=Skapa nytt jobb +NewJob=Skapa nytt {0} People=Personer Project\ Relationship=Jobbsamband diff --git a/core/src/main/resources/hudson/model/View/sidepanel_tr.properties b/core/src/main/resources/hudson/model/View/sidepanel_tr.properties index cee6677004..77537b4a85 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_tr.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_tr.properties @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -New\ Job=Yeni \u0130\u015f +NewJob=Yeni {0} People=\u0130nsanlar Build\ History=Yap\u0131land\u0131rma Ge\u00e7mi\u015fi Edit\ View=G\u00f6r\u00fcnt\u00fcy\u00fc D\u00fczenle diff --git a/core/src/main/resources/hudson/model/View/sidepanel_zh_CN.properties b/core/src/main/resources/hudson/model/View/sidepanel_zh_CN.properties index da72b5af43..bd600e13fd 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_zh_CN.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_zh_CN.properties @@ -21,5 +21,4 @@ # THE SOFTWARE. Build\ History=\u6784\u5efa\u5386\u53f2 -New\ Job=\u65b0\u5efa\u4efb\u52a1 People=\u7528\u6237 diff --git a/core/src/main/resources/hudson/model/View/sidepanel_zh_TW.properties b/core/src/main/resources/hudson/model/View/sidepanel_zh_TW.properties index 65aa888501..431b5b7284 100644 --- a/core/src/main/resources/hudson/model/View/sidepanel_zh_TW.properties +++ b/core/src/main/resources/hudson/model/View/sidepanel_zh_TW.properties @@ -21,5 +21,4 @@ # THE SOFTWARE. Build\ History=\u5EFA\u69CB\u6B77\u7A0B -New\ Job=\u8D77\u59CB\u65B0\u5DE5\u4F5C People=\u4F7F\u7528\u8005 diff --git a/maven-plugin/src/main/java/hudson/maven/Maven3Builder.java b/maven-plugin/src/main/java/hudson/maven/Maven3Builder.java index ad9a419096..95d251b1c4 100644 --- a/maven-plugin/src/main/java/hudson/maven/Maven3Builder.java +++ b/maven-plugin/src/main/java/hudson/maven/Maven3Builder.java @@ -422,7 +422,6 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal public void reccordProjectSucceeded( ExecutionEvent event ) { MavenBuildProxy2 mavenBuildProxy2 = getMavenBuildProxy2( event.getProject() ); - mavenBuildProxy2.end(); mavenBuildProxy2.setResult( Result.SUCCESS ); @@ -452,7 +451,8 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal } } - } + mavenBuildProxy2.end(); + } /** * @see org.apache.maven.execution.ExecutionListener#projectFailed(org.apache.maven.execution.ExecutionEvent) @@ -467,7 +467,6 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal public void reccordProjectFailed( ExecutionEvent event ) { MavenBuildProxy2 mavenBuildProxy2 = getMavenBuildProxy2( event.getProject() ); - mavenBuildProxy2.end(); mavenBuildProxy2.setResult( Result.FAILURE ); MavenProject mavenProject = event.getProject(); List mavenReporters = getMavenReporters( mavenProject ); @@ -495,7 +494,9 @@ public class Maven3Builder extends AbstractMavenBuilder implements DelegatingCal } } } - } + + mavenBuildProxy2.end(); + } /** * @see org.apache.maven.execution.ExecutionListener#mojoSkipped(org.apache.maven.execution.ExecutionEvent) diff --git a/maven-plugin/src/main/java/hudson/maven/MavenBuild.java b/maven-plugin/src/main/java/hudson/maven/MavenBuild.java index 8ad4846911..a17200d669 100644 --- a/maven-plugin/src/main/java/hudson/maven/MavenBuild.java +++ b/maven-plugin/src/main/java/hudson/maven/MavenBuild.java @@ -25,6 +25,10 @@ package hudson.maven; import hudson.EnvVars; import hudson.FilePath; +import hudson.maven.reporters.MavenArtifactRecord; +import hudson.maven.reporters.SurefireArchiver; +import hudson.slaves.WorkspaceList; +import hudson.slaves.WorkspaceList.Lease; import hudson.maven.agent.AbortException; import hudson.maven.reporters.SurefireArchiver; import hudson.model.AbstractBuild; @@ -50,6 +54,17 @@ import hudson.util.ArgumentListBuilder; import hudson.util.DescribableList; import hudson.util.IOUtils; import hudson.util.ReflectionUtils; +import org.apache.maven.BuildFailureException; +import org.apache.maven.artifact.versioning.ComparableVersion; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.execution.ReactorManager; +import org.apache.maven.lifecycle.LifecycleExecutionException; +import org.apache.maven.monitor.event.EventDispatcher; +import org.apache.maven.project.MavenProject; +import org.kohsuke.stapler.Ancestor; +import org.kohsuke.stapler.Stapler; +import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.export.Exported; import java.io.File; import java.io.FileNotFoundException; @@ -189,6 +204,14 @@ public class MavenBuild extends AbstractMavenBuild { return true; } + /** + * Information about artifacts produced by Maven. + */ + @Exported + public MavenArtifactRecord getMavenArtifacts() { + return getAction(MavenArtifactRecord.class); + } + /** * Exposes {@code MAVEN_OPTS} to forked processes. * diff --git a/maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java b/maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java index c5d0ce4af7..9fc76afe20 100644 --- a/maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java +++ b/maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java @@ -232,6 +232,10 @@ public final class MavenModuleSet extends AbstractMavenProject> buildWrappers = new DescribableList>(this); + /** + * @deprecated + * Use {@link #MavenModuleSet(ItemGroup, String)} + */ public MavenModuleSet(String name) { this(Jenkins.getInstance(),name); } diff --git a/maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java b/maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java index 76d59fb3f7..24bc693183 100644 --- a/maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java +++ b/maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java @@ -33,6 +33,8 @@ import hudson.FilePath.FileCallable; import hudson.Launcher; import hudson.Util; import hudson.maven.MavenBuild.ProxyImpl2; +import hudson.maven.reporters.MavenAggregatedArtifactRecord; +import hudson.maven.reporters.MavenArtifactRecord; import hudson.maven.reporters.MavenFingerprinter; import hudson.maven.reporters.MavenMailer; import hudson.model.AbstractBuild; @@ -99,6 +101,7 @@ import org.apache.maven.project.ProjectBuildingException; import org.codehaus.plexus.util.PathTool; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; +import org.kohsuke.stapler.export.Exported; import org.sonatype.aether.transfer.TransferCancelledException; import org.sonatype.aether.transfer.TransferEvent; import org.sonatype.aether.transfer.TransferListener; @@ -376,6 +379,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild> extends TaskAction implements BuildBadgeAction { + @ExportedBean public final class Record { /** * Repository URL that artifacts were deployed. */ + @Exported public final String url; /** @@ -107,26 +112,32 @@ public abstract class MavenAbstractArtifactRecord> /** * Result of the deployment. During the build, this value is null. */ + @Exported public Result getResult() { return result; } + @Exported public int getNumber() { return records.indexOf(this); } + @Exported public boolean isBuilding() { return result==null; } + @Exported public Calendar getTimestamp() { return (Calendar) timeStamp.clone(); } + @Exported public String getBuildStatusUrl() { return getIconColor().getImage(); } + @Exported public BallColor getIconColor() { if(result==null) return BallColor.GREY_ANIME; @@ -144,6 +155,7 @@ public abstract class MavenAbstractArtifactRecord> /** * Records of a deployment. */ + @Exported public final CopyOnWriteArrayList records = new CopyOnWriteArrayList(); /** @@ -171,6 +183,10 @@ public abstract class MavenAbstractArtifactRecord> return REDEPLOY; } + public Api getApi() { + return new Api(this); + } + public boolean hasBadge() { if (records != null) { for (final Record record : records) { diff --git a/maven-plugin/src/main/java/hudson/maven/reporters/MavenAggregatedArtifactRecord.java b/maven-plugin/src/main/java/hudson/maven/reporters/MavenAggregatedArtifactRecord.java index 03840985f1..0a57ed6b1e 100644 --- a/maven-plugin/src/main/java/hudson/maven/reporters/MavenAggregatedArtifactRecord.java +++ b/maven-plugin/src/main/java/hudson/maven/reporters/MavenAggregatedArtifactRecord.java @@ -34,18 +34,22 @@ import hudson.model.Action; import hudson.model.TaskListener; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.maven.artifact.deployer.ArtifactDeploymentException; import org.apache.maven.artifact.repository.ArtifactRepository; import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.kohsuke.stapler.export.Exported; +import org.kohsuke.stapler.export.ExportedBean; /** * Redeploy action for the entire {@link MavenModuleSetBuild}. * * @author Kohsuke Kawaguchi */ +@ExportedBean public class MavenAggregatedArtifactRecord extends MavenAbstractArtifactRecord implements MavenAggregatedReport { public final MavenModuleSetBuild parent; @@ -68,17 +72,27 @@ public class MavenAggregatedArtifactRecord extends MavenAbstractArtifactRecord getModuleRecords() { + List r = new ArrayList(); + for (MavenBuild build : parent.getModuleLastBuilds().values()) { + MavenArtifactRecord mar = build.getAction(MavenArtifactRecord.class); + if(mar!=null) r.add(mar); + } + return r; + } + public void deploy(MavenEmbedder embedder, ArtifactRepository deploymentRepository, TaskListener listener) throws MavenEmbedderException, IOException, ComponentLookupException, ArtifactDeploymentException { if(debug) listener.getLogger().println("Redeploying artifacts of "+parent+" timestamp="+parent.getTimestamp()); - for (MavenBuild build : parent.getModuleLastBuilds().values()) { - MavenArtifactRecord mar = build.getAction(MavenArtifactRecord.class); - if(mar!=null) { - if(debug) - listener.getLogger().println("Deploying module: "+build+" timestamp="+build.getTimestamp()); - mar.deploy(embedder,deploymentRepository,listener); - } + for (MavenArtifactRecord mar : getModuleRecords()) { + if(debug) + listener.getLogger().println("Deploying module: "+mar.parent+" timestamp="+mar.parent.getTimestamp()); + mar.deploy(embedder,deploymentRepository,listener); } } } diff --git a/maven-plugin/src/main/java/hudson/maven/reporters/MavenArtifact.java b/maven-plugin/src/main/java/hudson/maven/reporters/MavenArtifact.java index 9116d4fbe6..a7f4537e01 100644 --- a/maven-plugin/src/main/java/hudson/maven/reporters/MavenArtifact.java +++ b/maven-plugin/src/main/java/hudson/maven/reporters/MavenArtifact.java @@ -1,7 +1,7 @@ /* * The MIT License * - * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi + * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, CloudBees, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -27,10 +27,12 @@ import hudson.FilePath; import hudson.Util; import hudson.maven.MavenBuild; import hudson.maven.MavenBuildProxy; +import hudson.model.Api; import hudson.model.BuildListener; import hudson.model.FingerprintMap; import jenkins.model.Jenkins; +import hudson.util.HttpResponses; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.handler.ArtifactHandler; @@ -38,6 +40,10 @@ import org.apache.maven.artifact.handler.DefaultArtifactHandler; import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; import com.google.common.collect.Maps; +import org.kohsuke.stapler.AncestorInPath; +import org.kohsuke.stapler.HttpResponse; +import org.kohsuke.stapler.export.Exported; +import org.kohsuke.stapler.export.ExportedBean; import java.io.File; import java.io.FileInputStream; @@ -60,10 +66,12 @@ import java.util.logging.Logger; * @author Kohsuke Kawaguchi * @since 1.189 */ +@ExportedBean public final class MavenArtifact implements Serializable { /** * Basic parameters of a Maven artifact. */ + @Exported public final String groupId, artifactId, version, classifier, type; /** @@ -77,6 +85,7 @@ public final class MavenArtifact implements Serializable { * use their finalName if one is configured.) This is often * different from {@link #canonicalName}. */ + @Exported public final String fileName; /** @@ -87,13 +96,15 @@ public final class MavenArtifact implements Serializable { * The reason we persist this is that the extension is only available * through {@link ArtifactHandler}. */ + @Exported public final String canonicalName; /** * The md5sum for this artifact. */ + @Exported public final String md5sum; - + public MavenArtifact(Artifact a) throws IOException { this.groupId = a.getGroupId(); this.artifactId = a.getArtifactId(); @@ -185,6 +196,15 @@ public final class MavenArtifact implements Serializable { return f; } + /** + * Serve the file. + * + * TODO: figure out how to make this URL more discoverable to the remote API. + */ + public HttpResponse doFile(@AncestorInPath MavenArtifactRecord parent) throws IOException { + return HttpResponses.staticResource(getFile(parent.parent)); + } + private FilePath getArtifactArchivePath(MavenBuildProxy build, String groupId, String artifactId, String version) { return build.getArtifactsDir().child(groupId).child(artifactId).child(version).child(canonicalName); } @@ -260,6 +280,10 @@ public final class MavenArtifact implements Serializable { map.getOrCreate(build,fileName,md5sum); } + public Api getApi() { + return new Api(this); + } + private static final Logger LOGGER = Logger.getLogger(MavenArtifact.class.getName()); private static final long serialVersionUID = 1L; diff --git a/maven-plugin/src/main/java/hudson/maven/reporters/MavenArtifactRecord.java b/maven-plugin/src/main/java/hudson/maven/reporters/MavenArtifactRecord.java index 01d5be7862..d9be870405 100644 --- a/maven-plugin/src/main/java/hudson/maven/reporters/MavenArtifactRecord.java +++ b/maven-plugin/src/main/java/hudson/maven/reporters/MavenArtifactRecord.java @@ -1,8 +1,8 @@ /* * The MIT License * - * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi - * + * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, CloudBees, Inc. + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights @@ -25,8 +25,17 @@ package hudson.maven.reporters; import hudson.maven.*; import hudson.maven.RedeployPublisher.WrappedArtifactRepository; +import hudson.model.AbstractItem; import hudson.model.Action; +import hudson.model.Api; import hudson.model.TaskListener; + +import java.io.IOException; +import java.io.PrintStream; +import java.net.URL; +import java.util.List; +import java.util.Map; + import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.deployer.ArtifactDeployer; import org.apache.maven.artifact.deployer.ArtifactDeploymentException; @@ -37,6 +46,8 @@ import org.apache.maven.artifact.installer.ArtifactInstaller; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.project.artifact.ProjectArtifactMetadata; import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.kohsuke.stapler.export.Exported; +import org.kohsuke.stapler.export.ExportedBean; import java.io.IOException; import java.io.PrintStream; @@ -51,15 +62,18 @@ import java.util.Map; * @author Kohsuke Kawaguchi * @see MavenArtifactArchiver */ +@ExportedBean public class MavenArtifactRecord extends MavenAbstractArtifactRecord implements AggregatableAction { /** * The build to which this record belongs. */ + @Exported public final MavenBuild parent; /** * POM artifact. */ + @Exported(inline=true) public final MavenArtifact pomArtifact; /** @@ -67,11 +81,13 @@ public class MavenArtifactRecord extends MavenAbstractArtifactRecord * * If this is a POM module, the main artifact contains the same value as {@link #pomArtifact}. */ + @Exported(inline=true) public final MavenArtifact mainArtifact; /** * Attached artifacts. Can be empty but never null. */ + @Exported(inline=true) public final List attachedArtifacts; /** @@ -108,11 +124,36 @@ public class MavenArtifactRecord extends MavenAbstractArtifactRecord return parent; } + /** + * Returns the URL of this record relative to the context root of the application. + * + * @see AbstractItem#getUrl() for how to implement this. + * + * @return + * URL that ends with '/'. + */ + public String getUrl() { + return parent.getUrl()+"mavenArtifacts/"; + } + + /** + * Obtains the absolute URL to this build. + * + * @deprecated + * This method shall NEVER be used during HTML page rendering, as it's too easy for + * misconfiguration to break this value, with network set up like Apache reverse proxy. + * This method is only intended for the remote API clients who cannot resolve relative references. + */ + @Exported(visibility=2,name="url") + public String getAbsoluteUrl() { + return parent.getAbsoluteUrl()+"mavenArtifacts/"; + } + public boolean isPOM() { return mainArtifact.isPOM(); } - public MavenAggregatedReport createAggregatedAction(MavenModuleSetBuild build, Map> moduleBuilds) { + public MavenAggregatedArtifactRecord createAggregatedAction(MavenModuleSetBuild build, Map> moduleBuilds) { return new MavenAggregatedArtifactRecord(build); } @@ -154,8 +195,6 @@ public class MavenArtifactRecord extends MavenAbstractArtifactRecord } } - - /** * Installs the artifact to the local Maven repository. */ @@ -170,7 +209,7 @@ public class MavenArtifactRecord extends MavenAbstractArtifactRecord installer.install(mainArtifact.getFile(parent),main,embedder.getLocalRepository()); for (MavenArtifact aa : attachedArtifacts) - installer.install(aa.getFile(parent),aa.toArtifact(handlerManager,factory,parent),embedder.getLocalRepository()); + installer.install(aa.getFile(parent), aa.toArtifact(handlerManager, factory, parent), embedder.getLocalRepository()); } public void recordFingerprints() throws IOException { diff --git a/maven-plugin/src/main/resources/hudson/maven/AbstractMavenBuild/_api.jelly b/maven-plugin/src/main/resources/hudson/maven/AbstractMavenBuild/_api.jelly new file mode 100644 index 0000000000..bafda2ca92 --- /dev/null +++ b/maven-plugin/src/main/resources/hudson/maven/AbstractMavenBuild/_api.jelly @@ -0,0 +1,32 @@ + + + + +

Artifact Information

+

+ Information about Maven artifacts produced by this are exposed + in a machine readable form. This allows programmatic retrieval of the artifacts. +

+ \ No newline at end of file diff --git a/maven-plugin/src/main/resources/hudson/maven/reporters/MavenArtifactRecord/_api.jelly b/maven-plugin/src/main/resources/hudson/maven/reporters/MavenArtifactRecord/_api.jelly new file mode 100644 index 0000000000..fb1a34bc8a --- /dev/null +++ b/maven-plugin/src/main/resources/hudson/maven/reporters/MavenArtifactRecord/_api.jelly @@ -0,0 +1,37 @@ + + + +

Artifact Download

+

+ primary artifact, + primary artifact, + attached artifact #1, + attached artifact #2, etc., all have + stable URLs that's not affected by their GAV IDs (if you want to access them through GAV IDs, + you can do so through the artifacts link.) Swap the last file with api + and you can retrieve their GAV IDs and other information, such as + this. +

+
\ No newline at end of file diff --git a/war/src/main/webapp/WEB-INF/security/SecurityFilters.groovy b/war/src/main/webapp/WEB-INF/security/SecurityFilters.groovy index 83d821c92e..0e6b6ffdb4 100644 --- a/war/src/main/webapp/WEB-INF/security/SecurityFilters.groovy +++ b/war/src/main/webapp/WEB-INF/security/SecurityFilters.groovy @@ -39,6 +39,7 @@ import org.acegisecurity.ui.basicauth.BasicProcessingFilterEntryPoint import org.acegisecurity.ui.rememberme.RememberMeProcessingFilter import hudson.security.HttpSessionContextIntegrationFilter2 import hudson.security.SecurityRealm +import hudson.security.NoopFilter // providers that apply to both patterns def commonProviders() { @@ -63,6 +64,8 @@ filter(ChainedServletFilter) { bean(HttpSessionContextIntegrationFilter2) { }, // allow clients to submit basic authentication credential + // but allow that to be skipped since it can interfere with reverse proxy setup + Boolean.getBoolean("jenkins.security.ignoreBasicAuth") ? bean(NoopFilter) : bean(BasicProcessingFilter) { authenticationManager = securityComponents.manager // if basic authentication fails (which only happens incorrect basic auth credential is sent),