.net Task<TResult>
阿新 • • 發佈:2020-12-02
此文轉載自:https://blog.csdn.net/itanping/article/details/101024299#commentBox
1. 異常現象
從 Intellij IDEA 2017.1 版本升級到當前最新版本Intellij IDEA 2019.2.2 之後,開啟原有的專案時出現異常:
14:42 Unable to import Maven project
See logs for details
Show Log in Explorer
Intellij IDEA 異常日誌:
2019-09-19 14:54:44,349 [2556395] ERROR - #org.jetbrains.idea.maven - IntelliJ IDEA 2019.2.2 Build #IU-192.6603.28 2019-09-19 14:54:44,349 [2556395] ERROR - #org.jetbrains.idea.maven - JDK: 11.0.3; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o 2019-09-19 14:54:44,349 [2556395] ERROR - #org.jetbrains.idea.maven - OS: Windows 10 2019-09-19 14:54:44,352 [2556398] ERROR - #org.jetbrains.idea.maven - Last Action: Maven.ShowSettings 2019-09-19 14:55:06,491 [2578537] ERROR - #org.jetbrains.idea.maven - com.google.inject.CreationException: Unable to create injector, see the following errors: 1) No implementation for org.apache.maven.model.path.PathTranslator was bound. while locating org.apache.maven.model.path.PathTranslator for field at org.apache.maven.model.interpolation.AbstractStringBasedModelInterpolator.pathTranslator(Unknown Source) at org.codehaus.plexus.DefaultPlexusContainer$1.configure(DefaultPlexusContainer.java:350) 2) No implementation for org.apache.maven.model.path.UrlNormalizer was bound. while locating org.apache.maven.model.path.UrlNormalizer for field at org.apache.maven.model.interpolation.AbstractStringBasedModelInterpolator.urlNormalizer(Unknown Source) at org.codehaus.plexus.DefaultPlexusContainer$1.configure(DefaultPlexusContainer.java:350) 2 errors java.lang.RuntimeException: com.google.inject.CreationException: Unable to create injector, see the following errors: 1) No implementation for org.apache.maven.model.path.PathTranslator was bound. while locating org.apache.maven.model.path.PathTranslator for field at org.apache.maven.model.interpolation.AbstractStringBasedModelInterpolator.pathTranslator(Unknown Source) at org.codehaus.plexus.DefaultPlexusContainer$1.configure(DefaultPlexusContainer.java:350) 2) No implementation for org.apache.maven.model.path.UrlNormalizer was bound. while locating org.apache.maven.model.path.UrlNormalizer for field at org.apache.maven.model.interpolation.AbstractStringBasedModelInterpolator.urlNormalizer(Unknown Source) at org.codehaus.plexus.DefaultPlexusContainer$1.configure(DefaultPlexusContainer.java:350) 2 errors at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:543) at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:159) at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106)
2. 排查分析
升級前的 Maven 版本是Apache Maven 3.5.0,升級後版本是Apache Maven 3.6.2:
1)確認 conf\settings.xml 有無問題。
2)Maven 新老版本相容有問題:
- 當前 Maven 最新版本Maven 3.6.2 有可能與最新版的 IDEA 有衝突或相容問題
- 當前 Maven 最新版本Maven 3.6.2 本身存在相容問題
3. 解決方案
下載並使用Maven 3.6.1 與Intellij IDEA 2019.2.2 搭配。重新開啟原有專案,問題解決。
Maven 庫地址:https://archive.apache.org/dist/maven/maven-3/