Multiple solutions to Unable to import maven project: See logs for details error

insert image description here

1. Reproduce the error


gitlabAfter downloading the project from the upload today , the project cannot be started. Notice the one in the lower right corner Evnet Log, and click to open it, as shown in the figure below:

insert image description here

ie Unable to import maven project: See logs for details.

2. Analysis errors


Will be Unable to import maven project: See logs for detailstranslated into Chinese, that is无法导入maven项目:参阅日志

So, how to refer to the log? Opening , as shown ideabelow Help -> show Log in Explorer:

insert image description here

Open the log and find a bunch of error messages, as shown in the following figure:

insert image description here

According to the error message in the red box, I can't connect to Google's services, why can't I connect to Google's services? But I didn't take the initiative to connect to Google's services.

Some of the mirrors that our project relies on are foreign. For example, some frameworks are open sourced by Google, so foreign mirrors sometimes have different networks.

So, how do we solve this problem?

3. Solve the problem


I provide the following two solutions to solve the current error.

3.1 Solution 1


Use ideathe one that comes with the editor maven.

We use CTRL + ALT + Sthe shortcut key to open the setting panel ( Settings), Settingsfind it in the setting panel ( ) Build, Execution, Deployment -> Build Tools -> Maven, and Maven home directorymodify it to the system's own, as shown in the following figure:

insert image description here

Click OKto resolve the error.

If your CTRL + ALT + Sshortcut keys conflict, you can use the following method to open the settings panel ( Settings):

insert image description here

3.2 Solution 2


Instead of using ideathe built-in one maven, we still use our own installation maven.

  1. First open maventhe configuration file ( settings.xml)

insert image description here

If you Mavendon't have it Open 'settings.xml', you can find it in the files mavenin your installation directory conf.

For example, in my maveninstallation directory D:\software\apache-maven-3.8.1, then I will confsearch for the files in the directory, that is D:\software\apache-maven-3.8.1\conf, as shown in the following figure:

insert image description here

  1. Then in settings.xmlthe file, change the mirror address to the Alibaba Cloud mirror address.
<mirror>
    <id>alimaven</id>
    <name>aliyun maven</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    <mirrorOf>central</mirrorOf>
</mirror>
  1. Finally, reimport the package

insert image description here

4. Supplementary Notes


There are also some points to pay attention to, ideawhich are cached.

After you modify it, clear the cache and restart as shown in the screenshot below:

insert image description here

insert image description here

There is another place that will also affect the setting problem. My ideadefault setting is , but it does not meet our needs, so it is better to set it to , as shown in the following figure:settings -> build,execution,Deployment -> Build Tools -> Maven -> importingJDK for importerjrejrejdk

insert image description here

Guess you like

Origin blog.csdn.net/lvoelife/article/details/129862234