Class XmlUtils
- java.lang.Object
-
- org.jenkinsci.plugins.pipeline.maven.util.XmlUtils
-
public class XmlUtils extends Object
- Author:
- Cyrille Le Clerc
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XmlUtils.RestrictiveEntityResolver
CopyRestrictiveEntityResolver
as it is secured byNoExternalUse
.
-
Constructor Summary
Constructors Constructor Description XmlUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Element
getArtifactDeployedEvent(List<Element> artifactDeployedEvents, String filePath)
static List<Element>
getArtifactDeployedEvents(Element mavenSpyLogs)
static List<Element>
getChildrenElements(Element element, String childElementName)
static List<String>
getExecutedLifecyclePhases(Element mavenSpyLogs)
static List<Element>
getExecutionEvents(Element mavenSpyLogs, String... expectedType)
static List<Element>
getExecutionEventsByPlugin(Element mavenSpyLogs, String pluginGroupId, String pluginArtifactId, String pluginGoal, String... eventType)
static String
getFileSeparatorOnRemote(FilePath filePath)
Return the File separator "/" or "\" that is effective on the remote agent.static String
getPathInWorkspace(String absoluteFilePath, FilePath workspace)
Relativize pathstatic String
getProjectBuildDirectory(Element projectElt)
static Element
getUniqueChildElement(Element element, String childElementName)
static Element
getUniqueChildElementOrNull(Element element, String... childElementName)
static boolean
isWindows(FilePath path)
Deprecated.static String
join(Iterable<String> elements, String delimiter)
Concatenate the givenelements
using the givendelimiter
to concatenate.static List<org.jenkinsci.plugins.pipeline.maven.MavenArtifact>
listGeneratedArtifacts(Element mavenSpyLogs, boolean includeAttachedArtifacts)
static org.jenkinsci.plugins.pipeline.maven.MavenArtifact
newMavenArtifact(Element artifactElt)
static org.jenkinsci.plugins.pipeline.maven.MavenDependency
newMavenDependency(Element dependencyElt)
static MavenSpyLogProcessor.PluginInvocation
newPluginInvocation(Element pluginInvocationElt)
static String
toString(Node node)
-
-
-
Method Detail
-
newMavenArtifact
public static org.jenkinsci.plugins.pipeline.maven.MavenArtifact newMavenArtifact(Element artifactElt)
-
newMavenDependency
public static org.jenkinsci.plugins.pipeline.maven.MavenDependency newMavenDependency(Element dependencyElt)
-
newPluginInvocation
public static MavenSpyLogProcessor.PluginInvocation newPluginInvocation(Element pluginInvocationElt)
-
getUniqueChildElement
@NonNull public static Element getUniqueChildElement(@NonNull Element element, @NonNull String childElementName)
-
getUniqueChildElementOrNull
@Nullable public static Element getUniqueChildElementOrNull(@NonNull Element element, String... childElementName)
-
getChildrenElements
@NonNull public static List<Element> getChildrenElements(@NonNull Element element, @NonNull String childElementName)
-
getExecutionEvents
@NonNull public static List<Element> getExecutionEvents(@NonNull Element mavenSpyLogs, String... expectedType)
-
getArtifactDeployedEvents
@NonNull public static List<Element> getArtifactDeployedEvents(@NonNull Element mavenSpyLogs)
-
getArtifactDeployedEvent
@Nullable public static Element getArtifactDeployedEvent(@NonNull List<Element> artifactDeployedEvents, @NonNull String filePath)
- Parameters:
artifactDeployedEvents
- list of "RepositoryEvent" of type "ARTIFACT_DEPLOYED"filePath
- file path of the artifact we search for- Returns:
- The "RepositoryEvent" of type "ARTIFACT_DEPLOYED" or
null
if non found
-
getExecutionEventsByPlugin
@NonNull public static List<Element> getExecutionEventsByPlugin(@NonNull Element mavenSpyLogs, String pluginGroupId, String pluginArtifactId, String pluginGoal, String... eventType)
-
getExecutedLifecyclePhases
@NonNull public static List<String> getExecutedLifecyclePhases(@NonNull Element mavenSpyLogs)
-
getPathInWorkspace
@NonNull public static String getPathInWorkspace(@NonNull String absoluteFilePath, @NonNull FilePath workspace)
Relativize pathTODO replace all the workarounds (JENKINS-44088, JENKINS-46084, mac special folders...) by a unique call to
File.getCanonicalPath()
on the workspace for the whole "MavenSpyLogProcessor#processMavenSpyLogs" code block. We donb't want to pay an RPC call toFile.getCanonicalPath()
each time.- Returns:
- relativized path
- Throws:
IllegalArgumentException
- ifother
is not aPath
that can be relativized against this path- See Also:
Path.relativize(Path)
-
isWindows
@Deprecated public static boolean isWindows(@NonNull FilePath path)
Deprecated.
-
getFileSeparatorOnRemote
@NonNull public static String getFileSeparatorOnRemote(@NonNull FilePath filePath)
Return the File separator "/" or "\" that is effective on the remote agent.- Parameters:
filePath
-- Returns:
- "/" or "\"
-
getProjectBuildDirectory
@Nullable public static String getProjectBuildDirectory(@NonNull Element projectElt)
- Parameters:
projectElt
-- Returns:
project/build/@directory"
-
join
@NonNull public static String join(@NonNull Iterable<String> elements, @NonNull String delimiter)
Concatenate the givenelements
using the givendelimiter
to concatenate.
-
-