java - 找不到 Postgres JDBC maven 依赖项

标签 java postgresql jdbc

我想在我的 Java 应用程序中包含 Postgres JDBC 驱动程序,因此我将其添加为 Maven 依赖项。我选择了 this list 中的最后一个版本,令我惊讶的是,它恰好由 Atlassian 托管。 现在我收到此错误:

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

我还尝试了一个不是由 Atlassian 托管的旧版本,但得到了同样的错误! 是否有其他合适的地方可以从中取出 jar ?

这是我当前的 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>

最佳答案

pom.xml 文件中到底有什么?

应该是这样的:

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

确保您使用 org.postgresql 作为 groupId,而不是 postgresql

关于java - 找不到 Postgres JDBC maven 依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41737060/

相关文章:

sql - PostgreSQL upper function on the ascii 152 character ("ÿ")

Java - 将 SQL 语句存储在外部文件中

Java隐藏从数据库中检索到的空值

java - 如何将 native 数据库运算符 (postgres ~) 与 JPA 条件生成器一起使用?

java - 我们如何知道 Spring Boot 应用程序是否正在使用连接池

python - django select_for_update 和 select_related 在同一个查询上?

java - mysql连接超时后无法从apache DBCP连接池获取连接

mysql - 使用 RJDBC 在 R 中创建 JDBC 驱动程序

java - Eclipse 为可访问的代码(变体)提供死代码警告

java - BufferedReader 返回与原始文件不匹配的文件