Monday, March 26, 2018

Resolving Maven "trustAnchors parameter must be non-empty" error

I encountered this Maven error on a new Ubuntu 18.04 system while trying to perform a mvn build on a Google AppEngine project. A screenshot of the error message is shown below.

It seems to be complaining about some " the trustAnchors parameter must be non-empty" error.

After trying out some suggestions about regenerating Java security certificates, which didn't work, I managed to resolve the problem by creating a Maven  settings.xml file under a hidden folder .m2 underneath the user's home directory.

An example settings.xml file is shown below.

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="" xmlns:xsi="" xsi:schemaLocation="                  ">
   <interactiveMode />
   <usePluginRegistry />
   <offline />
   <pluginGroups />
   <servers />
   <mirrors />
    </proxy> -->
      <!--make the profile active all the time -->
         <!--Override the repository (and pluginRepository) "central" from the
                     Maven Super POM -->
Change the localRepository tag from /home/yourname/.m2/repository to correct location of your Maven repository.

Then place this the settings.xml file in the following location /home/your_user_id/.m2/

Now when running Maven build commands, the error messages no longer appear.


Unknown said...

I had the same problem, in my case I solve the issue installing Oracle JDK, I was using Open JDK.

DAH said...

A quick and easy fix. Worked the first time. Thanks for posting this!

Jack Yang said...

Nice solution, thanks for your posting.

Related Posts with Thumbnails