Skip to content

Instantly share code, notes, and snippets.

@n0531m
Last active May 13, 2023 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n0531m/7b2ffd83b419104900f58ded6bdc77db to your computer and use it in GitHub Desktop.
Save n0531m/7b2ffd83b419104900f58ded6bdc77db to your computer and use it in GitHub Desktop.
Create UberJar for CloudSQL (PostgreSQL) with Socket Factory included
<?xml version="1.0" encoding="UTF-8"?>
<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>com.gmail.n0531m</groupId>
<artifactId>postgresql_${postgresql.version}-with-cloudsql-socket-factory_${postgresql.socketfactory.version}</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<prerequisites>
<maven>3.6.0</maven>
</prerequisites>
<properties>
<postgresql.version>42.6.0</postgresql.version>
<postgresql.socketfactory.version>1.11.2</postgresql.socketfactory.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.cloud.sql/postgres-socket-factory -->
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>postgres-socket-factory</artifactId>
<version>${postgresql.socketfactory.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<!-- get all project dependencies -->
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<!-- bind to the packaging phase -->
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment