简体   繁体   English

缺少依赖项'class javax.annotation.Nullable'

[英]Missing dependency 'class javax.annotation.Nullable'

I was trying to use the jira-rest-java-client provided by Atlassian in a Scala program I am developing. 我正在尝试在我正在开发的Scala程序中使用Atlassian提供的jira-rest-java-client。 I am using Eclipse as my IDE. 我使用Eclipse作为我的IDE。

When I have an object of type Issue and I try to look at the properties I see there are far fewer properties than are declared in the Java code. 当我有一个类型为Issue的对象时,我试着查看我看到的属性,它们的属性远远少于Java代码中声明的属性。

I thought perhaps this was just Eclipse not finding all properties/methods of an object so I tried putting Issue.getSummary() and doing an sbt compile. 我想也许这只是Eclipse没有找到对象的所有属性/方法所以我尝试放置Issue.getSummary()并进行sbt编译。 The compile showed me this error: 编译向我显示了这个错误:

Missing dependency 'class javax.annotation.Nullable' 缺少依赖项'class javax.annotation.Nullable'

Any ideas? 有任何想法吗?

I found the answer in this issue on googlecode: http://code.google.com/p/guava-libraries/issues/detail?id=1095 . 我在googlecode上找到了这个问题的答案: http//code.google.com/p/guava-libraries/issues/detail ?id = 1095 To correct the problem in sbt you need to add this dependency: 要纠正sbt中的问题,您需要添加此依赖项:

"com.google.code.findbugs" % "jsr305" % "1.3.+"

The Scala compiler requires all annotation classes in the classpath. Scala编译器需要类路径中的所有注释类。 As this class is not available in the classpath, the compilation fails. 由于此类在类路径中不可用,因此编译失败。 In my particular case, the class is not used by the application. 在我的特定情况下,应用程序不使用该类。 Hence, it is sufficient to disable the fatal-warnings option in the build. 因此,在构建中禁用fatal-warnings选项就足够了。

In my built.sbt I had the following line: 在我的built.sbt我有以下几行:

scalacOptions ++= Seq("-Yno-adapted-args", "-Ywarn-dead-code", "-Ywarn-numeric-widen", "-Ywarn-value-discard", "-Xfatal-warnings")

I removed the "-Xfatal-warnings" and compilation was successful. 我删除了"-Xfatal-warnings"并且编译成功。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何导入javax.annotation.Nullable? - How to import javax.annotation.Nullable? FindBug无法从javax.annotation.Nullable方法检测到null - FindBug does not detect null from javax.annotation.Nullable method NfcAdapter不可为空,但由@Provides @Singleton @ javax.annotation.Nullable android.nfc.NfcAdapter提供 - NfcAdapter is not nullable, but is being provided by @Provides @Singleton @javax.annotation.Nullable android.nfc.NfcAdapter 尝试使用javax.annotation.Nullable时无法编译GWT模块? - Unable to compile the GWT module while trying to use javax.annotation.Nullable? javax.annotation:@Nullable vs @CheckForNull - javax.annotation: @Nullable vs @CheckForNull 在 javax.annotation.* 中找不到 @Nullable - Can't find @Nullable inside javax.annotation.* 缺少依赖项model.jar(model / error / Error.class)所需的依赖项'class javax.jdo.spi.PersistenceCapable $ ObjectIdFieldSupplier' - Missing dependency 'class javax.jdo.spi.PersistenceCapable$ObjectIdFieldSupplier', required by model.jar(model/error/Error.class) Minio Gradle依赖关系android javax.annotation.CheckReturnValue - Minio Gradle dependency android javax.annotation.CheckReturnValue .class文件中缺少@Autowired批注 - @Autowired annotation missing in .class file 使用AspectJ进行编译时缺少javax.cache.annotation包 - Missing javax.cache.annotation package when compiling with AspectJ
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM