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(RemoteObjectWrapper.java:98)
	at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.resolveProject(MavenEmbedderWrapper.java:116)
	at org.jetbrains.idea.maven.project.MavenProjectReader.resolveProject(MavenProjectReader.java:488)
	at org.jetbrains.idea.maven.project.MavenProjectsTree.doResolve(MavenProjectsTree.java:1293)
	at org.jetbrains.idea.maven.project.MavenProjectsTree.resolve(MavenProjectsTree.java:1265)
	at org.jetbrains.idea.maven.project.MavenProjectsProcessorResolvingTask.perform(MavenProjectsProcessorResolvingTask.java:44)
	at org.jetbrains.idea.maven.project.MavenProjectsProcessor.doProcessPendingTasks(MavenProjectsProcessor.java:132)
	at org.jetbrains.idea.maven.project.MavenProjectsProcessor.access$000(MavenProjectsProcessor.java:32)
	at org.jetbrains.idea.maven.project.MavenProjectsProcessor$2.run(MavenProjectsProcessor.java:107)
	at org.jetbrains.idea.maven.utils.MavenUtil.lambda$runInBackground$5(MavenUtil.java:449)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is: 
	java.net.SocketException: Connection reset
	at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:229)
	at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:162)
	at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:227)
	at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:179)
	at com.sun.proxy.$Proxy207.resolveProject(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.execution.rmi.RemoteUtil.invokeRemote(RemoteUtil.java:179)
	at com.intellij.execution.rmi.RemoteUtil.access$300(RemoteUtil.java:39)
	at com.intellij.execution.rmi.RemoteUtil$2$1$1.compute(RemoteUtil.java:160)
	at com.intellij.openapi.util.ClassLoaderUtil.runWithClassLoader(ClassLoaderUtil.java:66)
	at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(RemoteUtil.java:231)
	at com.intellij.execution.rmi.RemoteUtil$2$1.invoke(RemoteUtil.java:157)
	at com.sun.proxy.$Proxy207.resolveProject(Unknown Source)
	at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.lambda$resolveProject$5(MavenEmbedderWrapper.java:118)
	at org.jetbrains.idea.maven.server.RemoteObjectWrapper.performCancelable(RemoteObjectWrapper.java:89)
	... 15 more
Caused by: java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(SocketInputStream.java:210)
	at java.net.SocketInputStream.read(SocketInputStream.java:141)
	at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
	at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
	at java.io.DataInputStream.readByte(DataInputStream.java:265)
	at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:215)
	... 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