It's all about the answers!

Ask a question

How to programitcally publish a file to buildResults via java (equivalent to Ant task FilePulisher)?


Steve White (4021213) | asked Jan 16 '15, 1:59 p.m.
Currently my build.xml uses the FilePublisher Ant Task to publish a file to the BuildResult. This works fine.
What I rather do though is to be able to publish the file to the buildResult via my Java class the build.xml triggers.
Within my Java class I have the repository address and the buildResultUUID, so I should be able to publish the file.
I have looked at the SDK BuildRequest, BuildResult, BuildResultContribution, etc and can't see how to do what I want to do although I think it should be able to be done.
Can someone direct me to the correct classes and methods I need to use to accomplish this? Any existing examples?

Accepted answer


permanent link
Nick Edgar (6.5k711) | answered Jan 19 '15, 12:24 p.m.
JAZZ DEVELOPER
Hi Steve, the relevant API is ITeamBuildClient.addBuildResultContribution, where the contribution has contribution type id given by the value of IBuildResultContribution.ARTIFACT_EXTENDED_CONTRIBUTION_ID, and with its extendedContributionData set to the IContent the stored content blob, where IContentManager can be used to store the blob beforehand (see ITeamRepository.contentManager()). To see how this is done in more detail, check the source for ArtifactFilePublisher in the com.ibm.team.build.toolkit plugin.
Steve White selected this answer as the correct answer

Comments
Steve White commented Mar 30 '15, 7:45 a.m.

Nick, I got it working. Thanks once more for the excellent guidance.


Nick Edgar commented Mar 30 '15, 2:01 p.m.
JAZZ DEVELOPER

Good to hear. Thanks for letting me know. 

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.