maslan
maslan

Reputation: 2178

Teamcity using external Maven

I have installed team city 2019.1 on a unix server. I want to configure a new maven that is not bundled in team city, but on a unix filesystem on a path specified by me. The problem is that when I go to Administration-->Tools--> Maven-->Install Version... I can only choose to upload maven or get teamcity to download it, but there is no way to just specify maven path. How to use my own maven with teamcity?

Upvotes: 3

Views: 1464

Answers (1)

ben
ben

Reputation: 142

The below examples are for linux and you need to adopt the windows-style command executions and paths et-cetera.

First you need to set your M2_HOME property pointing to your desired maven installation for your agent with adding a line like the below one to the end of your buildAgent.properties, that is available under buildAgent/conf folder.

env.M2_HOME=/opt/apps/maven/apache-maven-3.6.3

Then you need to re-start your agent with the agent.sh stop then start script, that is available in your buildAgent/bin folder.

When your agent has registered, you will see the above env.M2_HOME was resolved as an environment variable M2_HOME: Log on your TeamCity, navigate to Agents -> your agent -> Agent Parameters -> Environment Variables.

Next you need to Edit Settings of your build configuration then select Build Steps and edit those build steps where you need your custom maven installation. You need to click on Show advanced options then under Maven settings select Auto: For Auto, the path is taken from the M2_HOME environment variable, otherwise the default Maven version will be used.

Upvotes: 2

Related Questions