Jongo Maven依赖导致问题

时间:2013-12-30 12:48:43

标签: java mongodb maven intellij-idea jongo

我目前正在尝试使用Jongo项目连接到远程MongoDB。 为此,我将这些依赖项添加到我的项目中:

<dependencies>
    <dependency>
        <groupId>org.jongo</groupId>
        <artifactId>jongo</artifactId>
        <version>1.0</version>
    </dependency>

    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongo-java-driver</artifactId>
        <version>2.6.5</version>
    </dependency>
</dependencies>

我已经遇到了第一个依赖(jongo:1.0)的麻烦,因为maven无法检索这个版本(最新的maven知道是0.4):Intellij告诉我Dependency "org.jongo:jongo:1.0" not found。然而,可以找到依赖关系there

我设法通过Project Structure -> Librairies

获得了它

enter image description here

问题是这个依赖项现在是本地的,克隆这个项目的任何人都必须手动导入这个依赖项,这是不合适的。

我正在使用Intellij IDEA 13.0

2 个答案:

答案 0 :(得分:2)

首先,您在帖子中链接的快照存储库中的Sonatype依赖项版本为1.1-SNAPSHOT而不是1.0

建议不要在构建中使用第三方快照

如果您坚持,则需要将Sonatype快照存储库添加到您的maven构建中,如下所示:

<repository>
    <id>sonatype-snapshots</id>
    <name>sonatype-snapshots</name>
    <url>https://oss.sonatype.org/content/repositories/snapshots/</url>        
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
</repository>

修改

1.0版本位于Sonatype版本库中:

<repository>
    <id>sonatype-releases</id>
    <name>sonatype-releases</name>
    <url>https://oss.sonatype.org/content/repositories/releases/</url>
    <releases>
        <enabled>true</enabled>
    </releases>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
</repository>

答案 1 :(得分:1)

Jongo 1.0位于maven中心。您的pom中不需要额外的存储库配置。