Marc Rufer 19 Jun 2015 CI/CD JetBrains TeamCity Java maven
In this post I’ll show you how to set up a java build job for building and releasing a maven artifact. The activiti wrapper will be used as an example project. It’s a maven project that will be released by using the Maven Release plugin.
Before creating build configuraitons for java projects, the following conditions must be met on the host system:
HINT: The TeamCity instance used here has no external build agents configured and runs under system account.
Git username and email for system set
git config --system user.name "John Doe"
git config --system user.email john.doe@example.com
Go to your TeamCity server and perform the follwing steps
Under VCS Roots you can edit the existing VCS root to define the branch to check out (in our case this would be the release
branch)
Upload the maven settings.xml file which should be used for the release to the TeamCity server
Go to General Settings, choose the auto detected build configuration and click on edit
(NOTE: In this sample there are two configurations because one of them was added manually in advance)
Navigate to the Version Control Settings and change the VCS checkout mode to Automatically on Agent
The parameters were specified as follows
Almost always the release:prepare goal of the maven release plugin hangs, the problem is that the GIT password is not set. In such a case the actual build has to be stopped and the password has to be set (i.e. according the manual above)
If the error message No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
occurs while the maven release plugin is preparing the release you have to install a java JDK on the build agents host system.
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
If the error message Please tell me who you are
occurs on maven release:prepare the following commands have to be run on the build agents host system:
git config --system user.name "John Doe"
git config --system user.email john.doe@example.com