Skip to content

Instantly share code, notes, and snippets.

@n0531m
Last active May 14, 2023 07:58
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/1ec7cf9fe30a702794c5b406c6705e1b to your computer and use it in GitHub Desktop.
Save n0531m/1ec7cf9fe30a702794c5b406c6705e1b to your computer and use it in GitHub Desktop.
Create UberJar for CloudSQL (MySQL) 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>mysql_${mysql.version}-with-cloudsql-socket-factory_${cloudsql.socketfactory.version}</artifactId>
<packaging>pom</packaging>
<version>0.0.1</version>
<prerequisites>
<maven>3.6.0</maven>
</prerequisites>
<properties>
<mysql.version>8.0.33</mysql.version>
<cloudsql.socketfactory.version>1.11.2</cloudsql.socketfactory.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.cloud.sql/mysql-socket-factory-connector-j-8 -->
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>mysql-socket-factory-connector-j-8</artifactId>
<version>${cloudsql.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