In this case to resolve the build issue we need to create a toolchains.xml file in .m2 directory. And add the following lines into that file.
<?xml version="1.0" encoding="UTF-8"?>
<toolchains>
<!-- JDK toolchains -->
<toolchain>
<type>jdk</type>
<provides>
<version>11</version>
<vendor>oracle</vendor>
</provides>
<configuration>
<jdkHome>C:\Program Files\Java\jdk-11.0.15</jdkHome>
</configuration>
</toolchain>
</toolchains>
After updating toolchains.xml file, go back to your project and execute the command to build the project.