postgresql 未找到 Postgres JDBC maven 依赖项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41737060/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 02:30:02  来源:igfitidea点击:

Postgres JDBC maven dependency not found

javapostgresqljdbc

提问by AHH

I wanted to include Postgres JDBC driver in my Java application, so I added it as maven dependency. I chose the last version from this list, which happened to be, to my astonishment, hosted by Atlassian. Now I am receiving this error:

我想在我的 Java 应用程序中包含 Postgres JDBC 驱动程序,所以我将它添加为 maven 依赖项。我从这个列表中选择了最后一个版本,令我惊讶的是,它由 Atlassian 托管。现在我收到此错误:

Missing artifact postgresql:postgresql:jar:9.4.1208-jdbc42-atlassian-hosted

缺少工件 postgresql:postgresql:jar:9.4.1208-jdbc42-atlassian-hosted

I also tried an older version that is not hosted by Atlassian, but got the same error! Is there another proper place to get the jar from?

我还尝试了一个不是由 Atlassian 托管的旧版本,但遇到了同样的错误!有没有其他合适的地方可以拿到罐子?

This is my current pom.xml:

这是我当前的 pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>PostgresListener</groupId>
<artifactId>PostgresListener</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>
<dependencies>
    <!-- https://mvnrepository.com/artifact/postgresql/postgresql -->
    <dependency>
        <groupId>postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>9.4.1208-jdbc42-atlassian-hosted</version>
    </dependency>
</dependencies>

回答by Rodrigo

What exactly do you have in your pom.xmlfile?

你的pom.xml档案里到底有什么?

Should be something like:

应该是这样的:

<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>9.4.1212</version>
</dependency>

Make sure you're using org.postgresqlas the groupId, instead of postgresql.

确保您使用的org.postgresqlgroupId, 而不是postgresql

回答by olammy

Should be:

应该:

<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
</dependency>

Do not put the version. Let Maven does that itself

不要放版本。让Maven自己做

回答by Goatie

Just downgrade the version of postgresql

只需降级 postgresql 的版本