如何将IronMQ添加到我的Play中! java项目?

时间:2012-07-26 03:52:14

标签: playframework ironmq

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

[NoClassDefFoundError: com/google/gson/JsonSyntaxException]

现在我坚持这个。等待支持的回答。

1 个答案:

答案 0 :(得分: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/"
    )

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