Dear Jon Yes that works, putting in a Thread.sleep(...)
i.e. client.buildProject(projectSummaryID, buildDefinition.getId()); Thread.sleep(...); BuildResult buildResult = client.getLatestBuildResult(projectSummaryID); Its not a very robust solution but I guess its good enough for me :-) Once again thanks for the help. Best regards Andrew Och -----Original Message----- From: SlinnHawkins, Jon (ELS-CAM) [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 13, 2008 8:06 PM To: [email protected] Subject: RE: Triggering a build via xmlrpc and getting the result for that build The problem is that when you issue the buildProject() cmd Continuum has to interpret it and then trigger a build. At the point where buildProject returns there may not (or may) be a buildId. Once the build has triggered the buildId will be created and associated with the project. Wait a couple of seconds for the build to start then issue the getLatestBuildResult cmd. -----Original Message----- From: Och, Andrew Daniel (TSG-GDCC-SH) [mailto:[EMAIL PROTECTED] Sent: 13 May 2008 12:20 To: [email protected] Subject: RE: Triggering a build via xmlrpc and getting the result for that build Dear Jon Thanks for the help and suggestion. Unfortunately getting the getLatestBuildResult(projectSummaryID) doesn't really work as can be seen by the code snippet and the resulting error (only when I start with an empty build history): client.buildProject(projectSummaryID, buildDefinition.getId()); BuildResult buildResult = client.getLatestBuildResult(projectSummaryID); [INFO][2008-05-13 19:02:05][com.chn.hp.test.client.ContClient]- BUILD Project ID: 2 buildDefId: 18 org.apache.xmlrpc.XmlRpcException: Failed to invoke method getLatestBuildResult in class org.apache.maven.continuum.xmlrpc.server.ContinuumServiceImpl: null at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStream Transport.java:184) at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamT ransport.java:145) at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTrans port.java:94) at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHtt pTransport.java:39) at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.j ava:53) at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166) at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:136) at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:125) at org.apache.xmlrpc.client.util.ClientFactory$1.invoke(ClientFactory.java: 104) at $Proxy0.getLatestBuildResult(Unknown Source) at org.apache.maven.continuum.xmlrpc.client.ContinuumXmlRpcClient.getLatest BuildResult(ContinuumXmlRpcClient.java:333) at com.chn.hp.test.client.ContClient.<init>(ContClient.java:150) at com.chn.hp.test.client.ContClient.main(ContClient.java:171) If there are builds in the history, getting the latest build actually retrieves the previous build result! I believe that this is because buildProject() puts the build into a queue. When my next line of code executes retrieving the latest build result (the one I just triggered has not had time to be created). Hence I am trying to link the specific buildProject(...) trigger to a specific BuildResult. ie something like below would be nice: int buildID = client.buildProject(projectSummaryID, buildDefinitionID); BuildResult buildResult = client.getBuildResult(projectSummaryID, buildID); BUT the xmlrpc api does not offer the above, or does it, or does it offer a different way? Best regards Andrew Och -----Original Message----- From: SlinnHawkins, Jon (ELS-CAM) [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 13, 2008 6:26 PM To: [email protected] Subject: RE: Triggering a build via xmlrpc and getting the result for that build Hi Andrew, Use client.getLatestBuildResult(projectSummaryId); http://continuum.apache.org/ref/latest/apidocs/org/apache/maven/continuu m/xmlrpc/client/ContinuumXmlRpcClient.html Cheers Jon -----Original Message----- From: Och, Andrew Daniel (TSG-GDCC-SH) [mailto:[EMAIL PROTECTED] Sent: 13 May 2008 11:06 To: [email protected] Subject: Triggering a build via xmlrpc and getting the result for that build I would like to trigger a build via xmlrpc and get the result for that build. I use the buildProject(...) method to start a forced build. However how do I get the associated buildID from this trigger? Without a buildId I can not get a BuildResult for the build I triggered. client.buildProject(projectSummaryID, buildDefinitionID); BuildResult buildResult = client.getBuildResult(projectSummaryID, buildID); Am I being stupid? Have I missed something? Best Regards Andrew Och This email is from Elsevier Limited, a company registered in England and Wales with company number 1982084, whose registered office is The Boulevard, Langford Lane, Kidlington, Oxford, OX5 1GB, United Kingdom.
