Invalid pom file after idea clones project from git

Posted by crazylegseddie on Fri, 05 Jun 2020 10:15:17 +0200

Invalid pom file after idea clones project from git

When your idea pulls projects from git, projects that are cloned for the first time often report that pom files are not in maven format: as shown in the following figure

This is because Maven has not been set after getting down from git. Open File - > setting - > buid, exception, deployment - > build tools - > Maven to set Maven as your local storage address, as shown in the figure, my local maven, and the warehouse to my own address:

Importing because your jar package will be found by default and set as the address of your own jdk, click apply
Open it again
Configure the Modules, add the project to the data source again, project and SDKs will set the jdk as your jdk address,
At this time, click Maven to refresh. As a result, Maven is still not in the form of M. right click the pom file and you will find that there is a sentence "Add as maven project" below. Because some idea s cannot load the pom file automatically after configuring maven, as shown in the figure below, because I have clicked add pom before displaying maven, otherwise, the words that you need to add will be displayed.

Right click to add the jar package automatically. It's better to wait for it. But the problem is coming again. When importing the jar package, the following sentence appears: Unable to import maven project: See logs for details
Display let's open the log to see what's the reason, and follow the following steps to find out ieda.log journal.

The following error is reported when opening the log,

2020-06-05 14:09:24,787 [15275433]   INFO -      #org.jetbrains.idea.maven - Cannot reconnect. 
java.lang.RuntimeException: Cannot reconnect.
	at org.jetbrains.idea.maven.server.RemoteObjectWrapper.performCancelable(
	at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.resolveProject(
	at org.jetbrains.idea.maven.project.MavenProjectReader.resolveProject(
	at org.jetbrains.idea.maven.project.MavenProjectsTree.doResolve(
	at org.jetbrains.idea.maven.project.MavenProjectsTree.resolve(
	at org.jetbrains.idea.maven.project.MavenProjectsProcessorResolvingTask.perform(
	at org.jetbrains.idea.maven.project.MavenProjectsProcessor.doProcessPendingTasks(
	at org.jetbrains.idea.maven.project.MavenProjectsProcessor.access$000(
	at org.jetbrains.idea.maven.project.MavenProjectsProcessor$
	at org.jetbrains.idea.maven.utils.MavenUtil.lambda$runInBackground$5(
	at com.intellij.openapi.application.impl.ApplicationImpl$
	at java.util.concurrent.Executors$
	at java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.util.concurrent.ThreadPoolExecutor$
Caused by: java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is: Connection reset
	at sun.rmi.transport.StreamRemoteCall.executeCall(
	at sun.rmi.server.UnicastRef.invoke(
	at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(
	at java.rmi.server.RemoteObjectInvocationHandler.invoke(
	at com.sun.proxy.$Proxy207.resolveProject(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at com.intellij.execution.rmi.RemoteUtil.invokeRemote(
	at com.intellij.execution.rmi.RemoteUtil.access$300(
	at com.intellij.execution.rmi.RemoteUtil$2$1$1.compute(
	at com.intellij.openapi.util.ClassLoaderUtil.runWithClassLoader(
	at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(
	at com.intellij.execution.rmi.RemoteUtil$2$1.invoke(
	at com.sun.proxy.$Proxy207.resolveProject(Unknown Source)
	at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.lambda$resolveProject$5(
	at org.jetbrains.idea.maven.server.RemoteObjectWrapper.performCancelable(
	... 15 more
Caused by: Connection reset
	at sun.rmi.transport.StreamRemoteCall.executeCall(
	... 32 more
2020-06-05 14:09:26,093 [15276739]   INFO - ution.rmi.RemoteProcessSupport - Terminating: 28924/Maven3ServerImpld393d748 
2020-06-05 14:09:27,346 [15277992]   INFO - ution.rmi.RemoteProcessSupport - Terminating: 64832/Maven3ServerImpl4b0f2793 
2020-06-05 14:09:27,364 [15278010]  ERROR -      #org.jetbrains.idea.maven - Canno

It indicates that the network cannot be connected. There are two options:
If your local maven repository does not have many packages, delete all the packages and download the jar package again.
If there are many packages in your local warehouse, delete and reload the jar package dependency that reports errors in the pom file of the newly pulled project. Since there is no dependency of that jar package, the project will not report errors. At this time, add the dependency that you just deleted and refresh maven. At this time, you will find that the jar package is downloading happily again. If you report errors again, refresh more Two times, because some download the jar package from the online warehouse, and suddenly some incomprehensible errors will be reported, at this time, only two times more refresh.

Link: link.

Topics: Java Maven git JDK