It's all about the answers!

Ask a question

Run Build and create Snapshot using Java API?


Karthik Krishnan (8825117163) | asked Nov 28 '11, 5:19 a.m.
Hi all,

I am wondering if the following is possible in RTC via Java API?

    Load a given workspace
    Run a build definition against this workspace(Ant)
    Create Snapshot after build is successful (this is automatic process)
    Set the owner of the snapshot as Stream


Regards,
Karthik

5 answers



permanent link
Nick Edgar (6.5k711) | answered Dec 01 '11, 11:20 p.m.
JAZZ DEVELOPER
Hi Karthik,

The workflow in your original post is a little non-standard. It would be more straightforward to configure the build definition to do the SCM phase, which does:
- accept latest changes from stream (it's actually a replace, bringing the build workspace into sync with what's in the stream)
- creates a snapshot (associated with the build workspace)
- loads the workspace

The rest of the build the runs (Ant / Maven / command line ...)

In 3.0.1, we added a Post-build deliver option which you can use to deliver changes to a target stream (again, it's actually doing a replace).

In 4.0, we've added an option in Post-build deliver to also promote the snapshot to be associated with this stream too. Until 4.0 is available, the alternative would be to use the SCM CLI to do the promotion, invoked from the build script.

Assuming all the above is done as part of the build definition configuration and/or script, all you need to do then is request a build for the given build definition, and (optionally) wait for it to complete. This can be done with the requestTeamBuild and waitForTeamBuild Ant tasks. See the Ant task reference's section on controlling the build lifecycle for details.

For tips on using the SCM CLI in builds, see this article.

permanent link
Michele Pegoraro (1.8k14118103) | answered Dec 01 '11, 5:11 a.m.
The main class you have to use is IWorkspaceConnection (you can obtain it from IWorkspace or IWorkspaceHandle using IWorkspaceManager.getWorkspaceConnection).

From this class you can use createBaselineSet and addBaselineSet methods to create and promote a snapshot (which is named BaselineSet)

Michele.

permanent link
Ralph Schoon (63.1k33645) | answered Nov 30 '11, 9:24 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Good luck! Would be great if you could feed back the result.

BTW, when developing with Plain Java Client Library in said plugin project, the only disadvantage is you need to add the dependencies to the used plugins. Otherwise the PDE is confused.

permanent link
Karthik Krishnan (8825117163) | answered Nov 30 '11, 9:19 a.m.
Hi Kartik,

please see https://jazz.net/library/article/634 which triggers a build. I assume all you request is doable through the Plain Java Client Library and the same api provided in Eclipse. You just have to find your way through the API.

Some hints:

https://jazz.net/wiki/bin/view/Main/RTCSDK20_SourceControl

Visual Studio, but maybe other ideas: https://jazz.net/wiki/bin/view/Main/APIUsage

To set up for development with Plain Java Client library set up the SDK first (workshop) then create a plugin project and provide it with the Plain Java Client Library this allows to browse the SDK while developing. There is also a new API document for download with 3.0.1.1.


Thanks Ralph. Will give a try

permanent link
Ralph Schoon (63.1k33645) | answered Nov 30 '11, 8:08 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Kartik,

please see https://jazz.net/library/article/634 which triggers a build. I assume all you request is doable through the Plain Java Client Library and the same api provided in Eclipse. You just have to find your way through the API.

Some hints:

https://jazz.net/wiki/bin/view/Main/RTCSDK20_SourceControl

Visual Studio, but maybe other ideas: https://jazz.net/wiki/bin/view/Main/APIUsage

To set up for development with Plain Java Client library set up the SDK first (workshop) then create a plugin project and provide it with the Plain Java Client Library this allows to browse the SDK while developing. There is also a new API document for download with 3.0.1.1.

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.