Eugene Gligalov created JENKINS-13662:
-----------------------------------------

             Summary: Maven job Pre Step properties are not getting right
                 Key: JENKINS-13662
                 URL: https://issues.jenkins-ci.org/browse/JENKINS-13662
             Project: Jenkins
          Issue Type: Bug
          Components: core, script-realm
    Affects Versions: current
            Reporter: Eugene Gligalov
            Assignee: Kohsuke Kawaguchi
         Attachments: properties.png

Hi,
  I have defined Pre Steps for Maven job as on picture, and made the script 
which can read all information from Pre Steps, everything is OK except method 
which had to return Pre Step properties, there are 2 problems: it returns not 
string as described in 
javadoc(http://javadoc.jenkins-ci.org/hudson/tasks/Maven.html#properties) it 
returns Map, and even worse it doesn't return Pre Step properties at all, it 
returns Map of other objects, with following script you can reproduce it:
{code}
import hudson.maven.MavenModuleSet
import hudson.model.Hudson

for (item in Hudson.instance.items) {
    if (item instanceof MavenModuleSet) {
        if (item.name == "some_job_name") {
            for (prebuilder in item.prebuilders) {
                    println("Targets $prebuilder.targets")
                    println("Pom $prebuilder.pom")
                    println("jvm $prebuilder.jvmOptions")
                    println("Private repo $prebuilder.usePrivateRepository")
                    println("properties " + prebuilder.properties)
            }
        }
    }
}

String convertProperties(Map properties) {
  for (key in properties.keySet()){
    println key;
  }
 return null
}
{code}

and output which I'm getting:
{code}
Targets install
Pom pom.xml
jvm null
Private repo false
properties [class:class hudson.tasks.Maven, 
maven:hudson.tasks.Maven$MavenInstallation@5b2bb4c5, 
usePrivateRepository:false, 
descriptor:hudson.tasks.Maven$DescriptorImpl@33c5dd1b, targets:install, 
requiredMonitorService:NONE]
{code}

Thanks
Eugene

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to