Permalink
Browse files

chore: use java comment preprocessor to build jre6/jre7/jre8 jars fro…

…m the same sources

This enables having a single source file and simple `implements Connection`.
The existing `42Connection extends 41Connection extends ...` is simplified to `PgConnection implements java.sql.Connection`

closes #435
  • Loading branch information...
vlsi committed Dec 7, 2015
1 parent f95b44e commit 42c2e3b7953b2e68281c4ec269bd9749e135065b
Showing with 4,942 additions and 8,245 deletions.
  1. +11 −2 .gitignore
  2. +62 −29 .travis.yml
  3. +154 −16 README.md
  4. +10 −15 build.properties
  5. +52 −0 pgjdbc/pom.xml
  6. +18 −10 pgjdbc/src/main/java/org/postgresql/Driver.java
  7. +1 −1 pgjdbc/src/main/java/org/postgresql/core/BaseConnection.java
  8. +0 −28 pgjdbc/src/main/java/org/postgresql/core/BaseResultSet.java
  9. +1 −1 pgjdbc/src/main/java/org/postgresql/core/CachedQuery.java
  10. +83 −3 pgjdbc/src/main/java/org/postgresql/ds/PGConnectionPoolDataSource.java
  11. +449 −9 pgjdbc/src/main/java/org/postgresql/ds/PGPooledConnection.java
  12. +503 −3 pgjdbc/src/main/java/org/postgresql/ds/PGPoolingDataSource.java
  13. +46 −3 pgjdbc/src/main/java/org/postgresql/ds/PGSimpleDataSource.java
  14. +1 −0 pgjdbc/src/main/java/org/postgresql/ds/common/PGObjectFactory.java
  15. +0 −105 pgjdbc/src/main/java/org/postgresql/ds/jdbc23/AbstractJdbc23ConnectionPoolDataSource.java
  16. +0 −462 pgjdbc/src/main/java/org/postgresql/ds/jdbc23/AbstractJdbc23PooledConnection.java
  17. +0 −516 pgjdbc/src/main/java/org/postgresql/ds/jdbc23/AbstractJdbc23PoolingDataSource.java
  18. +0 −44 pgjdbc/src/main/java/org/postgresql/ds/jdbc23/AbstractJdbc23SimpleDataSource.java
  19. +0 −17 pgjdbc/src/main/java/org/postgresql/ds/jdbc4/AbstractJdbc4ConnectionPoolDataSource.java
  20. +0 −37 pgjdbc/src/main/java/org/postgresql/ds/jdbc4/AbstractJdbc4PooledConnection.java
  21. +0 −37 pgjdbc/src/main/java/org/postgresql/ds/jdbc4/AbstractJdbc4PoolingDataSource.java
  22. +0 −36 pgjdbc/src/main/java/org/postgresql/ds/jdbc4/AbstractJdbc4SimpleDataSource.java
  23. +19 −8 pgjdbc/src/main/java/org/postgresql/{jdbc2/AbstractJdbc2BlobClob.java → jdbc/AbstractBlobClob.java}
  24. +2 −1 pgjdbc/src/main/java/org/postgresql/{jdbc2 → jdbc}/CacheMetadata.java
  25. +4 −4 pgjdbc/src/main/java/org/postgresql/{jdbc2 → jdbc}/CachedQueryCreateAction.java
  26. +1 −1 pgjdbc/src/main/java/org/postgresql/{jdbc2 → jdbc}/CallableQueryKey.java
  27. +297 −123 pgjdbc/src/main/java/org/postgresql/{jdbc2 → jdbc}/EscapedFunctions.java
  28. +1 −1 pgjdbc/src/main/java/org/postgresql/{jdbc3 → jdbc}/PSQLSavepoint.java
  29. +47 −17 pgjdbc/src/main/java/org/postgresql/{jdbc2/AbstractJdbc2Array.java → jdbc/PgArray.java}
  30. +78 −0 pgjdbc/src/main/java/org/postgresql/jdbc/PgBlob.java
  31. +3 −3 ...rc/main/java/org/postgresql/{jdbc42/Jdbc42CallableStatement.java → jdbc/PgCallableStatement.java}
  32. +135 −0 pgjdbc/src/main/java/org/postgresql/jdbc/PgClob.java
  33. +681 −55 pgjdbc/src/main/java/org/postgresql/{jdbc2/AbstractJdbc2Connection.java → jdbc/PgConnection.java}
  34. +179 −17 ...ain/java/org/postgresql/{jdbc2/AbstractJdbc2DatabaseMetaData.java → jdbc/PgDatabaseMetaData.java}
  35. +15 −5 ...n/java/org/postgresql/{jdbc3/AbstractJdbc3ParameterMetaData.java → jdbc/PgParameterMetaData.java}
  36. +24 −0 pgjdbc/src/main/java/org/postgresql/jdbc/PgPreparedStatement.java
  37. +425 −42 pgjdbc/src/main/java/org/postgresql/{jdbc2/AbstractJdbc2ResultSet.java → jdbc/PgResultSet.java}
  38. +15 −5 ...n/java/org/postgresql/{jdbc2/AbstractJdbc2ResultSetMetaData.java → jdbc/PgResultSetMetaData.java}
  39. +13 −5 pgjdbc/src/main/java/org/postgresql/{jdbc4/AbstractJdbc4SQLXML.java → jdbc/PgSQLXML.java}
  40. +1,046 −40 pgjdbc/src/main/java/org/postgresql/{jdbc2/AbstractJdbc2Statement.java → jdbc/PgStatement.java}
  41. +2 −2 pgjdbc/src/main/java/org/postgresql/{jdbc2 → jdbc}/ResultWrapper.java
  42. +8 −5 pgjdbc/src/main/java/org/postgresql/{jdbc2 → jdbc}/TimestampUtils.java
  43. +4 −1 pgjdbc/src/main/java/org/postgresql/{jdbc2 → jdbc}/TypeInfoCache.java
  44. +1 −1 pgjdbc/src/main/java/org/postgresql/{jdbc4/array → jdbc}/UUIDArrayAssistant.java
  45. +0 −22 pgjdbc/src/main/java/org/postgresql/jdbc2/AbstractJdbc2Blob.java
  46. +0 −64 pgjdbc/src/main/java/org/postgresql/jdbc2/AbstractJdbc2Clob.java
  47. +0 −70 pgjdbc/src/main/java/org/postgresql/jdbc3/AbstractJdbc3Blob.java
  48. +0 −106 pgjdbc/src/main/java/org/postgresql/jdbc3/AbstractJdbc3Clob.java
  49. +0 −483 pgjdbc/src/main/java/org/postgresql/jdbc3/AbstractJdbc3Connection.java
  50. +0 −385 pgjdbc/src/main/java/org/postgresql/jdbc3/AbstractJdbc3DatabaseMetaData.java
  51. +0 −211 pgjdbc/src/main/java/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java
  52. +0 −1,528 pgjdbc/src/main/java/org/postgresql/jdbc3/AbstractJdbc3Statement.java
  53. +4 −6 .../src/main/java/org/postgresql/{jdbc4/Jdbc4DatabaseMetaData.java → jdbc3/Jdbc3ConnectionPool.java}
  54. +14 −0 pgjdbc/src/main/java/org/postgresql/jdbc3/Jdbc3PoolingDataSource.java
  55. +14 −0 pgjdbc/src/main/java/org/postgresql/jdbc3/Jdbc3SimpleDataSource.java
  56. +0 −29 pgjdbc/src/main/java/org/postgresql/jdbc3g/AbstractJdbc3gConnection.java
  57. +0 −46 pgjdbc/src/main/java/org/postgresql/jdbc3g/AbstractJdbc3gResultSet.java
  58. +0 −62 pgjdbc/src/main/java/org/postgresql/jdbc3g/AbstractJdbc3gStatement.java
  59. +0 −40 pgjdbc/src/main/java/org/postgresql/jdbc4/AbstractJdbc4Array.java
  60. +0 −38 pgjdbc/src/main/java/org/postgresql/jdbc4/AbstractJdbc4Blob.java
  61. +0 −26 pgjdbc/src/main/java/org/postgresql/jdbc4/AbstractJdbc4Clob.java
  62. +0 −357 pgjdbc/src/main/java/org/postgresql/jdbc4/AbstractJdbc4Connection.java
  63. +0 −123 pgjdbc/src/main/java/org/postgresql/jdbc4/AbstractJdbc4DatabaseMetaData.java
  64. +0 −34 pgjdbc/src/main/java/org/postgresql/jdbc4/AbstractJdbc4ParameterMetaData.java
  65. +0 −324 pgjdbc/src/main/java/org/postgresql/jdbc4/AbstractJdbc4ResultSet.java
  66. +0 −35 pgjdbc/src/main/java/org/postgresql/jdbc4/AbstractJdbc4ResultSetMetaData.java
  67. +0 −456 pgjdbc/src/main/java/org/postgresql/jdbc4/AbstractJdbc4Statement.java
  68. +0 −48 pgjdbc/src/main/java/org/postgresql/jdbc4/Jdbc4Array.java
  69. +0 −20 pgjdbc/src/main/java/org/postgresql/jdbc4/Jdbc4Blob.java
  70. +0 −38 pgjdbc/src/main/java/org/postgresql/jdbc4/Jdbc4CallableStatement.java
  71. +0 −18 pgjdbc/src/main/java/org/postgresql/jdbc4/Jdbc4Clob.java
  72. +0 −85 pgjdbc/src/main/java/org/postgresql/jdbc4/Jdbc4Connection.java
  73. +0 −19 pgjdbc/src/main/java/org/postgresql/jdbc4/Jdbc4ParameterMetaData.java
  74. +0 −23 pgjdbc/src/main/java/org/postgresql/jdbc4/Jdbc4PreparedStatement.java
  75. +0 −63 pgjdbc/src/main/java/org/postgresql/jdbc4/Jdbc4ResultSet.java
  76. +0 −19 pgjdbc/src/main/java/org/postgresql/jdbc4/Jdbc4ResultSetMetaData.java
  77. +0 −27 pgjdbc/src/main/java/org/postgresql/jdbc4/Jdbc4SQLXML.java
  78. +0 −46 pgjdbc/src/main/java/org/postgresql/jdbc4/Jdbc4Statement.java
  79. +0 −24 pgjdbc/src/main/java/org/postgresql/jdbc42/AbstractJdbc42Connection.java
  80. +0 −31 pgjdbc/src/main/java/org/postgresql/jdbc42/AbstractJdbc42DatabaseMetaData.java
  81. +0 −48 pgjdbc/src/main/java/org/postgresql/jdbc42/AbstractJdbc42ResultSet.java
  82. +0 −126 pgjdbc/src/main/java/org/postgresql/jdbc42/AbstractJdbc42Statement.java
  83. +0 −49 pgjdbc/src/main/java/org/postgresql/jdbc42/Jdbc42Array.java
  84. +0 −22 pgjdbc/src/main/java/org/postgresql/jdbc42/Jdbc42Blob.java
  85. +0 −20 pgjdbc/src/main/java/org/postgresql/jdbc42/Jdbc42Clob.java
  86. +0 −83 pgjdbc/src/main/java/org/postgresql/jdbc42/Jdbc42Connection.java
  87. +0 −20 pgjdbc/src/main/java/org/postgresql/jdbc42/Jdbc42DatabaseMetaData.java
  88. +0 −23 pgjdbc/src/main/java/org/postgresql/jdbc42/Jdbc42ParameterMetaData.java
  89. +0 −23 pgjdbc/src/main/java/org/postgresql/jdbc42/Jdbc42PreparedStatement.java
  90. +0 −64 pgjdbc/src/main/java/org/postgresql/jdbc42/Jdbc42ResultSet.java
  91. +0 −24 pgjdbc/src/main/java/org/postgresql/jdbc42/Jdbc42ResultSetMetaData.java
  92. +0 −28 pgjdbc/src/main/java/org/postgresql/jdbc42/Jdbc42SQLXML.java
  93. +0 −56 pgjdbc/src/main/java/org/postgresql/jdbc42/Jdbc42Statement.java
  94. +145 −4 pgjdbc/src/main/java/org/postgresql/ssl/MakeSSL.java
  95. +0 −158 pgjdbc/src/main/java/org/postgresql/ssl/jdbc4/AbstractJdbc4MakeSSL.java
  96. +0 −2 pgjdbc/src/main/java/org/postgresql/util/PSQLDriverVersion.java
  97. +67 −3 pgjdbc/src/main/java/org/postgresql/xa/PGXADataSource.java
  98. +0 −71 pgjdbc/src/main/java/org/postgresql/xa/jdbc3/AbstractJdbc3XADataSource.java
  99. +0 −21 pgjdbc/src/main/java/org/postgresql/xa/jdbc4/AbstractJdbc4XADataSource.java
  100. +84 −26 pgjdbc/src/test/java/org/postgresql/test/TestUtil.java
  101. +1 −1 ...bc/src/test/java/org/postgresql/test/extensions/{ExtensionsSuite.java → ExtensionsTestSuite.java}
  102. +1 −1 pgjdbc/src/test/java/org/postgresql/test/hostchooser/{MultiHostSuite.java → MultiHostTestSuite.java}
  103. +2 −2 pgjdbc/src/test/java/org/postgresql/test/hostchooser/MultiHostsConnectionTest.java
  104. +9 −9 pgjdbc/src/test/java/org/postgresql/test/jdbc2/BlobTest.java
  105. +2 −1 pgjdbc/src/test/java/org/postgresql/test/jdbc2/ConnectionTest.java
  106. +0 −1 pgjdbc/src/test/java/org/postgresql/test/jdbc2/ServerPreparedStmtTest.java
  107. +2 −2 pgjdbc/src/test/java/org/postgresql/test/jdbc2/StatementTest.java
  108. +4 −5 pgjdbc/src/test/java/org/postgresql/test/jdbc2/TestACL.java
  109. +1 −1 pgjdbc/src/test/java/org/postgresql/test/jdbc2/TimestampTest.java
  110. +1 −1 pgjdbc/src/test/java/org/postgresql/test/jdbc2/optional/PoolingDataSourceTest.java
  111. +0 −1 pgjdbc/src/test/java/org/postgresql/test/jdbc3/SendRecvBufferSizeTest.java
  112. +2 −2 pgjdbc/src/test/java/org/postgresql/test/jdbc4/IsValidTest.java
  113. +6 −3 ...resql/test/ssl/{SingleCertValidatingFactoryTest.java → SingleCertValidatingFactoryTestSuite.java}
  114. +3 −1 pgjdbc/src/test/java/org/postgresql/test/ssl/SslTest.java
  115. +2 −2 pgjdbc/src/test/java/org/postgresql/test/ssl/SslTestSuite.java
  116. +24 −666 pom.xml
  117. +13 −0 settings.xml
  118. +42 −0 toolchains.xml
  119. +23 −0 travis_build.sh
  120. +17 −0 travis_deploy.sh
  121. +56 −57 ubenchmark/pom.xml
  122. +12 −2 ubenchmark/src/main/java/org/postgresql/benchmark/statement/FinalizeStatement.java
@@ -9,8 +9,17 @@ nbproject
*.iml
*.ipr
*.iws
build.local.properties
*.local.properties
*-dist.zip
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties

**/target/
# Ignore folders used to build binaries for old Java
/pgjdbc-jre6
/pgjdbc-jre7
@@ -4,56 +4,89 @@ language: java
before_script:
- psql -U postgres -c "create user test with password 'test';"
- psql -c 'create database test owner test;' -U postgres
- echo "MAVEN_OPTS='-Xmx1g'" > ~/.mavenrc

script: mvn clean package
env:
global:
- secure: "2Y1byuAHollEQCOKjEfairV2AQoeXXThscmY+q1AtQTDl87ujlTbqAAn4Ou1wIkXR+EwmJceV5j+svH9m0YYrMRDMxPgSoEsIAcCREwK0IJ4lI0a8Rgox4JTDZPQ0bN1jTCNNieyWwz18n7G8NsEBMfrpl1rS5lv7KWTg9ddjq4="
- secure: "6qt9AryWWe97s4B5ZbPn64lfKsRrEjCQV/bBbjA35FTwjDSLjZYrcDQ8YmPPHvzdp8AiZlL5BdM1C3V+PC/mcFFiKfJEHm9JcQRgN5s8LZrHy8RX58HHBKWSb1Z3govlniZXiz7vYNxHLT5GC1VouzI0z3PSOpXP22qcMWlSGUc="

script:
# make sure previous build artifacts are not used for subsequent builds
- rm -rf $HOME/.m2/repository/org/postgresql || true
- export JDK6_HOME=$(jdk_switcher home openjdk6)
- export JDK7_HOME=$(jdk_switcher home openjdk7)
- export JDK8_HOME=$(jdk_switcher home oraclejdk8)
- envsubst < toolchains.xml > ~/.m2/toolchains.xml
- ./travis_build.sh
# To avoid useless S3 cache updates (https://github.com/travis-ci/travis-ci/issues/1441#issuecomment-67607074)
#- mkdir /tmp/cache-trick
#- mv $HOME/.m2/repository/org/postgresql /tmp/cache-trick/

before_cache:
# No sense in caching current build artifacts
rm -rf $HOME/.m2/repository/org/postgresql

# Skip default "mvn install" issued by Travis
# Root project cannot be compiled with older JDKs, so it makes sense to just skip the step
install: true

cache:
directories:
- '$HOME/.m2/repository'

matrix:
fast_finish: true
include:
- jdk: openjdk6
addons:
postgresql: "9.1"
- jdk: openjdk7
addons:
postgresql: "9.1"
- jdk: oraclejdk7
addons:
postgresql: "9.1"
- jdk: oraclejdk8
addons:
postgresql: "9.1"
- jdk: openjdk6
addons:
postgresql: "9.2"
postgresql: "9.4"
env: PG_VERSION=9.4
- jdk: openjdk7
addons:
postgresql: "9.2"
- jdk: oraclejdk7
postgresql: "9.4"
env: PG_VERSION=9.4
- jdk: openjdk6
addons:
postgresql: "9.2"
postgresql: "9.4"
env: PG_VERSION=9.4
- jdk: oraclejdk8
addons:
postgresql: "9.2"
- jdk: openjdk6
addons:
postgresql: "9.3"
env: PG_VERSION=9.3
- jdk: openjdk7
addons:
postgresql: "9.3"
- jdk: oraclejdk7
env: PG_VERSION=9.3
- jdk: openjdk6
addons:
postgresql: "9.3"
env: PG_VERSION=9.3
- jdk: oraclejdk8
addons:
postgresql: "9.3"
- jdk: openjdk6
addons:
postgresql: "9.4"
postgresql: "9.2"
env: PG_VERSION=9.2
- jdk: openjdk7
addons:
postgresql: "9.4"
- jdk: oraclejdk7
postgresql: "9.2"
env: PG_VERSION=9.2
- jdk: openjdk6
addons:
postgresql: "9.4"
postgresql: "9.2"
env: PG_VERSION=9.2
- jdk: oraclejdk8
addons:
postgresql: "9.4"
postgresql: "9.1"
env: PG_VERSION=9.1
- jdk: openjdk7
addons:
postgresql: "9.1"
env: PG_VERSION=9.1
- jdk: openjdk6
addons:
postgresql: "9.1"
env: PG_VERSION=9.1

# Deploy snapshots to Maven Central
after_success:
- "test $TRAVIS_PULL_REQUEST == 'false' && test $TRAVIS_BRANCH == 'master' && test $PG_VERSION == '9.4' && ./travis_deploy.sh"
170 README.md
@@ -2,6 +2,7 @@
# PostgreSQL JDBC driver

[![Build Status](https://travis-ci.org/pgjdbc/pgjdbc.png)](https://travis-ci.org/pgjdbc/pgjdbc)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.postgresql/postgresql/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.postgresql/postgresql)

This is a simple readme describing how to compile and use the PostgreSQL JDBC driver.

@@ -23,16 +24,49 @@ from the [Postgresql JDBC site](http://jdbc.postgresql.org/) or using your chose
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1201-jdbc41</version>
<version>9.4-1206-jdbc42</version> <!-- Java 8 -->
<version>9.4-1206-jdbc41</version> <!-- Java 7 -->
<version>9.4.1206-jdbc4</version> <!-- Java 6 -->
</dependency>
```
### Gradle
Java 8:
```
'org.postgresql:postgresql:9.4-1201-jdbc41'
'org.postgresql:postgresql:9.4-1206-jdbc42'
```
Java 7:
```
'org.postgresql:postgresql:9.4-1206-jdbc41'
```
Java 6:
```
'org.postgresql:postgresql:9.4-1206-jdbc4'
```
### Ivy
Java 8:
```xml
<dependency org="org.postgresql" name="postgresql" rev="9.4-1201-jdbc41"/>
<dependency org="org.postgresql" name="postgresql" rev="9.4-1206-jdbc4"/>
```
Java 7:
```xml
<dependency org="org.postgresql" name="postgresql" rev="9.4-1206-jdbc4"/>
```
Java 6:
```xml
<dependency org="org.postgresql" name="postgresql" rev="9.4-1206-jdbc4"/>
```

### Development snapshots

Snapshot builds (builds from `master` branch) are deployed to Maven Central, so you can test current development version via
```xml
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1207-SNAPSHOT</version> <!-- Java 8 -->
<version>9.4.1207-jre7-SNAPSHOT</version> <!-- Java 7 -->
<version>9.4.1207-jre6-SNAPSHOT</version> <!-- Java 6 -->
</dependency>
```

## Build requirements
@@ -51,6 +85,13 @@ The PgJDBC project uses git for version control. You can check out the current c
git clone https://github.com/pgjdbc/pgjdbc.git

This will create a pgjdbc directory containing the checked-out source code.
In order do build jre7 or jre6 compatible versions, check out those repositories under `pgjdbc`

cd pgjdbc # <-- that is pgjdbc/pgjdbc.git clone
git clone https://github.com/pgjdbc/pgjdbc-jre7.git
git clone https://github.com/pgjdbc/pgjdbc-jre6.git

Note: all the source code is stored in `pgjdbc.git` repository, so just `pgjdbc.git` is sufficient for development.

## Compiling with Maven on the command line

@@ -64,22 +105,123 @@ IntelliJ. However you can use the tools Maven support from within the IDE if you

After running the build , and build a .jar file (Java ARchive)
depending on the version of java and which release you have the jar will be named
postgresql-<major>.<minor>-<release>.jdbc<N>.jar. Where major,minor are the postgreSQL major,minor
postgresql-<major>.<minor>.<release>.jre<N>.jar. Where major,minor are the postgreSQL major,minor
version numbers. release is the jdbc release number. N is the version of the JDBC API which
corresponds to the version of Java used to compile the driver.

The target directory will contain a number of built artifacts including archives. These
contain a packaged version of the driver jar, source code, documentation and runtime dependencies.
The target directory will contain the driver jar.
If you need source code, documentation and runtime dependencies use `mvn package -P release-artifacts`.

*NOTE*: default build produces Java 8 (JDBC 4.2) driver (in `pgjdbc/target` folder).

If you need a version for older Java, configure `~/.m2/toolchains.xml`.
Here's sample configuration for Mac OS:
```xml
<?xml version="1.0" encoding="UTF8"?>
<toolchains>
<!-- JDK toolchains -->
<toolchain>
<type>jdk</type>
<provides>
<version>1.6</version>
<vendor>oracle</vendor>
</provides>
<configuration>
<jdkHome>/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>1.7</version>
<vendor>oracle</vendor>
</provides>
<configuration>
<jdkHome>/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>1.8</version>
<vendor>oracle</vendor>
</provides>
<configuration>
<jdkHome>/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home</jdkHome>
</configuration>
</toolchain>
</toolchains>
```

## Releasing a snapshot version

TravisCI automatically deploys snapshots for each commit to master branch.

Git repository typically contains -SNAPSHOT versions, so you can use the following command:

mvn deploy && (cd pgjdbc-jre7; mvn deploy) && (cd pgjdbc-jre6; mvn deploy)

*REMEMBER*: Once you have compiled the driver, it will work on ALL platforms
that support that version of the API. You don't need to build it for each
platform.
## Releasing a new version

Prerequisites:
- JDK 6, JDK 7, and JDK8 configured in `~/.m2/toolchains.xml`
- a PostgreSQL instance for running tests

Procedure:

Release a version for JDK8
- From a root folder, perform `mvn release:clean release:prepare`. That will ask you new version, update pom.xml, commit and push it to git.
- From a root folder, perform `mvn release:perform`. That will *stage* Java 8-compatible PgJDBC version to maven central.

Release a version for JDK7
- Update `pgjdbc` submodule in `pgjdbc-jre7`

```
cd pgjdbc-jre7/pgjdbc
git checkout master
git reset --hard REL9.4.1208
cd ..
git add pgjdbc
git commit -m "Update pgjdbc"
```

- Release `pgjdbc-jre7`

```
mvn release:clean release:prepare release:perform
```

Release a version for JDK6
- Update `pgjdbc` submodule in `pgjdbc-jre7`
- Release `pgjdbc-jre6`

```
mvn release:clean release:prepare release:perform
```

Close staging repository and release it:
- From a `pgjdbc` folder, perform

```
mvn nexus-staging:close -DstagingRepositoryId=orgpostgresql-1082
```

The staged repository will become open for smoke testing access at https://oss.sonatype.org/content/repositories/orgpostgresql-1082/

If staged artifacts look fine, release it

```
mvn nexus-staging:release -DstagingRepositoryId=orgpostgresql-1082
```

Update changelog:
- run `./release_notes.sh`, edit as desired

## Dependencies

PgJDBC has optional dependencies on other libraries for some features. These
libraries must also be on your classpath if you wish to use those features; if
they aren't, you'll get a PSQLException at runtime when you try to use features
they aren't, you'll get a `PSQLException` at runtime when you try to use features
with missing libraries.

Maven will download additional dependencies from the Internet (from Maven
@@ -97,7 +239,7 @@ To install the driver, the postgresql jar file has to be in the classpath.
When running standalone Java programs, use the `-cp` command line option,
e.g.

java -cp postgresql-9.4-1201.jdbc4.jar -jar myprogram.jar
java -cp postgresql-<major>.<minor>.<release>.jre<N>.jar -jar myprogram.jar

If you're using an application server or servlet container, follow the
instructions for installing JDBC drivers for that server or container.
@@ -192,11 +334,7 @@ build. The best way to test a proposed change is to build and test with JDK6, 7

You can get old JDK versions from the [Oracle Java Archive](http://www.oracle.com/technetwork/java/archive-139210.html).

Typically you can test against an old JDK with:

export JAVA_HOME=/path/to/jdk_1_6
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:
mvn clean test
Then, to test against old JDK, run `mvn test` in `pgjdbc-jre6` or `pgjdbc-jre7` modules.

For information about the unit tests and how to run them, see
[org/postgresql/test/README](org/postgresql/test/README)
@@ -2,18 +2,13 @@
# settings in build.local.properties.
#

java.source.version=1.6
java.target.version=1.6
major.version=9
minor.version=4
test.database.host=localhost
test.database.port=5432
test.database.name=test
test.database.username=test
test.database.password=test
test.database.privileged.username=postgres
test.database.privileged.password=
test.prepare.threshold=5
test.log.level=0
test.protocol.version=0
test.ssl.properties=ssltest.properties
server=localhost
port=5432
database=test
username=test
password=test
privilegedUser=postgres
privilegedPassword=
preparethreshold=5
loglevel=0
protocolVersion=0
Oops, something went wrong.

0 comments on commit 42c2e3b

Please sign in to comment.