Java 之前的注释缺少属性值的值
我通常不会遇到JUnit注释的问题。但不知怎的,今天,在我新安装的Netbeans 7.2中,当我使用Java 之前的注释缺少属性值的值,java,netbeans,junit,Java,Netbeans,Junit,我通常不会遇到JUnit注释的问题。但不知怎的,今天,在我新安装的Netbeans 7.2中,当我使用@Before注释时,我遇到了以下错误: annotation before is missing value for the attribute value 有人知道如何解决这个问题吗 更新 我正在编写一个mavenized web应用程序。 对于TestCase,当我尝试导入org.junit.Before时,程序将导入org.aspectj.lang.annotation.Before
@Before
注释时,我遇到了以下错误:
annotation before is missing value for the attribute value
有人知道如何解决这个问题吗
更新 我正在编写一个mavenized web应用程序。
对于TestCase,当我尝试导入
org.junit.Before
时,程序将导入org.aspectj.lang.annotation.Before
是否将依赖项取消为最新的junit版本
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
朱尼特
朱尼特
4.10
测试
您应该能够导入正确的类:
org.junit.Before
即使在pom.xml
中添加了junit依赖项,您仍然会收到相同的错误吗
检查是否导入了正确的库,即
import org.junit.Before;
而不是
import org.aspectj.lang.annotation.Before;
我对Maven很陌生。有没有办法告诉Maven在默认情况下获取所有依赖项的最新版本?kasavbere,尽管我强烈建议您使用具体的库版本-这样新的库更新不会破坏构建,或者更糟糕的是,在运行时引入细微的bug-有一些方法可以做到您想要的。有关更多信息,请参阅他的帖子:。最常见的错误。