How to programitcally publish a file to buildResults via java (equivalent to Ant task FilePulisher)?
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?
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
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.