4

我在 java 中遇到 IronMQ 问题。找不到如何从 maven 获取它。所以将jar下载到我的lib文件夹中。然后不断收到运行时错误。

[NoClassDefFoundError: com/google/gson/JsonSyntaxException]

现在我坚持这一点。等待支持的答复。

4

1 回答 1

3

这个答案来自他们的支持。

您使用这些 Maven 设置并将它们添加到您的 build.scala 文件中。

它使用 gson,所以你也需要它。

<repositories>
<repository>
<id>iron-io-repo</id>
<name>Iron.io Maven repository on GitHub</name>
<url>http://iron-io.github.com/maven/repository/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ironmq</groupId>
<artifactId>ironmq</artifactId>
<version>0.0.8</version>
<scope>compile</scope>
</dependency>
</dependencies> 

这是我的 build.scala :

val appDependencies = Seq(
            // Add your project dependencies here,
            "com.google.code.morphia" % "morphia" % "0.99",
            "org.mongodb" % "mongo-java-driver" % "2.7.3",
            "com.google.code.morphia" % "morphia-logging-slf4j" % "0.99",
            "com.github.mumoshu" %% "play2-memcached" % "0.2.1-SNAPSHOT",
            "com.rabbitmq" % "amqp-client" % "2.8.4",
            "com.google.code.gson" % "gson" % "2.1",
            "ironmq" % "ironmq" % "0.0.8"
    )

    val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
            // Add your own project settings here
            resolvers += "Maven repository" at "http://morphia.googlecode.com/svn/mavenrepo/",
            resolvers += "MongoDb Java Driver Repository" at "http://repo1.maven.org/maven2/org/mongodb/mongo-java-driver/",
            resolvers += "Spy Repository" at "http://files.couchbase.com/maven2",
            resolvers += "Iron.io Maven repository on GitHub" at "http://iron-io.github.com/maven/repository/"
    )

当然,在那之后运行重新加载和更新。它应该成功运行。

于 2012-07-26T03:52:14.303 回答