idea 不能创建类啥原因 unable to parse template class
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了idea 不能创建类啥原因 unable to parse template class相关的知识,希望对你有一定的参考价值。
这是报错:
修复方法:
见下图,在class右侧配置中添加:
#if ($PACKAGE_NAME && $PACKAGE_NAME != "")package $PACKAGE_NAME;#end
#parse("File Header.java")
public class $NAME 即可。
参考技术A 程序内的jar包,里面有个文件BuidConfig和IDEA自动生成的/gen 下的BuildConfig文件同名了,导致这个错误。所以保证自己的文件没有和IDEA同名的才行。
Unable to import maven project: See logs for details :导致原因就是环境变量配置的maven版本与idea中的maven版本不一致导致的
百度很多都不对,后来受了启发:https://blog.csdn.net/ashleyjun/article/details/101106810想起来去看看环境变量了
导致原因就是环境变量配置的maven版本与idea中的maven版本不一致导致的
2019-11-05 20:19:41,358 [1307037] 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.interpolat
Monica:
2019/11/3
0:37 Unable to import maven project: See logs for details
0:43 Unable to import maven project: See logs for details
0:44 Unable to import maven project: See logs for details
0:44 Unable to import maven project: See logs for details
0:48 Unable to import maven project: See logs for details
ion.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)
at com.google.inject.Guice.createInjector(Guice.java:87)
at com.google.inject.Guice.createInjector(Guice.java:69)
at com.google.inject.Guice.createInjector(Guice.java:59)
at org.codehaus.plexus.DefaultPlexusContainer.addComponent(DefaultPlexusContainer.java:344)
at org.codehaus.plexus.DefaultPlexusContainer.addComponent(DefaultPlexusContainer.java:332)
at org.jetbrains.idea.maven.server.Maven3ServerEmbedderImpl.customizeComponents(Maven3ServerEmbedderImpl.java:561)
at org.jetbrains.idea.maven.server.Maven3ServerEmbedderImpl.customize(Maven3ServerEmbedderImpl.java:532)
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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
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)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:276)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:253)
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.$Proxy136.customize(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.$Proxy136.customize(Unknown Source)
at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.doCustomize(MavenEmbedderWrapper.java:108)
at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.access$000(MavenEmbedderWrapper.java:38)
at org.jetbrains.idea.maven.server.MavenEmbedderWrapper$2.execute(MavenEmbedderWrapper.java:74)
at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:76)
at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.customizeForResolve(MavenEmbedderWrapper.java:71)
at org.jetbrains.idea.maven.project.MavenProjectsTree.resolve(MavenProjectsTree.java:1253)
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:460)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:315)
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)
2019-11-05 20:19:41,358 [1307037] ERROR - #org.jetbrains.idea.maven - IntelliJ IDEA 2017.3.3 Build #IU-173.4301.25
2019-11-05 20:19:41,358 [1307037] ERROR - #org.jetbrains.idea.maven - JDK: 1.8.0_152-release
2019-11-05 20:19:41,358 [1307037] ERROR - #org.jetbrains.idea.maven - VM: OpenJDK Server VM
2019-11-05 20:19:41,358 [1307037] ERROR - #org.jetbrains.idea.maven - Vendor: JetBrains s.r.o
2019-11-05 20:19:41,358 [1307037] ERROR - #org.jetbrains.idea.maven - OS: Windows 7
2019-11-05 20:19:41,358 [1307037] ERROR - #org.jetbrains.idea.maven - Last Action: Maven.Reimport
2019-11-05 20:22:24,657 [1470336] INFO - ution.rmi.RemoteProcessSupport - Terminating: 16988/Maven3ServerImpla584d07a
2019-11-05 20:25:08,607 [1634286] INFO - ution.rmi.RemoteProcessSupport - Terminating: 29369/Maven3ServerImpl7c41c516
2019-11-05 20:25:25,339 [1651018] INFO - ellij.vfs.persistent.FSRecords - Creating VFS corruption marker; Trace=
java.lang.Exception
at com.intellij.openapi.vfs.newvfs.persistent.FSRecords$DbConnection.b(FSRecords.java:217)
at com.intellij.openapi.vfs.newvfs.persistent.FSRecords$DbConnection.access$3900(FSRecords.java:160)
at com.intellij.openapi.vfs.newvfs.persistent.FSRecords.invalidateCaches(FSRecords.java:1968)
at com.intellij.ide.actions.InvalidateCachesAction.actionPerformed(InvalidateCachesAction.java:94)
at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:220)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:237)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.a(ActionMenuItem.java:321)
at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:911)
at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:136)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:311)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.a(ActionMenuItem.java:130)
at com.intellij.openapi.application.TransactionGuardImpl.a(TransactionGuardImpl.java:88)
at com.intellij.openapi.application.TransactionGuardImpl.a(TransactionGuardImpl.java:111)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:120)
at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:122)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:130)
at com.intellij.ui.plaf.beg.BegMenuItemUI.a(BegMenuItemUI.java:521)
at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:48)
at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:541)
at java.awt.Component.processMouseEvent(Component.java:6541)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6306)
at java.awt.Container.processEvent(Container.java:2237)
at java.awt.Component.dispatchEventImpl(Component.java:4897)
at java.awt.Container.dispatchEventImpl(Container.java:2295)
at java.awt.Component.dispatchEvent(Component.java:4719)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4526)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
at java.awt.Container.dispatchEventImpl(Container.java:2281)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4719)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:737)
at java.awt.EventQueue$4.run(EventQueue.java:735)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
at com.intellij.ide.IdeEventQueue.k(IdeEventQueue.java:822)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:646)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:366)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
2019-11-05 20:25:41,677 [1667356] INFO - pl.ProjectRootManagerComponent - project roots have changed
2019-11-05 20:25:42,271 [1667950] INFO - pl.ProjectRootManagerComponent - project roots have changed
2019-11-05 20:25:42,464 [1668143] INFO - indexing.UnindexedFilesUpdater - Unindexed files update canceled
2019-11-05 20:25:42,741 [1668420] INFO - g.FileBasedIndexProjectHandler - Reindexing refreshed files: 10 to update, calculated in 0ms
2019-11-05 20:25:42,904 [1668583] INFO - .diagnostic.PerformanceWatcher - Reindexing refreshed files took 160ms; general responsiveness: ok; EDT responsiveness: ok
2019-11-05 20:25:42,908 [1668587] INFO - .diagnostic.PerformanceWatcher - Pushing properties took 3ms; general responsiveness: ok; EDT responsiveness: ok
2019-11-05 20:25:43,906 [1669585] INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 997ms; general responsiveness: 1/1 sluggish; EDT responsiveness: ok
2019-11-05 20:28:33,984 [1839663] INFO - g.FileBasedIndexProjectHandler - Reindexing refreshed files: 0 to update, calculated in 100ms
2019-11-05 20:28:53,962 [1859641] INFO - pl.ProjectRootManagerComponent - project roots have changed
2019-11-05 20:28:55,279 [1860958] INFO - .diagnostic.PerformanceWatcher - Pushing properties took 2ms; general responsiveness: ok; EDT responsiveness: ok
2019-11-05 20:28:55,413 [1861092] INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 134ms; general responsiveness: ok; EDT responsiveness: ok
以上是关于idea 不能创建类啥原因 unable to parse template class的主要内容,如果未能解决你的问题,请参考以下文章
tomcat报错-----》Unable to open debugger port IDEA Unable to open debugger port
创建maven项目时,IntelliJ IDEA2019出现:Unable to import maven project: See logs for details 报错
Unable to import maven project: See logs for details :导致原因就是环境变量配置的maven版本与idea中的maven版本不一致导致的
IDEA maven-3.6.2 Unable to import maven project错误
IDEA reimport时报错Unable to import maven project: See logs for details