我在哪里可以找到 Maven 存储库中的 PostGresql 9.2 JDBC 4 驱动程序?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13843594/
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
Where can I find the PostGresql 9.2 JDBC 4 drivers in a maven repo?
提问by benstpierre
Looking at the maven central repository the newest jdbc4 driver available for PostGresql is only the 9.1 driver
查看 maven 中央存储库,可用于 PostGresql 的最新 jdbc4 驱动程序只是 9.1 驱动程序
http://mvnrepository.com/artifact/postgresql/postgresql/9.1-901.jdbc4
http://mvnrepository.com/artifact/postgresql/postgresql/9.1-901.jdbc4
There is a newer file called "postgresql-9.2-1002.jdbc4.jar" available on http://jdbc.postgresql.org/download.htmlbut it has not been released to Maven central.
http://jdbc.postgresql.org/download.html上有一个名为“postgresql-9.2-1002.jdbc4.jar”的较新文件,但尚未发布到 Maven 中心。
回答by maba
It seems like PostgreSQL has updated their groupId
to org.postgresql
instead of postgresql
.
这似乎是PostgreSQL有更新了他们groupId
对org.postgresql
代替postgresql
。
So now it is possible to use maven directly (mvnrepository.com):
所以现在可以直接使用 maven ( mvnrepository.com):
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.2-1002-jdbc4</version>
</dependency>
回答by user2083084
Following dependency description works for me:
以下依赖项描述对我有用:
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.2-1002-jdbc4</version>
</dependency>
回答by Craig Ringer
(This answer is now outdated; the jars have been released to maven under the groupid org.postgresql
. See more recent answers for details.)
(此答案现已过时;jar 已在 groupid 下发布到 maven org.postgresql
。有关详细信息,请参阅最近的答案。)
You can simply install the driver to your local ~/.m2
repository. See the maven documentationand this question.
您只需将驱动程序安装到本地~/.m2
存储库即可。请参阅Maven 文档和此问题。
mvn install:install-file \
-DgroupId=postgresql \
-DartifactId=postgresql \
-Dpackaging=jar \
-Dversion=9.2-1002.jdbc4 \
-Dfile=postgresql-9.2-1002.jdbc4.jar \
-DgeneratePom=true
Alternately, if you're using Sonatype Nexusto manage repositories and caching - which I highly recommend - then you can add the jar to a locally maintained repository in your Nexus instance.
或者,如果您使用Sonatype Nexus来管理存储库和缓存(我强烈推荐),那么您可以将 jar 添加到 Nexus 实例中本地维护的存储库。
回答by user815114
You may use TypeSafe repository, it contains 9.2 driver. Use:
您可以使用 TypeSafe 存储库,它包含 9.2 驱动程序。用:
<repository>
<id>typesafe</id>
<url>http://repo.typesafe.com/typesafe/repo/</url>
</repository>
I hope that 9.2 driver will be on central repository soon, check https://github.com/pgjdbc/pgjdbc/issues/46for progress.
我希望 9.2 驱动程序很快就会出现在中央存储库中,检查https://github.com/pgjdbc/pgjdbc/issues/46以获取进展。
回答by Adam Gent
I added the 9.2-1002 driver to my own crappy Maven repository that is hosted by Google Code (github wasn't popular a long time ago when I made it).
我将 9.2-1002 驱动程序添加到我自己由 Google Code 托管的蹩脚 Maven 存储库中(很久以前我创建它时 github 并不流行)。
<repository>
<id>mvn-adamgent</id>
<url>http://mvn-adamgent.googlecode.com/svn/maven/release</url>
<name>Adam Gent Maven Repository</name>
</repository>
I tried to go and fix the postgres build to build me a JDBC3 driver but I think you have to install an older JDK to get that working so I just grabbed the jars from: http://jdbc.postgresql.org/download.html
我试图去修复 postgres 构建来为我构建一个 JDBC3 驱动程序,但我认为你必须安装一个旧的 JDK 才能让它工作,所以我只是从以下位置获取了 jars:http: //jdbc.postgresql.org/download.html
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.2-1002.jdbc4</version>
</dependency>
I also included a source jar (so Maven will auto download the source for you) but I did not make Javadoc or JDBC3 jar.
我还包含了一个源 jar(因此 Maven 会自动为您下载源),但我没有制作 Javadoc 或 JDBC3 jar。
If I only knew how to make the JDBC3 jar correctly I could make the changes to their build file (@Craig Ringer) on my github fork.
如果我只知道如何正确制作 JDBC3 jar,我可以在我的 github fork上对他们的构建文件(@Craig Ringer)进行更改。