Toro Boro
Toro Boro

Reputation: 417

How to switch between VCS Roots in TeamCity

In Version Control Settings tab I can add multiple VCS Roots. But how can I specify which one to use?

For example I configured two VCS Roots - A and B.

In the first build step I want to deploy code from A and in the second build step I want to deploy code from B.

When I am editing Maven Build Step I don't see any options how to choose between VCS Roots.

How can I implement this?

Upvotes: 2

Views: 1554

Answers (1)

Sam Holder
Sam Holder

Reputation: 32936

I don't think that this is how they work. When you add two VCS roots the code from both roots will be checked out. You can then just access the code as it was checked out. So build step A can just use the code from one root and step B from the other root.

If you want the code from each root to be placed in a separate folder then you can edit the checkout rules for the roots in that project to do something like this:

+:. => RootA

so that the code is checked out to a sub folder of the root checkout directory called RootA

You could do something similar for the other root so the code for both roots was in separate folders, otherwise both will just be checked out to the root checkout directory

Example:

RootA vcs contains this code structure

SomeFolder
    SomeSubFolder
        pom.xml
AnotherFolder

RootB vcs contains this structure

SomeOtherFolder
    pom.xml

When you have a project which has both vcs A and B TeamCity will checkout this:

RootCheckoutDir
    SomeFolder
        SomeSubFolder
            pom.xml
    AnotherFolder
    SomeOtherFolder
        pom.xml

So in your build step you have to provide step A with the path

RootCheckoutDir\SomeFolder\SomeSubFolder\pom.xml

and in your other step provide this path

RootCheckoutDir\SomeOtherFolder\pom.xml

Upvotes: 3

Related Questions