Installing vRealize build tools - Part 2

Share on:

In the first part I described how to prepare your environment to start using the vRealize Build Tools. In this part I’m describing how to configure your mac.

Install and configure Java JDK

I had some issues getting the VMware Build Tools, Maven and Java to work together properly. This was due to Java 8 being required by the vRealize Build Tools while I was already running the latest Java version on my mac.

Download and install JDK 8 from Oracle

Most likely you will already be running a newer version of Java. To ensure maven is using JDK 8 the JAVA_HOME variable needs to be configured and pointing to Java 8. Add below in your .bash_profile on your mac.

1export JAVA_HOME=$(/usr/libexec/java_home -v '1.8*')

Install maven

Installing maven when your already using Homebrew is very easy, just execute

1brew install maven

Create Maven master password

To ensure we do not need to store plain text passwords in the maven configuration file, we meed to configure a maven master password. Configuring a master password is done by executing the below command which will prompt you to enter your password.

1mvn --encrypt-master-password
Maven master password

The encrypted string needs to be stored in the /.m2/settings-security.xml file in your user profile. You may need to create the file if it doesn’t exist. It should look as follows.

1<settingsSecurity>
2  <master>{WA99uOOjyiYHH0Pt63cdT3XJnp079wyiliz7mp+sxfs=}</master>
3</settingsSecurity>

Install vRealize Build Tools

Now that we have installed and configured all prerequisites for the vRealize Build Tools we can configure the tools themselves.

Install the Visual Studio Code extension. Open Visual Studio Code, go to extensions and search for vRealize Developer Tools and click install.

vRealize Developer Tools

Create Java keystore

Maven uses a Java keystore to sign the packages it creates during built time, which we’ll create now. Create a directory were you’ll store the keystore. This should be a different folder then the one you’ll use to store your vRA/vRO work in.

1mkdir /Users/<your user>/Documents/vRaProjects/keystore/
2cd /Users/<your user>/Documents/vRaProjects/keystore/

Now that we create the directory, we’re ready to create the new keystore.

1keytool -keystore package.jks -genkey -alias _dunesrsa_alias_ -storepass '<PASSWORD>'

Delete the default keystore alias.

1keytool -delete -alias _dunesrsa_alias_ -keystore package.jks -storepass '<PASSWORD>'

Generate the key used to sign the packages. Make sure to modify the distinguished name in below command.

1keytool -genkey -keyalg RSA -keysize 2048 -alias _dunesrsa_alias_ -keystore package.jks -storepass '<PASSWORD>' -validity 3650 -dname 'CN=Project,OU=Department,O=Company,L=City,ST=State,C=XX,emailAddress=administrator@vsphere.local'

Configure environments file

Make sure the vRealize Build tools extension is activated in VSC. In Visual Studio Code click on the

Image not found

Web path: https://blog.stijnvermoesen.be/static/images/2020/mavenProfileIcon.png

Disk path: /static/static/images/2020/mavenProfileIcon.png

Using Page Bundles: false

in the left button corner of the window. Select edit profiles.

Edit maven profiles

Copy the example provided in the documentation and modify it according to your environment. This gives maven the necessary information about the vRA, vRO and Artifactory servers in our environment.

Store the file in /.m2/settings.xml in your user profile.

 1<?xml version="1.0" encoding="UTF-8"?>
 2<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"
 3    xmlns="http://maven.apache.org/SETTINGS/1.1.0"
 4    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 5    <servers>
 6        <server> <!--vRO details-->
 7            <username>[vRO username]</username>
 8            <password>[ Maven encrypted master password ]/password>
 9            <id>homelab-dev-vro</id>
10        </server>
11        <server> <!--vRA details-->
12            <username>[vRA username]</username>
13            <password>[ Maven encrypted master password ]</password>
14            <id>homelab-dev-vra</id>
15        </server>
16    </servers>
17    <profiles>
18        <profile>
19            <id>packaging</id>
20            <properties>
21                <keystorePassword>[keystore password]</keystorePassword> <!--Keystore password-->
22                <keystoreLocation>[path to your keystore]</keystoreLocation> <!--Path where the keystore is located-->
23            </properties>
24        </profile>
25        <profile>
26            <id>bundle</id>
27            <properties>
28                <assembly.skipAssembly>false</assembly.skipAssembly>
29            </properties>
30        </profile>
31        <profile>
32            <id>artifactory</id>
33            <repositories>
34                <repository>
35                    <snapshots><enabled>false</enabled></snapshots>
36                    <id>central</id>
37                    <name>central</name>
38                    <url>http://[ artifactory fqdn ]/artifactory/libs-release</url>
39                </repository>
40                <repository>
41                    <snapshots><enabled>true</enabled></snapshots>
42                    <id>central-snapshots</id>
43                    <name>central-snapshots</name>
44                    <url>http://[ artifactory fqdn ]/artifactory/libs-snapshot</url>
45                </repository>
46            </repositories>
47            <pluginRepositories>
48                <pluginRepository>
49                    <snapshots><enabled>false</enabled></snapshots>
50                    <id>central</id>
51                    <name>central</name>
52                    <url>http://[ artifactory fqdn ]/artifactory/libs-release</url>
53                </pluginRepository>
54                <pluginRepository>
55                    <snapshots><enabled>true</enabled></snapshots>
56                    <id>central-snapshots</id>
57                    <name>central-snapshots</name>
58                    <url>http://[ artifactory fqdn ]/artifactory/libs-snapshot</url>
59                </pluginRepository>
60            </pluginRepositories>
61            <properties>
62                <releaseRepositoryUrl>http://[ artifactory fqdn ]/artifactory/libs-release</releaseRepositoryUrl>
63                <snapshotRepositoryUrl>http://[ artifactory fqdn ]/artifactory/libs-snapshot</snapshotRepositoryUrl>
64            </properties>
65        </profile>
66        <profile>
67            <!--Environment identifier. Multiple environments are allowed by configuring multiple profiles -->
68            <id>Homelab</id>
69            <properties>
70                <!--vRO Connection-->
71                <vro.host>{vro_host}</vro.host>
72                <vro.port>{vro_port}</vro.port>
73                <vro.username>{vro_username}</vro.username> <!--NOT RECOMMENDED USE vro.serverId and encrypted credentials-->
74                <vro.password>{vro_password}</vro.password> <!--NOT RECOMMENDED USE vro.serverId and encrypted credentials-->
75                <vro.serverId>corp-dev-vro</vro.serverId>
76                <vro.auth>{basic|vra}</vro.auth> <!-- If "basic" is selected here, ensure com.vmware.o11n.sso.basic-authentication.enabled=true System Property is set in vRO -->
77                <vro.authHost>{auth_host}</vro.authHost> <!-- Required for external vRO instances when vra auth is used -->
78                <vro.authPort>{auth_port}</vro.authPort> <!-- Required for external vRO instances when vra auth is used -->
79                <vro.tenant>{vro_tenant}</vro.tenant>
80                <!--vRA Connection-->
81                <vra.host>{vra_host}</vra.host>
82                <vra.port>{vra_port}</vra.port>
83                <vra.tenant>{vra_tenant}</vra.tenant>
84                <vra.serverId>corp-dev-vra</vra.serverId>
85                <vra.username>{vra_username}</vra.username> <!--NOT RECOMMENDED USE vra.serverId and encrypted credentials-->
86                <vra.password>{vra_password}</vra.password> <!--NOT RECOMMENDED USE vra.serverId and encrypted credentials-->
87            </properties>
88        </profile>
89    </profiles>
90    <activeProfiles>
91        <activeProfile>artifactory</activeProfile>
92        <activeProfile>packaging</activeProfile>
93    </activeProfiles>
94</settings>

This concludes the configuration required on the development machine. This leaves only one thing to get started.

Install vRO hints plugin

The IntelliSense functionality, aka code completion, in the vRealize Build Tools requires the installation of a plugin on the vRO server. This plugin is provided in the vRealize Build Tools fling file downloaded earlier. Connect to vRO Control Centre of your vRealize Orchestrator server, go to Manage Plugins and import the o11nplugin-hint-2.4.18.dar file located in the ./artifacts/vscode/ folder of the fling.