2017-01-19 2 views
5

Я хотел включить драйвер JgBC Postgres в мое приложение Java, поэтому добавил его как зависимость от maven. Я выбрал последнюю версию от this list, которая, к моему удивлению, была организована Atlassian. Теперь я получаю эту ошибку:Postgres JDBC maven зависимость не найден

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

Я также попробовал старую версию, не организован Atlassian, но получил ту же ошибку! Есть ли другое подходящее место, чтобы получить банку?

Это мой текущий 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> 

+1

Попробуйте следующее: http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.postgresql%22%20AND%20a%3A%22postgresql%22 – marstran

+0

Could вы, пожалуйста, напишите свой pom или зависимость? – Dana

+0

Почему вы пытаетесь использовать зависимую от сторонних сторон, а не официальную зависимость от jQBC jQBC postgresql? –

ответ

16

Что именно вы имеете в файле 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.

+0

Это работало, но как вы его нашли? Поиск Google не заставит меня к этому! – AHH

+0

@AHH https://jdbc.postgresql.org/download.html, ссылки на Maven по ссылке http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.postgresql%22% 20and% 20a% 3A% 22postgresql% 22 –

3

Должно быть:

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

Не ставьте версию. Пусть Maven делает это сам

Смежные вопросы