Transcripted Summary

Now we will learn how to configure Maven in Jenkins.

Go to the Jenkins dashboard, click on "Manage Jenkins", then click on "Global Tool Configuration".



Here we see many tool configuration options. We need to complete the Maven configuration but as a prerequisite we need to configure the Java JDK first.

Under the "JDK" section click on "JDK installationsā€¦".

Here the "Install automatically" option is checked by default.

Clear this option and point to the one that is installed on your machine.

I have Java 8 installed so I'll type "Java 1.8" in the name field.

In "JAVA_HOME" I'll provide the Java installer path on my machine.

Now save and apply changes.



Back in the Maven section, click on "Maven installationsā€¦".

Here the "Install automatically" option is also checked by default and needs to be cleared.

Add the Maven name to the "Name" field.

The version in my system is 3.6.3.

Then add the "MAVEN_HOME" path where Maven is installed.

Apply and save your changes.



NOTE

You can also proceed using the default installer options but in some cases, due to firewall settings and security issues, your project may not be able to download these dependencies automatically. In such cases, referencing local installations avoids the issue.


All right. Now, to create a new job for our project. Let's name it "MavenSeleniumTestProject" and choose "Freestyle project" as the type.



Click "OK" to continue with default settings.

In the "Build" section under "Build Environment", add the build step "Execute top-level Maven targets".

Additional fields such as Maven goals are now visible.

Clicking on the "Advanced" button expands the form further and now we can set the POM path.

Let's copy the path to "pom.xml" and paste it here.



Let's add our Maven goals which can be "clean test" for now.

One last thing, let's check the option to "Delete workspace before build starts".

Okay, apply and save changes.

Now we are all set to run our first Jenkins integrated test.

Click "Build now" and let's see how it does.

Now the test is running. It's opening the browser and launching the URL. Good.

So the first test has executed from Jenkins.



Let's perform more tests and configurations in the coming chapters.



Quiz

The quiz for this chapter can be found in section 3.7

Ā© 2024 Applitools. All rights reserved. Terms and Conditions Privacy Policy GDPR