Eclipse-无效的类路径容器:项目中的“ TestNG”和JUnit失败 [英] Eclipse - Invalid classpath container: 'TestNG' in project and JUnit failed

查看:83
本文介绍了Eclipse-无效的类路径容器:项目中的“ TestNG”和JUnit失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Eclipse 4.9,我尝试更新新的TestNG升级(7)



它失败了,所以我回滚到以前的版本,现在出现了一个问题/ p>


 '无效的类路径容器:项目
中的'TestNG'


我无法通过以下方式解决问题


  1. 清理项目(由于错误以下的NullpointerException而无法执行Maven)


  2. 重新安装TestNG


  3. 删除并添加TestNG库


我没有找到相关内容此问题的答案



错误日志:

  java.lang。 NullPointerException 
,位于org.eclipse.jem.workbench.utility.JavaModelListener.isInClasspath(JavaModelListener.java:367)
,位于org.eclipse.jem.workbench.utility.JavaModelListener.isInClasspath(JavaModelListener.java:412 )
,位于org.eclipse.jem.workbench.utility.JavaModelListener.isInClasspath(JavaModelListener.jav a:384)org.eclipse.jem.workbench.utility.JavaModelListener.isInClasspath(JavaModelListener.java:305)
org.eclipse.jem.internal.adapters.jdom.JavaReflectionSynchronizer.processJavaElementChanged( JavaReflectionSynchronizer.java:117)
,位于org.eclipse.jem.workbench.utility.JavaModelListener.processDelta(JavaModelListener.java:116)
,位于org.eclipse.jem.internal.adapters.jdom.JavaReflectionSynchronizer。 processDelta(JavaReflectionSynchronizer.java:343)
在org.eclipse.jem.workbench.utility.JavaModelListener.processChildren(JavaModelListener.java:78)
在org.eclipse.jem.internal.adapters.jdom。 JavaReflectionSynchronizer.processChildren(JavaReflectionSynchronizer.java:336)
在org.eclipse.jem.workbench.utility.JavaModelListener.processJavaElementChanged(JavaModelListener.java:176)
在org.eclipse.jem.workbench.utility。 JavaModelListener.processDelta(JavaModelListener.java:113)
在org.eclipse.jem.internal.adapters.jdom.J avaReflectionSynchronizer.processDelta(JavaReflectionSynchronizer.java:343)
在org.eclipse.jem.workbench.utility.JavaModelListener.elementChanged(JavaModelListener.java:63)
在org.eclipse.jem.internal.adapters。 jdom.JavaReflectionSynchronizer.elementChanged(JavaReflectionSynchronizer.java:265)
在org.eclipse.jdt.internal.core.DeltaProcessor $ 3.run(DeltaProcessor.java:1738)
在org.eclipse.core.runtime .SafeRunner.run(SafeRunner.java:45)
在org.eclipse.jdt.internal.core.DeltaProcessor.notifyListeners(DeltaProcessor.java:1726)
在org.eclipse.jdt.internal.core .DeltaProcessor.firePostChangeDelta(DeltaProcessor.java:1559)
在org.eclipse.jdt.internal.core.DeltaProcessor.fire(DeltaProcessor.java:1535)
在org.eclipse.jdt.internal.core .DeltaProcessor.notifyAndFire(DeltaProcessor.java:2256)
在org.eclipse.jdt.internal.core.DeltaProcessor.resourceChanged(DeltaProcessor.java:2146)
在org.eclipse.jdt.internal.core .DeltaProcessingState.resourceChanged(DeltaProcessingState.java:477)
在org.eclipse.core.internal.events.NotificationManager $ 1.run(NotificationManager.java:300)在org.eclipse.core.runtime处的
。 SafeRunner.run(SafeRunner.java:45)
在org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:290)
在org.eclipse.core.internal.events。 org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:379)
上的NotificationManager.broadcastChanges(NotificationManager.java:153)
在org.eclipse.core.internal.resources上。 org.eclipse.core.internal.events上的Workspace.endOperation(Workspace.java:1502)
.org.eclipse.core.internal.events上的AutobuildJob.doBuild(AutoBuildJob.java:160)
。 AutoBuildJob.run(AutoBuildJob.java:235)
在org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

编辑1



实际上我无法执行JUnit

  java.lang.NullPointerException 
在org.eclipse.jdt.launching.JavaRuntime.processJavaLibraryPathEntries(J
avaRuntime.java:3037)
在org.eclipse.jdt.launching.JavaRuntime.processJavaLibraryPathEntries(J
avaRuntime.java:3049)
在org.eclipse.jdt.launching.JavaRuntime .gatherJavaLibraryPathEntries(Ja
vaRuntime.java:3000)
在org.eclipse.jdt.launching.JavaRuntime.computeJavaLibraryPath(JavaRunt
ime.java:2958)
在org.eclipse .jdt.launching.AbstractJavaLaunchConfigurationDelegate.get
JavaLibraryPath(AbstractJavaLaunchConfigurationDelegate.java:1081)
在org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate.get
VMArguments(AbstractJavaLaunchConfigurationDelegatejava :. $ b在org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.colle
ctExecutionArguments(JUnitLaunchConfigurationDelegate.java:376)
在org.eclips e.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.getVM
RunnerConfiguration(JUnitLaunchConfigurationDelegate.java:185)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.launc
h(JUnitLaunchConfigurationDele。 255)
在org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConf
iguration.java:862)
在org.eclipse.debug.internal.core.LaunchConfiguration.launch (LaunchConf
iguration.java:720)
在org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlu
gin.java:1029)
在org.eclipse .debug.internal.ui.DebugUIPlugin $ 2.run(DebugUIPlugin.java:
1243)
在org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
java.lang.NullPointerException
在org.eclipse.jdt.launching.JavaRuntime.processJavaLibraryPathEntries(J
avaRuntime.java:3037)
在org.eclipse.jdt.launching.JavaRuntime.processJavaLibraryPathEntries (J
avaRuntime.java:3049)
在org.eclipse.jdt.launching.JavaRuntime.gatherJavaLibraryPathEntries(Ja
vaRuntime.java:3000)
在org.eclipse.jdt.launching.JavaRuntime .computeJavaLibraryPath(JavaRunt
ime.java:2958)
在org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate.get
JavaLibraryPath(AbstractJavaLaunchConfigurationDelegate.java:1081)
在org.eclipse .jdt.launching.AbstractJavaLaunchConfigurationDelegate.get
VMArguments(AbstractJavaLaunchConfigurationDelegate.java:598)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.colle
ctExecutionArguments(JUnitLaunchjava:376)
在org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.getVM
RunnerConfiguration(JUnitLaunchConfigurationDelegate.java:185)在org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.launc
$ bh(JUnitLaunchConfigurationDelegate.java:255)
在org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConf
iguration.java:862)
在org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConf
iguration.java:720)在org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlu
gin.java:1029)
在org.eclipse.debug。 internal.ui.DebugUIPlugin $ 2.run(DebugUIPlugin.java:
1243)
在org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

编辑2



Eclipse 4.10 不支持降级到Eclipse Neon所需的TestNG插件


TestNG仅适用于(4.9)2018-09之前的版本,您没有为2018-12插入插件,因此未显示在市场中



解决方案

I必须从 http://beust.com/eclipse/ 手动(不使用市场)TestNG版本p>

注意有关您正在安装包含未签名内容的软件的警告


I'm using Eclipse 4.9, I tried to update new TestNG upgrade(7)

It failed so I rollback to previous version and now I have an issue

'Invalid classpath container: 'TestNG' in project 

I can't fix it by

  1. clean project (maven can't be execute due to NullpointerException below errors)

  2. Reinstall TestNG

  3. Remove and add TestNG library

I didn't find relevant answers for this issue

Error log:

java.lang.NullPointerException
    at org.eclipse.jem.workbench.utility.JavaModelListener.isInClasspath(JavaModelListener.java:367)
    at org.eclipse.jem.workbench.utility.JavaModelListener.isInClasspath(JavaModelListener.java:412)
    at org.eclipse.jem.workbench.utility.JavaModelListener.isInClasspath(JavaModelListener.java:384)
    at org.eclipse.jem.workbench.utility.JavaModelListener.isInClasspath(JavaModelListener.java:305)
    at org.eclipse.jem.internal.adapters.jdom.JavaReflectionSynchronizer.processJavaElementChanged(JavaReflectionSynchronizer.java:117)
    at org.eclipse.jem.workbench.utility.JavaModelListener.processDelta(JavaModelListener.java:116)
    at org.eclipse.jem.internal.adapters.jdom.JavaReflectionSynchronizer.processDelta(JavaReflectionSynchronizer.java:343)
    at org.eclipse.jem.workbench.utility.JavaModelListener.processChildren(JavaModelListener.java:78)
    at org.eclipse.jem.internal.adapters.jdom.JavaReflectionSynchronizer.processChildren(JavaReflectionSynchronizer.java:336)
    at org.eclipse.jem.workbench.utility.JavaModelListener.processJavaElementChanged(JavaModelListener.java:176)
    at org.eclipse.jem.workbench.utility.JavaModelListener.processDelta(JavaModelListener.java:113)
    at org.eclipse.jem.internal.adapters.jdom.JavaReflectionSynchronizer.processDelta(JavaReflectionSynchronizer.java:343)
    at org.eclipse.jem.workbench.utility.JavaModelListener.elementChanged(JavaModelListener.java:63)
    at org.eclipse.jem.internal.adapters.jdom.JavaReflectionSynchronizer.elementChanged(JavaReflectionSynchronizer.java:265)
    at org.eclipse.jdt.internal.core.DeltaProcessor$3.run(DeltaProcessor.java:1738)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.jdt.internal.core.DeltaProcessor.notifyListeners(DeltaProcessor.java:1726)
    at org.eclipse.jdt.internal.core.DeltaProcessor.firePostChangeDelta(DeltaProcessor.java:1559)
    at org.eclipse.jdt.internal.core.DeltaProcessor.fire(DeltaProcessor.java:1535)
    at org.eclipse.jdt.internal.core.DeltaProcessor.notifyAndFire(DeltaProcessor.java:2256)
    at org.eclipse.jdt.internal.core.DeltaProcessor.resourceChanged(DeltaProcessor.java:2146)
    at org.eclipse.jdt.internal.core.DeltaProcessingState.resourceChanged(DeltaProcessingState.java:477)
    at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:300)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:290)
    at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:153)
    at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:379)
    at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1502)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:160)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

EDIT 1

Actually I failed to execute JUnit also

java.lang.NullPointerException
        at org.eclipse.jdt.launching.JavaRuntime.processJavaLibraryPathEntries(J
avaRuntime.java:3037)
        at org.eclipse.jdt.launching.JavaRuntime.processJavaLibraryPathEntries(J
avaRuntime.java:3049)
        at org.eclipse.jdt.launching.JavaRuntime.gatherJavaLibraryPathEntries(Ja
vaRuntime.java:3000)
        at org.eclipse.jdt.launching.JavaRuntime.computeJavaLibraryPath(JavaRunt
ime.java:2958)
        at org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate.get
JavaLibraryPath(AbstractJavaLaunchConfigurationDelegate.java:1081)
        at org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate.get
VMArguments(AbstractJavaLaunchConfigurationDelegate.java:598)
        at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.colle
ctExecutionArguments(JUnitLaunchConfigurationDelegate.java:376)
        at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.getVM
RunnerConfiguration(JUnitLaunchConfigurationDelegate.java:185)
        at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.launc
h(JUnitLaunchConfigurationDelegate.java:255)
        at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConf
iguration.java:862)
        at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConf
iguration.java:720)
        at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlu
gin.java:1029)
        at org.eclipse.debug.internal.ui.DebugUIPlugin$2.run(DebugUIPlugin.java:
1243)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
java.lang.NullPointerException
        at org.eclipse.jdt.launching.JavaRuntime.processJavaLibraryPathEntries(J
avaRuntime.java:3037)
        at org.eclipse.jdt.launching.JavaRuntime.processJavaLibraryPathEntries(J
avaRuntime.java:3049)
        at org.eclipse.jdt.launching.JavaRuntime.gatherJavaLibraryPathEntries(Ja
vaRuntime.java:3000)
        at org.eclipse.jdt.launching.JavaRuntime.computeJavaLibraryPath(JavaRunt
ime.java:2958)
        at org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate.get
JavaLibraryPath(AbstractJavaLaunchConfigurationDelegate.java:1081)
        at org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate.get
VMArguments(AbstractJavaLaunchConfigurationDelegate.java:598)
        at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.colle
ctExecutionArguments(JUnitLaunchConfigurationDelegate.java:376)
        at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.getVM
RunnerConfiguration(JUnitLaunchConfigurationDelegate.java:185)
        at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.launc
h(JUnitLaunchConfigurationDelegate.java:255)
        at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConf
iguration.java:862)
        at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConf
iguration.java:720)
        at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlu
gin.java:1029)
        at org.eclipse.debug.internal.ui.DebugUIPlugin$2.run(DebugUIPlugin.java:
1243)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

EDIT 2

Eclipse 4.10 doesn't support TestNG plugin to needed to downgrade to Eclipse Neon

TestNG is only available only for version till (4.9)2018-09 , you hv not made plug in for 2018-12.that's why it is not showing in marketplace

解决方案

I had to manually (not using marketplace) TestNG version from http://beust.com/eclipse/

Notice there's warning about You are installing software that contains unsigned content

这篇关于Eclipse-无效的类路径容器:项目中的“ TestNG”和JUnit失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆