Intellij升级到2019.3版本后无法解析插件(CE)

Cannot resolve plugs-ins in Intellij after upgrading to version 2019.3 (CE)

我刚刚将我的 Intellij 从版本 2019.2.x 升级到 2019.3,但在我的 Java 项目中出现以下 Maven 插件错误。

Cannot resolve plugin org.codehaus.mojo:exec-maven-plugin:1.6.0
Cannot resolve plugin org.apache.maven.plugins:maven-resources-plugin:3.1.0

下面列出了 Maven 的版本(我刚从 3.6.0 升级到 3.6.3)和 Java v11.

> Apache Maven 3.6.3  Maven home: /usr/local/Cellar/maven/3.6.3/libexec
> Java version: 11.0.2, vendor: Oracle Corporation, runtime:
/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home Default
locale: en_GB, platform encoding: UTF-8 OS name: "mac os x", version:
"10.15.1", arch: "x86_64", family: "mac"

以下是 intellij 日志文件的摘录 (idea.log)

2019-11-29 13:05:06,759 [4279936]   INFO - pl.ProjectRootManagerComponent - project roots have changed 
2019-11-29 13:05:06,794 [4279971]   INFO - .diagnostic.PerformanceWatcher - Pushing properties took 4ms; general responsiveness: ok; EDT responsiveness: ok 
2019-11-29 13:05:06,815 [4279992]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 20ms; general responsiveness: ok; EDT responsiveness: ok 
2019-11-29 13:05:07,480 [4280657]   INFO -      #org.jetbrains.idea.maven - org.apache.maven.plugin.PluginResolutionException: Plugin org.codehaus.mojo:exec-maven-plugin:1.6.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:exec-maven-plugin:jar:1.6.0 
java.lang.RuntimeException: org.apache.maven.plugin.PluginResolutionException: Plugin org.codehaus.mojo:exec-maven-plugin:1.6.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:exec-maven-plugin:jar:1.6.0
 at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:120)
 at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.resolvePlugin(Maven3XServerEmbedder.java:1161)
 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.base/java.lang.reflect.Method.invoke(Method.java:566)
 at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
 at java.rmi/sun.rmi.transport.Transport.run(Transport.java:200)
 at java.rmi/sun.rmi.transport.Transport.run(Transport.java:197)
 at java.base/java.security.AccessController.doPrivileged(Native Method)
 at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
 at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
 at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
 at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run[=12=](TCPTransport.java:677)
 at java.base/java.security.AccessController.doPrivileged(Native Method)
 at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
 at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.RuntimeException: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.codehaus.mojo:exec-maven-plugin:jar:1.6.0
 at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:255)
 at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:171)
 at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:255)
 at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:106)
 ... 18 more
Caused by: java.lang.RuntimeException: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to transfer org.codehaus.mojo:exec-maven-plugin:pom:1.6.0 from https://nexus.xxisp.yyyyyy.net/repository/public/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.mojo:exec-maven-plugin:pom:1.6.0 from/to nexus (https://nexus.xxisp.yyyyyy.net/repository/public/): Connect to nexus.xxisp.yyyyyy.net:443 [nexus.xxisp.yyyyyy.net/81.135.143.77] failed: Operation timed out (Connection timed out)
 at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:424)
 at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:229)
 at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:207)
 at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:240)
 ... 21 more
Caused by: java.lang.RuntimeException: org.eclipse.aether.transfer.ArtifactTransferException: Failure to transfer org.codehaus.mojo:exec-maven-plugin:pom:1.6.0 from https://nexus.xxisp.yyyyyy.net/repository/public/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.mojo:exec-maven-plugin:pom:1.6.0 from/to nexus (https://nexus.xxisp.yyyyyy.net/repository/public/): Connect to nexus.xxisp.yyyyyy.net:443 [nexus.xxisp.yyyyyy.net/81.135.143.77] failed: Operation timed out (Connection timed out)
 at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:225)
 at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:193)
 at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:559)
 at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:483)
 at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:401)
 ... 24 more

有谁知道如何调试并更好地修复它?

更新: 我现在已经设法解决了这个问题。我认为问题在于,虽然在我进行升级时我已连接到互联网,但我没有连接到我公司的 VPN(因为那天我在家工作),这可能导致查找我公司的 NEXUS 回购失败。后来,当我确实连接到 VPN 时,Maven 出于某种原因无法重新同步插件。所以这个问题根本与 Intellij 升级无关。我希望这种解决这些类型错误的技术可以帮助其他人。

这个 post gist/github 帮助我解决了这两个问题。

1/Cannot resolve plugin org.codehaus.mojo:exec-maven-plugin:1.6.0

我在 .m2 目录中找到了这个插件的条目,

/Users/my-user/.m2/repository/org/codehaus/mojo/exec-maven-plugin/1.6.0

我删除了这个条目并从 Intellij 中重新同步了 Maven。这次好像觉得可以了

我用同样的方法修复了第二个错误,

2/Cannot resolve plugin org.apache.maven.plugins:maven-resources-plugin:3.1.0

此插件位于,

/Users/my-user/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/3.1.0

我也删除了这个条目,然后从 Intellij 中重新同步了另一个 Maven,这也奏效了。