String getProjectPomFromBuildCmd()

in jenkins-pipeline-shared-libraries/vars/maven.groovy [178:190]


String getProjectPomFromBuildCmd(String buildCmd) {
    def pom = "pom.xml"
    def fileOption = "-f"

    def projectPom = "pom.xml"
    regexF = "-f[ =]"
    regexFile = "--file[ =]"
    if (buildCmd =~ regexF || buildCmd =~ regexFile) {
        projectPom = buildCmd.substring(buildCmd.indexOf(fileOption), buildCmd.indexOf(pom) + pom.length())
        projectPom = projectPom.split("=| ")[1]
    }
    return projectPom;
}