Configure a TFS 2015 Build Server for Java
TFS 2015 comes with a new build engine. It supports building many programming languages such as .NET, Java, Xcode, Android and other languages. You can even have a build agent on Linux. For more information visit https://msdn.microsoft.com/en-us/Library/vs/alm/Build/feature-overview
In this document, I will show how to configure a build server to run Java Maven builds.
System Requirements (Copied from Maven website)
- Java Development Kit (JDK) Maven 3.3 requires JDK 1.7 or above to execute – it still allows you to build against 1.3 and other JDK versions by Using Toolchains
- Memory No minimum requirement
- Disk Approximately 10MB is required for the Maven installation itself. In addition to that, additional disk space will be used for your local Maven repository. The size of your local repository will vary depending on usage but expect at least 500MB.
- Operating System No minimum requirement. Start up scripts are included as shell scripts and Windows batch files.
Make sure you install the JDK and not just the JRE. Other than that, the installation itself should be straightforward
Create the Environment Variable JAVA_HOME
- Go to Control panel –> System and Security –> System –>Advanced system settings –> Advanced –> Environment Variables
Add new System variable and enter JAVA_HOME as “the Variable name” and jdk path
- Restart the machine
To test, open commandline and type echo %JAVA_HOME%
At the time of writing this document, Maven 3.3.9 was the latest version of Maven. Download Binary zip archive from http://maven.apache.org/download.cgi. I created a folder at c:\JavaTools to have my Java related tools. I extracted the contents of the zip file into c:\JavaTools folder
Test Maven from commandline by typing c:\JavaTools\apache-maven-3.3.9\bin\mvn -v . If you have all the prerequisites, you should see something similar to the following output
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T11:41:47-05:00)
Maven home: c:\JavaTools\apache-maven-3.3.9\bin\..
Java version: 1.8.0_72, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_72\jre
Default locale: en_US, platform encoding: Cp1252
OS name: “windows server 2008 r2”, version: “6.1”, arch: “amd64”, family: “dos”
Create an M2_HOME Environment Variable
- Create M2_HOME system variable with a value of the Maven folder
- Restart the machine logout and log back in
In the next blog post, I will show how to install and configure Team Build agents in TFs 2015.