-
Notifications
You must be signed in to change notification settings - Fork 38
Building Find
Building Find requires the following to be installed:
- Git | Alternative for Windows only
-
Apache Maven 3 (Hint: make sure the
mvnexecutable is in yourPATHenvironment variable) - NodeJS
- Java JDK 17 or 21
If you're behind a proxy, you may have to configure your proxy settings for the build tools. Replace the proxy URL below with your actual proxy.
If you're on Linux, or using Git Bash on Windows, you can use e.g.
export http_proxy=http://proxy.example.com:8080; export https_proxy=http://proxy.example.com:8080;
Your ~/.npmrc should contain e.g.
proxy=http://proxy.example.com:8080/
https-proxy=http://proxy.example.com:8080/
Your ~/.m2/settings.xml should have a <proxies> section configured as well, see https://maven.apache.org/guides/mini/guide-proxies.html
First, we use Git to clone Find from GitHub. From your command line (hint: Git Bash is better than the Windows Command Prompt), run:
git clone https://github.com/microfocus-idol/find.git --branch=master
By default, this will create a folder called find with the master branch checked out.
Change the --branch option if you want to build a different branch, e.g. if you've been given a link with /tree/ in it like https://github.com/microfocus-idol/find/tree/develop , that refers to the develop branch and you'd use git clone https://github.com/microfocus-idol/find.git --branch=develop instead.
Inside this folder will be a webapp directory containing the Maven project.
Change your current directory to be the new webapp folder:
cd find/webapp
Find uses the Git commit hash as a "cache-buster" - all static files (CSS, JavaScript, HTML templates, etc) are "stamped" with the Git Commit hash as part of the build process. This means that with every new build, all the file names (apart from index.html - the entry point to the application) change. This is to make sure that browsers don't use old, cached versions of the code.
We need to get the Git commit hash and pass it to Maven.
git rev-parse --short HEAD will give you the hash of the latest commit on your current branch.
From Bash, run the following command:
GIT_COMMIT=`git rev-parse --short HEAD`
You can check that this worked by running echo $GIT_COMMIT - this should print out the hash.
Run the following command:
mvn clean package -pl idol -am -Dapplication.buildNumber=$GIT_COMMIT
($GIT_COMMIT assumes that you followed the steps in the "Store the Git Commit Hash" section and chose to call your variable GIT_COMMIT)
You should see lots of scrolling text, followed by a large BUILD SUCCESS message. This might take a few minutes!
If this doesn't work, check that you've installed everything correctly:
-
mvn -versionshould give you a version higher than 3 (e.g. "3.2.3") -
java -versionshould give you a version higher than 17.0.0 (e.g. "17.0.9") -
node -vshould give you a version higher than 8.9 (e.g. "v12.13.0") -
npm -vshould give you a version higher than 5.7.1 (eg. "6.12.1") (bundled with NodeJS 10)
-
idol/target/find.war- this is a build of Find with the Micro Focus IDOL modules included (note: this only works with IDOL 10 - IDOL 7 is not supported). -
on-prem-dist/target/find-*.zip- this is a zip archive containing the IDOL build of Find (find.war) and some scripts for running Find as a service. You probably don't want to use this - just ignore it.
To optimize the JavaScript and CSS resources, run Maven with the production profile, like so:
mvn clean package -pl idol -am -Dapplication.buildNumber=$GIT_COMMIT -Pproduction
You may want to speed up the build by specifying the skipTests flag.
On 11.6 and above, you can also enable generation of javascript source maps for your optimized javascript by using the js.source.map flag, e.g.
mvn clean package -pl idol -am -Dapplication.buildNumber=$GIT_COMMIT -Pproduction -Djs.source.map=true