├── .github ├── CODEOWNERS └── workflows │ ├── build.yml │ └── release.yml ├── .sdkmanrc ├── .gitignore ├── examples ├── postgres-flyway-example │ ├── src │ │ └── main │ │ │ └── resources │ │ │ └── db │ │ │ └── migration │ │ │ ├── postgres │ │ │ └── V1__create_tables.sql │ │ │ └── postgresql │ │ │ └── V2__create_post_table.sql │ ├── flyway.conf │ ├── .gitignore │ └── pom.xml ├── postgres-liquibase-example │ ├── src │ │ └── main │ │ │ └── resources │ │ │ └── db │ │ │ └── changelog │ │ │ ├── migration │ │ │ ├── db.changelog-2.0.sql │ │ │ ├── db.changelog-1.0.xml │ │ │ └── db.changelog-3.0.xml │ │ │ └── db.changelog-root.xml │ ├── .gitignore │ └── pom.xml ├── mysql-flyway-example │ ├── src │ │ └── main │ │ │ └── resources │ │ │ └── db │ │ │ └── migration │ │ │ └── V1__create_tables.sql │ ├── .gitignore │ └── pom.xml └── mariadb-flyway-example │ ├── src │ └── main │ │ └── resources │ │ └── db │ │ └── migration │ │ └── V1__create_tables.sql │ ├── .gitignore │ └── pom.xml ├── src ├── test │ ├── resources │ │ ├── pom │ │ │ ├── mysql-flyway-with-flyway-config-file │ │ │ │ ├── flyway.conf │ │ │ │ ├── src │ │ │ │ │ └── main │ │ │ │ │ │ └── resources │ │ │ │ │ │ └── db │ │ │ │ │ │ └── migration │ │ │ │ │ │ └── V1__create_tables.sql │ │ │ │ └── pom.xml │ │ │ ├── mariadb-liquibase │ │ │ │ ├── .testcontainers.properties │ │ │ │ ├── src │ │ │ │ │ └── main │ │ │ │ │ │ └── resources │ │ │ │ │ │ └── db │ │ │ │ │ │ └── changelog │ │ │ │ │ │ └── mariadb │ │ │ │ │ │ ├── db.changelog-root.xml │ │ │ │ │ │ └── migration │ │ │ │ │ │ └── db.changelog-1.0.sql │ │ │ │ └── pom.xml │ │ │ ├── postgres-liquibase │ │ │ │ ├── .testcontainers.properties │ │ │ │ ├── src │ │ │ │ │ └── main │ │ │ │ │ │ └── resources │ │ │ │ │ │ └── db │ │ │ │ │ │ └── changelog │ │ │ │ │ │ ├── migration │ │ │ │ │ │ ├── db.changelog-2.0.sql │ │ │ │ │ │ ├── db.changelog-1.0.xml │ │ │ │ │ │ └── db.changelog-3.0.xml │ │ │ │ │ │ └── db.changelog-root.xml │ │ │ │ └── pom.xml │ │ │ ├── mysql-flyway │ │ │ │ ├── src │ │ │ │ │ └── main │ │ │ │ │ │ └── resources │ │ │ │ │ │ └── db │ │ │ │ │ │ └── migration │ │ │ │ │ │ └── V1__create_tables.sql │ │ │ │ └── pom.xml │ │ │ ├── postgis-flyway │ │ │ │ ├── src │ │ │ │ │ └── main │ │ │ │ │ │ └── resources │ │ │ │ │ │ └── db │ │ │ │ │ │ └── migration │ │ │ │ │ │ └── postgres │ │ │ │ │ │ └── V1__create_tables.sql │ │ │ │ └── pom.xml │ │ │ └── postgres-flyway │ │ │ │ ├── src │ │ │ │ └── main │ │ │ │ │ └── resources │ │ │ │ │ └── db │ │ │ │ │ └── migration │ │ │ │ │ └── postgres │ │ │ │ │ └── V1__create_tables.sql │ │ │ │ └── pom.xml │ │ └── jooq-config-example.xml │ └── java │ │ └── org │ │ └── testcontainers │ │ └── jooq │ │ └── codegen │ │ ├── common │ │ └── Common.java │ │ ├── assertions │ │ └── MavenProjectAssert.java │ │ └── PluginTest.java └── main │ └── java │ └── org │ └── testcontainers │ └── jooq │ └── codegen │ ├── util │ └── OptionalUtils.java │ ├── migration │ └── runner │ │ ├── MigrationRunner.java │ │ ├── RunnerProperties.java │ │ ├── FlywayRunner.java │ │ └── LiquibaseRunner.java │ ├── database │ ├── DatabaseType.java │ ├── DatabaseProps.java │ └── DatabaseProvider.java │ ├── jooq │ ├── JooqProps.java │ └── JooqGenerator.java │ ├── datasource │ ├── ExistingTargetDatasource.java │ ├── ContainerTargetDatasource.java │ └── TargetDatasource.java │ └── Plugin.java ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── RELEASING.md ├── mvnw.cmd ├── README.md ├── LICENSE ├── mvnw └── pom.xml /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @testcontainers/java-team -------------------------------------------------------------------------------- /.sdkmanrc: -------------------------------------------------------------------------------- 1 | java=17.0.4-tem 2 | maven=3.9.1 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | target 4 | src/jooq 5 | -------------------------------------------------------------------------------- /examples/postgres-flyway-example/src/main/resources/db/migration/postgres/V1__create_tables.sql: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/postgres-flyway-example/src/main/resources/db/migration/postgresql/V2__create_post_table.sql: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/test/resources/pom/mysql-flyway-with-flyway-config-file/flyway.conf: -------------------------------------------------------------------------------- 1 | flyway.table=config_overridden_history_table -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/testcontainers/testcontainers-jooq-codegen-maven-plugin/HEAD/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /examples/postgres-flyway-example/flyway.conf: -------------------------------------------------------------------------------- 1 | flyway.table=config_overridden_history_table 2 | flyway.defaultSchema=overridden 3 | flyway.createSchemas=true -------------------------------------------------------------------------------- /src/test/resources/pom/mariadb-liquibase/.testcontainers.properties: -------------------------------------------------------------------------------- 1 | #Modified by Testcontainers 2 | #Wed Jun 07 15:41:45 AMT 2023 3 | docker.client.strategy=org.testcontainers.dockerclient.UnixSocketClientProviderStrategy 4 | -------------------------------------------------------------------------------- /src/test/resources/pom/postgres-liquibase/.testcontainers.properties: -------------------------------------------------------------------------------- 1 | #Modified by Testcontainers 2 | #Wed Jun 07 15:56:27 AMT 2023 3 | docker.client.strategy=org.testcontainers.dockerclient.UnixSocketClientProviderStrategy 4 | -------------------------------------------------------------------------------- /examples/postgres-liquibase-example/src/main/resources/db/changelog/migration/db.changelog-2.0.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE custom.users 2 | ( 3 | uuid uuid PRIMARY KEY DEFAULT gen_random_uuid(), 4 | name varchar, 5 | age int 6 | ); 7 | -------------------------------------------------------------------------------- /src/test/resources/pom/postgres-liquibase/src/main/resources/db/changelog/migration/db.changelog-2.0.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE custom.users 2 | ( 3 | uuid uuid PRIMARY KEY DEFAULT gen_random_uuid(), 4 | name varchar, 5 | age int 6 | ); 7 | -------------------------------------------------------------------------------- /src/main/java/org/testcontainers/jooq/codegen/util/OptionalUtils.java: -------------------------------------------------------------------------------- 1 | package org.testcontainers.jooq.codegen.util; 2 | 3 | import java.util.Optional; 4 | 5 | public class OptionalUtils { 6 | public static boolean bothPresent(Optional first, Optional second) { 7 | return first.isPresent() && second.isPresent(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/java/org/testcontainers/jooq/codegen/common/Common.java: -------------------------------------------------------------------------------- 1 | package org.testcontainers.jooq.codegen.common; 2 | 3 | import java.nio.file.Path; 4 | 5 | /** 6 | * Common constants for tests 7 | */ 8 | public class Common { 9 | 10 | public static final Path DEFAULT_GENERATED_BASEDIR = Path.of("target/generated-sources/jooq"); 11 | public static final Path DEFAULT_GENERATED_PACKAGE = Path.of("org/jooq/codegen/maven/test"); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/testcontainers/jooq/codegen/migration/runner/MigrationRunner.java: -------------------------------------------------------------------------------- 1 | package org.testcontainers.jooq.codegen.migration.runner; 2 | 3 | import org.apache.maven.plugin.MojoExecutionException; 4 | import org.apache.maven.plugin.MojoFailureException; 5 | 6 | /** Common facade for both migration tools */ 7 | public interface MigrationRunner { 8 | 9 | void run(RunnerProperties properties) throws MojoExecutionException, MojoFailureException; 10 | } 11 | -------------------------------------------------------------------------------- /examples/postgres-liquibase-example/src/main/resources/db/changelog/db.changelog-root.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /src/test/resources/pom/postgres-liquibase/src/main/resources/db/changelog/db.changelog-root.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /src/test/resources/pom/mariadb-liquibase/src/main/resources/db/changelog/mariadb/db.changelog-root.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/org/testcontainers/jooq/codegen/database/DatabaseType.java: -------------------------------------------------------------------------------- 1 | package org.testcontainers.jooq.codegen.database; 2 | 3 | /** Database Types supported by the plugin */ 4 | public enum DatabaseType { 5 | POSTGRES("postgres:15.2-alpine"), 6 | MYSQL("mysql:8.0.33"), 7 | MARIADB("mariadb:10.11"); 8 | 9 | private final String defaultImage; 10 | 11 | DatabaseType(String defaultImage) { 12 | this.defaultImage = defaultImage; 13 | } 14 | 15 | public String getDefaultImage() { 16 | return defaultImage; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /examples/mysql-flyway-example/src/main/resources/db/migration/V1__create_tables.sql: -------------------------------------------------------------------------------- 1 | create table users 2 | ( 3 | id bigint not null AUTO_INCREMENT, 4 | email varchar(255) not null, 5 | password varchar(255) not null, 6 | name varchar(255) not null, 7 | role varchar(255) not null, 8 | verified bool not null default false, 9 | verification_token varchar(255), 10 | created_at timestamp, 11 | updated_at timestamp, 12 | PRIMARY KEY (id), 13 | CONSTRAINT user_email_unique UNIQUE (email) 14 | ); 15 | -------------------------------------------------------------------------------- /examples/mariadb-flyway-example/src/main/resources/db/migration/V1__create_tables.sql: -------------------------------------------------------------------------------- 1 | create table users 2 | ( 3 | id bigint not null AUTO_INCREMENT, 4 | email varchar(255) not null, 5 | password varchar(255) not null, 6 | name varchar(255) not null, 7 | role varchar(255) not null, 8 | verified bool not null default false, 9 | verification_token varchar(255), 10 | created_at timestamp, 11 | updated_at timestamp, 12 | PRIMARY KEY (id), 13 | CONSTRAINT user_email_unique UNIQUE (email) 14 | ); 15 | -------------------------------------------------------------------------------- /src/test/resources/pom/mysql-flyway/src/main/resources/db/migration/V1__create_tables.sql: -------------------------------------------------------------------------------- 1 | create table users 2 | ( 3 | id bigint not null AUTO_INCREMENT, 4 | email varchar(255) not null, 5 | password varchar(255) not null, 6 | name varchar(255) not null, 7 | role varchar(255) not null, 8 | verified bool not null default false, 9 | verification_token varchar(255), 10 | created_at timestamp, 11 | updated_at timestamp, 12 | PRIMARY KEY (id), 13 | CONSTRAINT user_email_unique UNIQUE (email) 14 | ); 15 | -------------------------------------------------------------------------------- /examples/postgres-liquibase-example/src/main/resources/db/changelog/migration/db.changelog-1.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | CREATE SCHEMA custom; 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/test/resources/pom/postgres-liquibase/src/main/resources/db/changelog/migration/db.changelog-1.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | CREATE SCHEMA custom; 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/test/resources/pom/mariadb-liquibase/src/main/resources/db/changelog/mariadb/migration/db.changelog-1.0.sql: -------------------------------------------------------------------------------- 1 | create table users 2 | ( 3 | id bigint not null AUTO_INCREMENT, 4 | email varchar(255) not null, 5 | password varchar(255) not null, 6 | name varchar(255) not null, 7 | role varchar(255) not null, 8 | verified bool not null default false, 9 | verification_token varchar(255), 10 | created_at timestamp, 11 | updated_at timestamp, 12 | PRIMARY KEY (id), 13 | CONSTRAINT user_email_unique UNIQUE (email) 14 | ); 15 | -------------------------------------------------------------------------------- /src/test/resources/pom/mysql-flyway-with-flyway-config-file/src/main/resources/db/migration/V1__create_tables.sql: -------------------------------------------------------------------------------- 1 | create table users 2 | ( 3 | id bigint not null AUTO_INCREMENT, 4 | email varchar(255) not null, 5 | password varchar(255) not null, 6 | name varchar(255) not null, 7 | role varchar(255) not null, 8 | verified bool not null default false, 9 | verification_token varchar(255), 10 | created_at timestamp, 11 | updated_at timestamp, 12 | PRIMARY KEY (id), 13 | CONSTRAINT user_email_unique UNIQUE (email) 14 | ); 15 | -------------------------------------------------------------------------------- /RELEASING.md: -------------------------------------------------------------------------------- 1 | # Release process 2 | 3 | Release process is semi-automated through GitHub Actions. This describes the basic steps for a project member to perform a release. 4 | 5 | ## Steps 6 | 7 | 1. Ensure that the `main` branch is building and that tests are passing. 8 | 1. Create a new release on GitHub. 9 | 1. The release triggers a GitHub Action workflow. 10 | 1. Handcraft and polish some of the release notes (e.g. substitute combined dependency PRs and highlight certain features). 11 | 1. Rename existing milestone corresponding to new release and close it. Then create a new `next` milestone. 12 | 13 | ## Internal details 14 | 15 | * JReleaser is in charge of steps in Maven Central. 16 | -------------------------------------------------------------------------------- /examples/mariadb-flyway-example/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### IntelliJ IDEA ### 7 | .idea/modules.xml 8 | .idea/jarRepositories.xml 9 | .idea/compiler.xml 10 | .idea/libraries/ 11 | *.iws 12 | *.iml 13 | *.ipr 14 | 15 | ### Eclipse ### 16 | .apt_generated 17 | .classpath 18 | .factorypath 19 | .project 20 | .settings 21 | .springBeans 22 | .sts4-cache 23 | 24 | ### NetBeans ### 25 | /nbproject/private/ 26 | /nbbuild/ 27 | /dist/ 28 | /nbdist/ 29 | /.nb-gradle/ 30 | build/ 31 | !**/src/main/**/build/ 32 | !**/src/test/**/build/ 33 | 34 | ### VS Code ### 35 | .vscode/ 36 | 37 | ### Mac OS ### 38 | .DS_Store -------------------------------------------------------------------------------- /examples/mysql-flyway-example/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### IntelliJ IDEA ### 7 | .idea/modules.xml 8 | .idea/jarRepositories.xml 9 | .idea/compiler.xml 10 | .idea/libraries/ 11 | *.iws 12 | *.iml 13 | *.ipr 14 | 15 | ### Eclipse ### 16 | .apt_generated 17 | .classpath 18 | .factorypath 19 | .project 20 | .settings 21 | .springBeans 22 | .sts4-cache 23 | 24 | ### NetBeans ### 25 | /nbproject/private/ 26 | /nbbuild/ 27 | /dist/ 28 | /nbdist/ 29 | /.nb-gradle/ 30 | build/ 31 | !**/src/main/**/build/ 32 | !**/src/test/**/build/ 33 | 34 | ### VS Code ### 35 | .vscode/ 36 | 37 | ### Mac OS ### 38 | .DS_Store -------------------------------------------------------------------------------- /examples/postgres-flyway-example/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### IntelliJ IDEA ### 7 | .idea/modules.xml 8 | .idea/jarRepositories.xml 9 | .idea/compiler.xml 10 | .idea/libraries/ 11 | *.iws 12 | *.iml 13 | *.ipr 14 | 15 | ### Eclipse ### 16 | .apt_generated 17 | .classpath 18 | .factorypath 19 | .project 20 | .settings 21 | .springBeans 22 | .sts4-cache 23 | 24 | ### NetBeans ### 25 | /nbproject/private/ 26 | /nbbuild/ 27 | /dist/ 28 | /nbdist/ 29 | /.nb-gradle/ 30 | build/ 31 | !**/src/main/**/build/ 32 | !**/src/test/**/build/ 33 | 34 | ### VS Code ### 35 | .vscode/ 36 | 37 | ### Mac OS ### 38 | .DS_Store -------------------------------------------------------------------------------- /examples/postgres-liquibase-example/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/**/target/ 4 | !**/src/test/**/target/ 5 | 6 | ### IntelliJ IDEA ### 7 | .idea/modules.xml 8 | .idea/jarRepositories.xml 9 | .idea/compiler.xml 10 | .idea/libraries/ 11 | *.iws 12 | *.iml 13 | *.ipr 14 | 15 | ### Eclipse ### 16 | .apt_generated 17 | .classpath 18 | .factorypath 19 | .project 20 | .settings 21 | .springBeans 22 | .sts4-cache 23 | 24 | ### NetBeans ### 25 | /nbproject/private/ 26 | /nbbuild/ 27 | /dist/ 28 | /nbdist/ 29 | /.nb-gradle/ 30 | build/ 31 | !**/src/main/**/build/ 32 | !**/src/test/**/build/ 33 | 34 | ### VS Code ### 35 | .vscode/ 36 | 37 | ### Mac OS ### 38 | .DS_Store -------------------------------------------------------------------------------- /src/test/resources/pom/postgis-flyway/src/main/resources/db/migration/postgres/V1__create_tables.sql: -------------------------------------------------------------------------------- 1 | create sequence user_id_seq start with 1 increment by 5; 2 | 3 | create table users 4 | ( 5 | id bigint DEFAULT nextval('user_id_seq') not null, 6 | email varchar not null, 7 | password varchar not null, 8 | name varchar not null, 9 | role varchar not null, 10 | verified bool not null default false, 11 | verification_token varchar, 12 | created_at timestamp, 13 | updated_at timestamp, 14 | primary key (id), 15 | CONSTRAINT user_email_unique UNIQUE (email) 16 | ); 17 | -------------------------------------------------------------------------------- /src/test/resources/pom/postgres-flyway/src/main/resources/db/migration/postgres/V1__create_tables.sql: -------------------------------------------------------------------------------- 1 | create sequence user_id_seq start with 1 increment by 5; 2 | 3 | create table users 4 | ( 5 | id bigint DEFAULT nextval('user_id_seq') not null, 6 | email varchar not null, 7 | password varchar not null, 8 | name varchar not null, 9 | role varchar not null, 10 | verified bool not null default false, 11 | verification_token varchar, 12 | created_at timestamp, 13 | updated_at timestamp, 14 | primary key (id), 15 | CONSTRAINT user_email_unique UNIQUE (email) 16 | ); 17 | -------------------------------------------------------------------------------- /src/test/resources/jooq-config-example.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | public 6 | .* 7 | flyway_schema_history 8 | 9 | 10 | true 11 | true 12 | true 13 | false 14 | 15 | 16 | com.mycompany.myapp.jooq 17 | src/main/jooq 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/main/java/org/testcontainers/jooq/codegen/jooq/JooqProps.java: -------------------------------------------------------------------------------- 1 | package org.testcontainers.jooq.codegen.jooq; 2 | 3 | import lombok.Data; 4 | import org.apache.maven.plugins.annotations.Parameter; 5 | import org.jooq.meta.jaxb.Generator; 6 | import org.jooq.meta.jaxb.Jdbc; 7 | 8 | /** 9 | * Jooq specific properties 10 | */ 11 | @Data 12 | public class JooqProps { 13 | 14 | /** 15 | * Jdbc specific properties
16 | * Optional 17 | */ 18 | @Parameter 19 | private Jdbc jdbc; 20 | 21 | /** 22 | * Sources generator specific properties
23 | * Optional 24 | */ 25 | @Parameter 26 | private Generator generator; 27 | 28 | /** 29 | * Basedir relative which generation happens
30 | * Optional 31 | */ 32 | @Parameter 33 | private String baseDir; 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/testcontainers/jooq/codegen/database/DatabaseProps.java: -------------------------------------------------------------------------------- 1 | package org.testcontainers.jooq.codegen.database; 2 | 3 | import lombok.Data; 4 | import org.apache.maven.plugins.annotations.Parameter; 5 | 6 | /** 7 | * Database configuration properties. 8 | */ 9 | @Data 10 | public class DatabaseProps { 11 | /** 12 | * Required 13 | */ 14 | @Parameter(required = true) 15 | private DatabaseType type; 16 | 17 | /** 18 | * Optional 19 | */ 20 | @Parameter 21 | private String containerImage; 22 | /** 23 | * Optional 24 | */ 25 | @Parameter 26 | private String username; 27 | /** 28 | * Optional 29 | */ 30 | @Parameter 31 | private String password; 32 | /** 33 | * Optional 34 | */ 35 | @Parameter 36 | private String databaseName; 37 | } 38 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | paths-ignore: 7 | - '.sdkmanrc' 8 | - 'README.md' 9 | - 'RELEASING.md' 10 | pull_request: 11 | branches: [ main ] 12 | paths-ignore: 13 | - '.sdkmanrc' 14 | - 'README.md' 15 | - 'RELEASING.md' 16 | 17 | permissions: 18 | contents: read 19 | 20 | jobs: 21 | build: 22 | name: "Build with ${{ matrix.version }}" 23 | strategy: 24 | matrix: 25 | version: [ 17 ] 26 | runs-on: ubuntu-latest 27 | steps: 28 | - uses: actions/checkout@v4 29 | - name: Set up Java 30 | uses: actions/setup-java@v3 31 | with: 32 | java-version: ${{ matrix.version }} 33 | distribution: 'temurin' 34 | cache: 'maven' 35 | - name: Build with Maven 36 | run: ./mvnw verify 37 | -------------------------------------------------------------------------------- /src/main/java/org/testcontainers/jooq/codegen/datasource/ExistingTargetDatasource.java: -------------------------------------------------------------------------------- 1 | package org.testcontainers.jooq.codegen.datasource; 2 | 3 | import java.sql.Driver; 4 | import java.sql.DriverManager; 5 | import lombok.RequiredArgsConstructor; 6 | import lombok.SneakyThrows; 7 | import lombok.experimental.Delegate; 8 | import org.jooq.meta.jaxb.Jdbc; 9 | 10 | /** 11 | * Datasource using provided parameters 12 | */ 13 | @RequiredArgsConstructor 14 | public final class ExistingTargetDatasource implements TargetDatasource { 15 | 16 | /** 17 | * Gets datasource properties from provided jdbc connection configuration 18 | */ 19 | @Delegate 20 | private final Jdbc jdbc; 21 | 22 | @Override 23 | @SneakyThrows 24 | public Driver getDriverInstance() { 25 | return DriverManager.getDriver(jdbc.getDriver()); 26 | } 27 | 28 | @Override 29 | public void close() {} 30 | } 31 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Publish package to the Maven Central Repository 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | publish: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v4 12 | - name: Set up Java 13 | uses: actions/setup-java@v3 14 | with: 15 | java-version: '17' 16 | distribution: 'temurin' 17 | - name: Publish package 18 | env: 19 | JRELEASER_NEXUS2_USERNAME: ${{ secrets.OSSRH_USERNAME }} 20 | JRELEASER_NEXUS2_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} 21 | JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 22 | JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} 23 | JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} 24 | JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 25 | run: ./mvnw -Prelease deploy jreleaser:deploy -DaltDeploymentRepository=local::file:./target/staging-deploy 26 | -------------------------------------------------------------------------------- /examples/postgres-liquibase-example/src/main/resources/db/changelog/migration/db.changelog-3.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/test/resources/pom/postgres-liquibase/src/main/resources/db/changelog/migration/db.changelog-3.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.1/apache-maven-3.9.1-bin.zip 18 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 19 | -------------------------------------------------------------------------------- /src/main/java/org/testcontainers/jooq/codegen/migration/runner/RunnerProperties.java: -------------------------------------------------------------------------------- 1 | package org.testcontainers.jooq.codegen.migration.runner; 2 | 3 | import java.net.URLClassLoader; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.experimental.Accessors; 7 | import lombok.experimental.Delegate; 8 | import org.apache.maven.plugin.logging.Log; 9 | import org.apache.maven.project.MavenProject; 10 | import org.testcontainers.jooq.codegen.datasource.TargetDatasource; 11 | 12 | /** 13 | * Properties for running migration and generation sources 14 | */ 15 | @Data 16 | @Builder 17 | @Accessors(fluent = true) 18 | public final class RunnerProperties { 19 | /** 20 | * Maven logger 21 | */ 22 | private final Log log; 23 | /** 24 | * Target project 25 | */ 26 | private final MavenProject mavenProject; 27 | /** 28 | * Maven classloader 29 | */ 30 | private final URLClassLoader mavenClassloader; 31 | 32 | /** 33 | * Datasource to migrate and generate sources on 34 | */ 35 | @Delegate 36 | private final TargetDatasource targetDatasource; 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/testcontainers/jooq/codegen/datasource/ContainerTargetDatasource.java: -------------------------------------------------------------------------------- 1 | package org.testcontainers.jooq.codegen.datasource; 2 | 3 | import java.sql.Driver; 4 | import java.util.Objects; 5 | import lombok.experimental.Delegate; 6 | import org.testcontainers.containers.JdbcDatabaseContainer; 7 | import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy; 8 | 9 | /** 10 | * Containerized target datasource 11 | */ 12 | public final class ContainerTargetDatasource implements TargetDatasource { 13 | /** 14 | * Getting datasource properties from container, auto stopping container
15 | * {@link AutoCloseable} is implemented by container and {@code close()} delegated to {@code container.stop()} 16 | */ 17 | @Delegate 18 | private final JdbcDatabaseContainer container; 19 | 20 | public ContainerTargetDatasource(JdbcDatabaseContainer container) { 21 | this.container = Objects.requireNonNull(container); 22 | this.container.setWaitStrategy(new HostPortWaitStrategy()); 23 | this.container.start(); 24 | } 25 | 26 | @Override 27 | public String getUrl() { 28 | return container.getJdbcUrl(); 29 | } 30 | 31 | @Override 32 | public Driver getDriverInstance() { 33 | return container.getJdbcDriverInstance(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/testcontainers/jooq/codegen/datasource/TargetDatasource.java: -------------------------------------------------------------------------------- 1 | package org.testcontainers.jooq.codegen.datasource; 2 | 3 | import java.sql.Driver; 4 | import java.util.Objects; 5 | import java.util.function.Predicate; 6 | import org.jooq.meta.jaxb.Jdbc; 7 | import org.testcontainers.jooq.codegen.database.DatabaseProps; 8 | import org.testcontainers.jooq.codegen.database.DatabaseProvider; 9 | import org.testcontainers.jooq.codegen.jooq.JooqProps; 10 | 11 | /** 12 | * Datasource to migrate and generate sources on 13 | */ 14 | public interface TargetDatasource extends AutoCloseable { 15 | 16 | static TargetDatasource createOrJoinExisting(JooqProps jooq, DatabaseProps database) { 17 | if (needSpinContainer(jooq)) { 18 | var databaseContainer = DatabaseProvider.getDatabaseContainer(database); 19 | return new ContainerTargetDatasource(databaseContainer); 20 | } 21 | 22 | return new ExistingTargetDatasource(jooq.getJdbc()); 23 | } 24 | 25 | private static boolean needSpinContainer(JooqProps jooq) { 26 | final var jdbc = jooq.getJdbc(); 27 | return ((Predicate) Objects::isNull) 28 | .or(props -> props.getUrl() == null) 29 | .or(props -> props.getUser() == null) 30 | .or(props -> props.getPassword() == null) 31 | .test(jdbc); 32 | } 33 | 34 | String getUrl(); 35 | 36 | String getUsername(); 37 | 38 | String getPassword(); 39 | 40 | Driver getDriverInstance(); 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/org/testcontainers/jooq/codegen/database/DatabaseProvider.java: -------------------------------------------------------------------------------- 1 | package org.testcontainers.jooq.codegen.database; 2 | 3 | import java.util.Optional; 4 | import org.testcontainers.containers.JdbcDatabaseContainer; 5 | import org.testcontainers.containers.MariaDBContainer; 6 | import org.testcontainers.containers.MySQLContainer; 7 | import org.testcontainers.containers.PostgreSQLContainer; 8 | import org.testcontainers.utility.DockerImageName; 9 | 10 | /** DatabaseProvider provides container instance for a given DatabaseType */ 11 | public class DatabaseProvider { 12 | 13 | /** Instantiates a Docker container using Testcontainers for the given database type. */ 14 | public static JdbcDatabaseContainer getDatabaseContainer(DatabaseProps props) { 15 | DatabaseType dbType = props.getType(); 16 | String image = Optional.ofNullable(props.getContainerImage()).orElse(dbType.getDefaultImage()); 17 | JdbcDatabaseContainer container = 18 | switch (dbType) { 19 | case POSTGRES -> new PostgreSQLContainer<>( 20 | DockerImageName.parse(image).asCompatibleSubstituteFor("postgres")); 21 | case MARIADB -> new MariaDBContainer<>( 22 | DockerImageName.parse(image).asCompatibleSubstituteFor("mariadb")); 23 | case MYSQL -> new MySQLContainer<>( 24 | DockerImageName.parse(image).asCompatibleSubstituteFor("mysql")); 25 | }; 26 | if (isNotEmpty(props.getUsername())) { 27 | container.withUsername(props.getUsername()); 28 | } 29 | if (isNotEmpty(props.getPassword())) { 30 | container.withPassword(props.getPassword()); 31 | } 32 | if (isNotEmpty(props.getDatabaseName())) { 33 | container.withDatabaseName(props.getDatabaseName()); 34 | } 35 | return container; 36 | } 37 | 38 | private static boolean isNotEmpty(String str) { 39 | return !isEmpty(str); 40 | } 41 | 42 | private static boolean isEmpty(String str) { 43 | return str == null || str.trim().isEmpty(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/org/testcontainers/jooq/codegen/migration/runner/FlywayRunner.java: -------------------------------------------------------------------------------- 1 | package org.testcontainers.jooq.codegen.migration.runner; 2 | 3 | import java.util.HashMap; 4 | import org.flywaydb.core.api.Location; 5 | import org.flywaydb.core.api.configuration.FluentConfiguration; 6 | import org.flywaydb.core.internal.configuration.ConfigUtils; 7 | 8 | /** 9 | * Map with flyway properties, each added property will be prefixed with "flyway" 10 | */ 11 | public class FlywayRunner extends HashMap implements MigrationRunner { 12 | 13 | @Override 14 | public String put(String key, String value) { 15 | var prefixKey = addFlywayPrefix(key); 16 | return super.put(prefixKey, value); 17 | } 18 | 19 | @Override 20 | public void run(RunnerProperties runnerProperties) { 21 | var log = runnerProperties.log(); 22 | put(ConfigUtils.URL, runnerProperties.getUrl()); 23 | put(ConfigUtils.USER, runnerProperties.getUsername()); 24 | put(ConfigUtils.PASSWORD, runnerProperties.getPassword()); 25 | 26 | var configuration = new FluentConfiguration().loadDefaultConfigurationFiles(); 27 | 28 | addDefaults(runnerProperties); 29 | configuration.configuration(this); 30 | 31 | var flyway = configuration.load(); 32 | var result = flyway.migrate(); 33 | var message = result.migrationsExecuted > 0 34 | ? "Applied %s flyway migrations".formatted(result.migrationsExecuted) 35 | : "No flyway migrations were applied"; 36 | log.info(message); 37 | } 38 | 39 | private void addDefaults(RunnerProperties runnerProperties) { 40 | var defaultResourceLocation = "%s%s/src/main/resources/db/migration" 41 | .formatted( 42 | Location.FILESYSTEM_PREFIX, 43 | runnerProperties.mavenProject().getBasedir().getAbsolutePath()); 44 | var defaultClasspathLocation = "%s%s".formatted("classpath:", "/db/migration"); 45 | putIfAbsent(ConfigUtils.LOCATIONS, "%s,%s".formatted(defaultResourceLocation, defaultClasspathLocation)); 46 | } 47 | 48 | private String addFlywayPrefix(String key) { 49 | return key.startsWith("flyway.") ? key : "flyway." + key; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/test/java/org/testcontainers/jooq/codegen/assertions/MavenProjectAssert.java: -------------------------------------------------------------------------------- 1 | package org.testcontainers.jooq.codegen.assertions; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | import static org.testcontainers.jooq.codegen.common.Common.DEFAULT_GENERATED_BASEDIR; 5 | import static org.testcontainers.jooq.codegen.common.Common.DEFAULT_GENERATED_PACKAGE; 6 | 7 | import java.nio.file.Path; 8 | import org.apache.maven.project.MavenProject; 9 | import org.assertj.core.api.AbstractAssert; 10 | 11 | /** 12 | * Maven project assert, used for testing generated sources or rest project specific thongs 13 | */ 14 | public class MavenProjectAssert extends AbstractAssert { 15 | 16 | private final Path generatedSourcesPackage; 17 | 18 | protected MavenProjectAssert(MavenProject mavenProject, Path generatedBasedir, Path generatedPackage) { 19 | super(mavenProject, MavenProjectAssert.class); 20 | generatedSourcesPackage = 21 | mavenProject.getBasedir().toPath().resolve(generatedBasedir).resolve(generatedPackage); 22 | } 23 | 24 | public static MavenProjectAssert assertThatProject(MavenProject project) { 25 | return new MavenProjectAssert(project, DEFAULT_GENERATED_BASEDIR, DEFAULT_GENERATED_PACKAGE); 26 | } 27 | 28 | public static MavenProjectAssert assertThatProject(MavenProject project, Path baseDir, Path pkg) { 29 | return new MavenProjectAssert(project, baseDir, pkg); 30 | } 31 | 32 | public MavenProjectAssert hasGeneratedJooqTable(String schema, String tableFile) { 33 | var schemaDir = generatedSourcesPackage.resolve(schema); 34 | var tablesDir = schemaDir.resolve("tables"); 35 | var table = tablesDir.resolve(tableFile); 36 | assertThat(table) 37 | .withFailMessage("Maven project generated sources %s does not contain file: %s", tablesDir, tableFile) 38 | .isNotEmptyFile(); 39 | return this; 40 | } 41 | 42 | public MavenProjectAssert hasGeneratedJooqTable(String tableFile) { 43 | var tableDir = generatedSourcesPackage.resolve("tables"); 44 | var file = tableDir.resolve(tableFile); 45 | assertThat(file) 46 | .withFailMessage("Maven project generated sources does not contain file: %s", file) 47 | .isNotEmptyFile(); 48 | return this; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/org/testcontainers/jooq/codegen/jooq/JooqGenerator.java: -------------------------------------------------------------------------------- 1 | package org.testcontainers.jooq.codegen.jooq; 2 | 3 | import static org.jooq.Constants.XSD_CODEGEN; 4 | import static org.jooq.codegen.GenerationTool.DEFAULT_TARGET_DIRECTORY; 5 | 6 | import java.util.Optional; 7 | import javax.inject.Inject; 8 | import org.apache.maven.plugin.MojoExecutionException; 9 | import org.apache.maven.plugin.logging.Log; 10 | import org.apache.maven.project.MavenProject; 11 | import org.jooq.codegen.GenerationTool; 12 | import org.jooq.meta.jaxb.Configuration; 13 | import org.jooq.meta.jaxb.Jdbc; 14 | import org.jooq.meta.jaxb.Target; 15 | import org.testcontainers.jooq.codegen.migration.runner.RunnerProperties; 16 | 17 | /** 18 | * Jooq sources generator 19 | */ 20 | public class JooqGenerator { 21 | 22 | @Inject 23 | private MavenProject project; 24 | 25 | public void generateSources(RunnerProperties properties, JooqProps jooq) throws Exception { 26 | var log = properties.log(); 27 | checkGeneratorArguments(jooq, log); 28 | setGeneratorTargets(jooq); 29 | 30 | var jdbc = jooq.getJdbc(); 31 | var basedir = Optional.ofNullable(jooq.getBaseDir()) 32 | .orElse(project.getBasedir().getAbsolutePath()); 33 | if (jdbc == null) { 34 | jdbc = new Jdbc(); 35 | } 36 | jdbc.setUrl(properties.getUrl()); 37 | jdbc.setUser(properties.getUsername()); 38 | jdbc.setPassword(properties.getPassword()); 39 | 40 | final var configuration = new Configuration(); 41 | configuration.setJdbc(jdbc); 42 | configuration.setGenerator(jooq.getGenerator()); 43 | configuration.setBasedir(basedir); 44 | 45 | if (log.isDebugEnabled()) { 46 | log.debug("Using this configuration:\n" + configuration); 47 | } 48 | GenerationTool.generate(configuration); 49 | project.addCompileSourceRoot(jooq.getGenerator().getTarget().getDirectory()); 50 | } 51 | 52 | private void setGeneratorTargets(JooqProps jooq) { 53 | var generator = jooq.getGenerator(); 54 | if (generator.getTarget() == null) { 55 | generator.setTarget(new Target()); 56 | } 57 | if (generator.getTarget().getDirectory() == null) { 58 | generator.getTarget().setDirectory(DEFAULT_TARGET_DIRECTORY); 59 | } 60 | } 61 | 62 | private void checkGeneratorArguments(JooqProps jooq, Log log) throws MojoExecutionException { 63 | if (jooq.getGenerator() != null) { 64 | return; 65 | } 66 | 67 | log.error("Incorrect configuration of jOOQ code generation tool"); 68 | log.error( 69 | """ 70 | The jOOQ-codegen-maven module's generator configuration is not set up correctly. 71 | This can have a variety of reasons, among which: 72 | - Your pom.xml's contains invalid XML according to %s 73 | - There is a version or artifact mismatch between your pom.xml and your commandline""" 74 | .formatted(XSD_CODEGEN)); 75 | 76 | throw new MojoExecutionException( 77 | "Incorrect configuration of jOOQ code generation tool. See error above for details."); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/test/resources/pom/mysql-flyway/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | org.testcontainers 8 | testcontainers-jooq-codegen-maven-plugin-test 9 | 0.0.1-SNAPSHOT 10 | 11 | 12 | 17 13 | 1.19.1 14 | 0.0.4 15 | 3.18.3 16 | 42.6.0 17 | 18 | 19 | 20 | 21 | org.jooq 22 | jooq-codegen 23 | ${jooq.version} 24 | 25 | 26 | org.jooq 27 | jooq 28 | ${jooq.version} 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | org.testcontainers 37 | testcontainers-jooq-codegen-maven-plugin 38 | ${testcontainers-jooq-codegen-maven-plugin.version} 39 | 40 | 41 | org.testcontainers 42 | postgresql 43 | ${testcontainers.version} 44 | 45 | 46 | org.postgresql 47 | postgresql 48 | ${postgresql.version} 49 | 50 | 51 | 52 | generate 53 | 54 | 55 | 56 | generate 57 | 58 | generate 59 | 60 | generate-sources 61 | 62 | 63 | 64 | 65 | MYSQL 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | .* 74 | 75 | 76 | org.jooq.codegen.maven.test 77 | target/generated-sources/jooq 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /src/test/resources/pom/mysql-flyway-with-flyway-config-file/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | org.testcontainers 8 | testcontainers-jooq-codegen-maven-plugin-test 9 | 0.0.1-SNAPSHOT 10 | 11 | 12 | 17 13 | 1.19.1 14 | 0.0.4 15 | 3.18.3 16 | 42.6.0 17 | 18 | 19 | 20 | 21 | org.jooq 22 | jooq-codegen 23 | ${jooq.version} 24 | 25 | 26 | org.jooq 27 | jooq 28 | ${jooq.version} 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | org.testcontainers 37 | testcontainers-jooq-codegen-maven-plugin 38 | ${testcontainers-jooq-codegen-maven-plugin.version} 39 | 40 | 41 | org.testcontainers 42 | postgresql 43 | ${testcontainers.version} 44 | 45 | 46 | org.postgresql 47 | postgresql 48 | ${postgresql.version} 49 | 50 | 51 | 52 | generate 53 | 54 | 55 | 56 | generate 57 | 58 | generate 59 | 60 | generate-sources 61 | 62 | 63 | 64 | 65 | MYSQL 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | .* 74 | 75 | 76 | org.jooq.codegen.maven.test 77 | target/generated-sources/jooq 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /src/test/resources/pom/mariadb-liquibase/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | org.testcontainers 8 | testcontainers-jooq-codegen-maven-plugin-test 9 | 0.0.1-SNAPSHOT 10 | 11 | 12 | 17 13 | 1.19.1 14 | 0.0.4 15 | 3.18.3 16 | 42.6.0 17 | 18 | 19 | 20 | 21 | org.jooq 22 | jooq-codegen 23 | ${jooq.version} 24 | 25 | 26 | org.jooq 27 | jooq 28 | ${jooq.version} 29 | 30 | 31 | 32 | 33 | 34 | 35 | org.testcontainers 36 | testcontainers-jooq-codegen-maven-plugin 37 | ${testcontainers-jooq-codegen-maven-plugin.version} 38 | 39 | 40 | org.testcontainers 41 | postgresql 42 | ${testcontainers.version} 43 | 44 | 45 | org.postgresql 46 | postgresql 47 | ${postgresql.version} 48 | 49 | 50 | 51 | generate 52 | 53 | 54 | 55 | generate 56 | 57 | generate 58 | 59 | generate-sources 60 | 61 | 62 | 63 | 64 | MARIADB 65 | test 66 | test 67 | test 68 | 69 | 70 | 71 | ${project.basedir}/src/main/resources/db/changelog/mariadb 72 | 73 | 74 | db.changelog-root.xml 75 | 76 | 77 | 78 | 79 | 80 | .* 81 | 82 | 83 | org.jooq.codegen.maven.test 84 | target/generated-sources/jooq 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /src/test/resources/pom/postgres-flyway/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | org.testcontainers 8 | testcontainers-jooq-codegen-maven-plugin-test 9 | 0.0.1-SNAPSHOT 10 | 11 | 12 | 17 13 | 1.19.1 14 | 0.0.4 15 | 3.18.3 16 | 42.6.0 17 | 18 | 19 | 20 | 21 | org.jooq 22 | jooq-codegen 23 | ${jooq.version} 24 | 25 | 26 | org.jooq 27 | jooq 28 | ${jooq.version} 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | org.testcontainers 37 | testcontainers-jooq-codegen-maven-plugin 38 | ${testcontainers-jooq-codegen-maven-plugin.version} 39 | 40 | 41 | org.testcontainers 42 | postgresql 43 | ${testcontainers.version} 44 | 45 | 46 | org.postgresql 47 | postgresql 48 | ${postgresql.version} 49 | 50 | 51 | 52 | generate 53 | 54 | 55 | 56 | generate 57 | 58 | generate 59 | 60 | generate-sources 61 | 62 | 63 | 64 | 65 | POSTGRES 66 | postgres:15-alpine 67 | test 68 | test 69 | test 70 | 71 | 72 | 73 | filesystem:${project.basedir}/src/main/resources/db/migration/postgres 74 | 75 | 76 | 77 | 78 | 79 | .* 80 | public 81 | 82 | 83 | org.jooq.codegen.maven.test 84 | target/generated-sources/jooq 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /src/test/resources/pom/postgis-flyway/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | org.testcontainers 8 | testcontainers-jooq-codegen-maven-plugin-test 9 | 0.0.1-SNAPSHOT 10 | 11 | 12 | 17 13 | 1.19.1 14 | 0.0.4 15 | 3.18.3 16 | 42.6.0 17 | 18 | 19 | 20 | 21 | org.jooq 22 | jooq-codegen 23 | ${jooq.version} 24 | 25 | 26 | org.jooq 27 | jooq 28 | ${jooq.version} 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | org.testcontainers 37 | testcontainers-jooq-codegen-maven-plugin 38 | ${testcontainers-jooq-codegen-maven-plugin.version} 39 | 40 | 41 | org.testcontainers 42 | postgresql 43 | ${testcontainers.version} 44 | 45 | 46 | org.postgresql 47 | postgresql 48 | ${postgresql.version} 49 | 50 | 51 | 52 | generate 53 | 54 | 55 | 56 | generate 57 | 58 | generate 59 | 60 | generate-sources 61 | 62 | 63 | 64 | 65 | POSTGRES 66 | postgis/postgis:15-3.4-alpine 67 | test 68 | test 69 | test 70 | 71 | 72 | 73 | filesystem:${project.basedir}/src/main/resources/db/migration/postgres 74 | 75 | 76 | 77 | 78 | 79 | .* 80 | public 81 | 82 | 83 | org.jooq.codegen.maven.test 84 | target/generated-sources/jooq 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /examples/mysql-flyway-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | org.testcontainers.jooqtc 9 | mysql-flyway-example 10 | 0.0.4 11 | 12 | 13 | 17 14 | 17 15 | UTF-8 16 | 1.19.1 17 | 0.0.4 18 | 3.18.3 19 | 8.0.32 20 | 21 | 22 | 23 | 24 | org.jooq 25 | jooq 26 | ${jooq.version} 27 | 28 | 29 | 30 | 31 | 32 | org.testcontainers 33 | testcontainers-jooq-codegen-maven-plugin 34 | ${testcontainers-jooq-codegen-maven-plugin.version} 35 | 36 | 37 | org.testcontainers 38 | mysql 39 | ${testcontainers.version} 40 | 41 | 42 | com.mysql 43 | mysql-connector-j 44 | ${mysql-connector-j.version} 45 | 46 | 47 | 48 | 49 | generate-jooq-sources 50 | 51 | generate 52 | 53 | generate-sources 54 | 55 | 56 | MYSQL 57 | mysql:8.0.33 58 | test 59 | test 60 | test 61 | 62 | 63 | 64 | 65 | 66 | 67 | .* 68 | flyway_schema_history 69 | test 70 | 71 | 72 | org.jooq.codegen.maven.example 73 | target/generated-sources/jooq 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /examples/mariadb-flyway-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | org.testcontainers.jooqtc 9 | mariadb-flyway-example 10 | 0.0.4 11 | 12 | 13 | 17 14 | 17 15 | UTF-8 16 | 1.19.1 17 | 0.0.4 18 | 3.18.3 19 | 3.1.2 20 | 21 | 22 | 23 | 24 | org.jooq 25 | jooq 26 | ${jooq.version} 27 | 28 | 29 | 30 | 31 | 32 | org.testcontainers 33 | testcontainers-jooq-codegen-maven-plugin 34 | ${testcontainers-jooq-codegen-maven-plugin.version} 35 | 36 | 37 | org.testcontainers 38 | mariadb 39 | ${testcontainers.version} 40 | 41 | 42 | org.mariadb.jdbc 43 | mariadb-java-client 44 | ${mariadb-java-client.version} 45 | 46 | 47 | 48 | 49 | generate-jooq-sources 50 | 51 | generate 52 | 53 | generate-sources 54 | 55 | 56 | MARIADB 57 | mariadb:10.11 58 | test 59 | test 60 | test 61 | 62 | 63 | 64 | 65 | 66 | 67 | .* 68 | flyway_schema_history 69 | test 70 | 71 | 72 | org.jooq.codegen.maven.example 73 | target/generated-sources/jooq 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /examples/postgres-flyway-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | org.testcontainers.jooqtc 9 | postgres-flyway-example 10 | 0.0.4 11 | 12 | 13 | 17 14 | 17 15 | UTF-8 16 | 1.19.1 17 | 0.0.4 18 | 3.18.3 19 | 42.6.0 20 | 21 | 22 | 23 | 24 | org.jooq 25 | jooq 26 | ${jooq.version} 27 | 28 | 29 | 30 | 31 | 32 | org.testcontainers 33 | testcontainers-jooq-codegen-maven-plugin 34 | ${testcontainers-jooq-codegen-maven-plugin.version} 35 | 36 | 37 | org.testcontainers 38 | postgresql 39 | ${testcontainers.version} 40 | 41 | 42 | org.postgresql 43 | postgresql 44 | ${postgresql.version} 45 | 46 | 47 | 48 | 49 | generate-jooq-sources 50 | 51 | generate 52 | 53 | generate-sources 54 | 55 | 56 | POSTGRES 57 | postgres:15-alpine 58 | test 59 | test 60 | test 61 | 62 | 63 | 64 | filesystem:src/main/resources/db/migration/postgres, 65 | filesystem:src/main/resources/db/migration/postgresql 66 | 67 | 68 | 69 | 70 | 71 | 72 | .* 73 | overridden 74 | 75 | 76 | org.jooq.codegen.maven.example 77 | target/generated-sources/jooq 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /examples/postgres-liquibase-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | org.testcontainers.jooqtc 9 | postgres-liquibase-example 10 | 0.0.4 11 | 12 | 13 | 17 14 | 17 15 | UTF-8 16 | 1.19.1 17 | 0.0.4 18 | 3.18.3 19 | 42.6.0 20 | 21 | 22 | 23 | 24 | org.jooq 25 | jooq 26 | ${jooq.version} 27 | 28 | 29 | 30 | 31 | 32 | org.testcontainers 33 | testcontainers-jooq-codegen-maven-plugin 34 | ${testcontainers-jooq-codegen-maven-plugin.version} 35 | 36 | 37 | org.testcontainers 38 | postgresql 39 | ${testcontainers.version} 40 | 41 | 42 | org.postgresql 43 | postgresql 44 | ${postgresql.version} 45 | 46 | 47 | 48 | 49 | generate-jooq-sources 50 | 51 | generate 52 | 53 | generate-sources 54 | 55 | 56 | POSTGRES 57 | postgres:15-alpine 58 | test 59 | test 60 | test 61 | 62 | 63 | src/main/resources/db/changelog/db.changelog-root.xml 64 | public 65 | public 66 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | .* 77 | DATABASECHANGELOG 78 | custom 79 | 80 | 81 | org.jooq.codegen.maven.example 82 | target/generated-sources/jooq 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /src/test/resources/pom/postgres-liquibase/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | org.testcontainers 8 | testcontainers-jooq-codegen-maven-plugin-test 9 | 0.0.1-SNAPSHOT 10 | 11 | 12 | 17 13 | 1.19.1 14 | 0.0.4 15 | 3.18.3 16 | 42.6.0 17 | 18 | 19 | 20 | 21 | org.jooq 22 | jooq-codegen 23 | ${jooq.version} 24 | 25 | 26 | org.jooq 27 | jooq 28 | ${jooq.version} 29 | 30 | 31 | 32 | org.apache.maven 33 | maven-core 34 | 3.9.0 35 | 36 | 37 | junit 38 | junit 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | org.testcontainers 48 | testcontainers-jooq-codegen-maven-plugin 49 | ${testcontainers-jooq-codegen-maven-plugin.version} 50 | 51 | 52 | org.testcontainers 53 | postgresql 54 | ${testcontainers.version} 55 | 56 | 57 | org.postgresql 58 | postgresql 59 | ${postgresql.version} 60 | 61 | 62 | 63 | generate 64 | 65 | 66 | 67 | generate 68 | 69 | generate 70 | 71 | generate-sources 72 | 73 | 74 | 75 | 76 | POSTGRES 77 | postgres:15-alpine 78 | test 79 | test 80 | test 81 | 82 | 83 | 84 | 85 | 86 | .* 87 | 88 | 89 | custom 90 | 91 | 92 | public 93 | 94 | 95 | 96 | 97 | org.jooq.codegen.maven.test 98 | target/generated-sources/jooq 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /src/test/java/org/testcontainers/jooq/codegen/PluginTest.java: -------------------------------------------------------------------------------- 1 | package org.testcontainers.jooq.codegen; 2 | 3 | import static org.codehaus.plexus.PlexusTestCase.getTestFile; 4 | import static org.testcontainers.jooq.codegen.assertions.MavenProjectAssert.assertThatProject; 5 | 6 | import org.apache.maven.plugin.Mojo; 7 | import org.apache.maven.plugin.testing.MojoRule; 8 | import org.apache.maven.project.MavenProject; 9 | import org.junit.AfterClass; 10 | import org.junit.Rule; 11 | import org.junit.Test; 12 | 13 | /** 14 | * Integration test plugin under real pom files
15 | * Sources by default are generated under the same test pom directory
16 | * You can check them after test runs, nothing gets into final jar 17 | */ 18 | public class PluginTest { 19 | private static final String userHome = System.getProperty("user.home"); 20 | 21 | @AfterClass 22 | public static void afterClass() { 23 | System.setProperty("user.home", userHome); 24 | } 25 | 26 | @Rule 27 | public MojoRule mojoRule = new MojoRule(); 28 | 29 | @Test 30 | public void testPostgresFlyway() throws Exception { 31 | // given 32 | MavenProject mavenProject = getMavenProject("postgres-flyway"); 33 | 34 | // when 35 | mojoRule.lookupConfiguredMojo(mavenProject, "generate").execute(); 36 | 37 | // then 38 | assertThatProject(mavenProject) 39 | .hasGeneratedJooqTable("Users.java") 40 | .hasGeneratedJooqTable("FlywaySchemaHistory.java"); 41 | } 42 | 43 | @Test 44 | public void testPostgresLiquibase() throws Exception { 45 | // given 46 | MavenProject mavenProject = getMavenProject("postgres-liquibase"); 47 | 48 | // when 49 | mojoRule.lookupConfiguredMojo(mavenProject, "generate").execute(); 50 | 51 | // then 52 | assertThatProject(mavenProject) 53 | .hasGeneratedJooqTable("custom", "Person.java") 54 | .hasGeneratedJooqTable("custom", "Users.java") 55 | .hasGeneratedJooqTable("public_", "Databasechangelog.java"); 56 | } 57 | 58 | @Test 59 | public void testPostgisFlyway() throws Exception { 60 | // given 61 | MavenProject mavenProject = getMavenProject("postgis-flyway"); 62 | 63 | // when 64 | mojoRule.lookupConfiguredMojo(mavenProject, "generate").execute(); 65 | 66 | // then 67 | assertThatProject(mavenProject) 68 | .hasGeneratedJooqTable("Users.java") 69 | .hasGeneratedJooqTable("FlywaySchemaHistory.java"); 70 | } 71 | 72 | @Test 73 | public void testMysqlFlyway() throws Exception { 74 | // given 75 | MavenProject mavenProject = getMavenProject("mysql-flyway"); 76 | 77 | // when 78 | mojoRule.lookupConfiguredMojo(mavenProject, "generate").execute(); 79 | 80 | // then 81 | assertThatProject(mavenProject) 82 | .hasGeneratedJooqTable("test", "FlywaySchemaHistory.java") 83 | .hasGeneratedJooqTable("test", "Users.java"); 84 | } 85 | 86 | @Test 87 | public void testMariadbLiquibase() throws Exception { 88 | // given 89 | MavenProject mavenProject = getMavenProject("mariadb-liquibase"); 90 | 91 | // when 92 | mojoRule.lookupConfiguredMojo(mavenProject, "generate").execute(); 93 | 94 | // then 95 | assertThatProject(mavenProject) 96 | .hasGeneratedJooqTable("test", "Users.java") 97 | .hasGeneratedJooqTable("test", "Databasechangelog.java"); 98 | } 99 | 100 | /** 101 | * Ensures that default flyway.conf has been loaded and default locations picked up for flyway 102 | */ 103 | @Test 104 | public void testMysqlFlywayDefaultConfig() throws Exception { 105 | // given 106 | MavenProject mavenProject = getMavenProject("mysql-flyway-with-flyway-config-file"); 107 | 108 | // when 109 | Mojo generate = mojoRule.lookupConfiguredMojo(mavenProject, "generate"); 110 | generate.execute(); 111 | 112 | // then 113 | assertThatProject(mavenProject) 114 | .hasGeneratedJooqTable("test", "ConfigOverriddenHistoryTable.java") 115 | .hasGeneratedJooqTable("test", "Users.java"); 116 | } 117 | 118 | private MavenProject getMavenProject(String dirName) throws Exception { 119 | var baseDir = getTestFile("src/test/resources/pom/%s".formatted(dirName)); 120 | var mavenProject = mojoRule.readMavenProject(baseDir); 121 | mojoRule.getContainer().addComponent(mavenProject, MavenProject.class, ""); 122 | setUserHomeToCurrentProject(mavenProject); 123 | return mavenProject; 124 | } 125 | 126 | /** 127 | * It makes current user home directory to maven pom basedir, allowing to apply relative configs and migraitons 128 | */ 129 | private void setUserHomeToCurrentProject(MavenProject mavenProject) { 130 | System.setProperty("user.home", mavenProject.getBasedir().getAbsolutePath()); 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /src/main/java/org/testcontainers/jooq/codegen/migration/runner/LiquibaseRunner.java: -------------------------------------------------------------------------------- 1 | package org.testcontainers.jooq.codegen.migration.runner; 2 | 3 | import static java.util.Optional.ofNullable; 4 | 5 | import java.io.FileNotFoundException; 6 | import java.sql.Connection; 7 | import java.sql.Driver; 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | import java.util.Map; 11 | import java.util.Properties; 12 | import liquibase.Liquibase; 13 | import liquibase.database.Database; 14 | import liquibase.database.DatabaseFactory; 15 | import liquibase.database.jvm.JdbcConnection; 16 | import liquibase.exception.DatabaseException; 17 | import liquibase.resource.ClassLoaderResourceAccessor; 18 | import liquibase.resource.DirectoryResourceAccessor; 19 | import liquibase.resource.ResourceAccessor; 20 | import liquibase.resource.SearchPathResourceAccessor; 21 | import org.apache.maven.plugin.MojoExecutionException; 22 | import org.apache.maven.plugins.annotations.Parameter; 23 | 24 | /** 25 | * Liquibase runner 26 | */ 27 | public class LiquibaseRunner implements MigrationRunner { 28 | 29 | /** 30 | * Default: {@link #changeLogDirectory}/{@link #changeLogPath db.changelog-root.xml}
31 | * or src/main/resources/{@link #changeLogPath db.changelog-root.xml}
32 | * depending on {@link #changeLogDirectory} presence
33 | * Example: src/main/resources/db/changelog/db.changelog-root.xml 34 | */ 35 | @Parameter(name = "liquibase.changeLogPath") 36 | private String changeLogPath; 37 | 38 | /** 39 | * Default: project.basedir 40 | */ 41 | @Parameter(name = "liquibase.changeLogDirectory") 42 | private String changeLogDirectory; 43 | 44 | @Parameter(name = "liquibase.parameters") 45 | private Map parameters; 46 | 47 | @Parameter(name = "liquibase.defaultSchemaName") 48 | private String defaultSchemaName; 49 | 50 | @Parameter(name = "liquibase.liquibaseSchemaName") 51 | private String liquibaseSchemaName; 52 | 53 | @Parameter(name = "liquibase.databaseChangeLogTableName") 54 | private String databaseChangeLogTableName; 55 | 56 | @Parameter(name = "liquibase.databaseChangeLogLockTableName") 57 | private String databaseChangeLogLockTableName; 58 | 59 | @Override 60 | public void run(RunnerProperties runnerProps) throws MojoExecutionException { 61 | setDefaultLocations(runnerProps); 62 | try { 63 | Driver driver = runnerProps.getDriverInstance(); 64 | Properties properties = new Properties(); 65 | properties.put("user", runnerProps.getUsername()); 66 | properties.put("password", runnerProps.getPassword()); 67 | Connection c = driver.connect(runnerProps.getUrl(), properties); 68 | Database database = createDatabase(c); 69 | ResourceAccessor accessor = getResourceAccessor(runnerProps); 70 | Liquibase liquibase = new Liquibase(changeLogPath, accessor, database); 71 | setParameters(liquibase); 72 | liquibase.update(); 73 | } catch (Exception e) { 74 | throw new MojoExecutionException(e.getMessage()); 75 | } 76 | } 77 | 78 | private void setDefaultLocations(RunnerProperties runnerProps) { 79 | var defaultDir = runnerProps.mavenProject().getBasedir(); 80 | if (changeLogPath == null) { 81 | changeLogPath = changeLogDirectory == null 82 | ? "src/main/resources/db/changelog/db.changelog-root.xml" 83 | : "db.changelog-root.xml"; 84 | } 85 | if (changeLogDirectory == null) { 86 | changeLogDirectory = defaultDir.getAbsolutePath(); 87 | } else { 88 | changeLogDirectory = 89 | defaultDir.toPath().resolve(changeLogDirectory).toFile().getAbsolutePath(); 90 | } 91 | } 92 | 93 | private Database createDatabase(Connection c) throws DatabaseException { 94 | Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(c)); 95 | if (defaultSchemaName != null) { 96 | database.setDefaultSchemaName(defaultSchemaName); 97 | } 98 | ofNullable(liquibaseSchemaName).ifPresent(database::setLiquibaseSchemaName); 99 | ofNullable(databaseChangeLogLockTableName).ifPresent(database::setDatabaseChangeLogLockTableName); 100 | ofNullable(databaseChangeLogTableName).ifPresent(database::setDatabaseChangeLogTableName); 101 | return database; 102 | } 103 | 104 | private void setParameters(Liquibase liquibase) { 105 | if (parameters != null) { 106 | parameters.forEach(liquibase::setChangeLogParameter); 107 | } 108 | } 109 | 110 | private ResourceAccessor getResourceAccessor(RunnerProperties properties) throws FileNotFoundException { 111 | List resourceAccessors = new ArrayList<>(); 112 | resourceAccessors.add(new ClassLoaderResourceAccessor(properties.mavenClassloader())); 113 | resourceAccessors.add(new ClassLoaderResourceAccessor(getClass().getClassLoader())); 114 | resourceAccessors.add( 115 | new DirectoryResourceAccessor(properties.mavenProject().getBasedir())); 116 | ResourceAccessor[] array = resourceAccessors.toArray(ResourceAccessor[]::new); 117 | return new SearchPathResourceAccessor(changeLogDirectory, array); 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/main/java/org/testcontainers/jooq/codegen/Plugin.java: -------------------------------------------------------------------------------- 1 | package org.testcontainers.jooq.codegen; 2 | 3 | import static org.apache.maven.plugins.annotations.LifecyclePhase.GENERATE_SOURCES; 4 | import static org.apache.maven.plugins.annotations.ResolutionScope.TEST; 5 | import static org.testcontainers.jooq.codegen.util.OptionalUtils.bothPresent; 6 | 7 | import java.io.File; 8 | import java.net.URL; 9 | import java.net.URLClassLoader; 10 | import java.util.List; 11 | import java.util.Optional; 12 | import javax.inject.Inject; 13 | import org.apache.maven.plugin.AbstractMojo; 14 | import org.apache.maven.plugin.MojoExecutionException; 15 | import org.apache.maven.plugins.annotations.Mojo; 16 | import org.apache.maven.plugins.annotations.Parameter; 17 | import org.apache.maven.project.MavenProject; 18 | import org.testcontainers.jooq.codegen.database.DatabaseProps; 19 | import org.testcontainers.jooq.codegen.datasource.TargetDatasource; 20 | import org.testcontainers.jooq.codegen.jooq.JooqGenerator; 21 | import org.testcontainers.jooq.codegen.jooq.JooqProps; 22 | import org.testcontainers.jooq.codegen.migration.runner.FlywayRunner; 23 | import org.testcontainers.jooq.codegen.migration.runner.LiquibaseRunner; 24 | import org.testcontainers.jooq.codegen.migration.runner.MigrationRunner; 25 | import org.testcontainers.jooq.codegen.migration.runner.RunnerProperties; 26 | 27 | /** 28 | * Plugin entry point. 29 | */ 30 | @Mojo(name = "generate", defaultPhase = GENERATE_SOURCES, requiresDependencyResolution = TEST, threadSafe = true) 31 | public class Plugin extends AbstractMojo { 32 | 33 | @Parameter(property = "project", required = true, readonly = true) 34 | private MavenProject project; 35 | 36 | @Parameter 37 | private boolean skip; 38 | 39 | @Parameter(required = true) 40 | private DatabaseProps database; 41 | 42 | @Parameter(required = true) 43 | private JooqProps jooq; 44 | 45 | @Parameter 46 | private FlywayRunner flyway; 47 | 48 | @Parameter 49 | private LiquibaseRunner liquibase; 50 | 51 | @Inject 52 | private JooqGenerator jooqGenerator; 53 | 54 | @Override 55 | public void execute() throws MojoExecutionException { 56 | if (skip) { 57 | getLog().info("'Skip' is true, Skipping jOOQ code generation"); 58 | return; 59 | } 60 | 61 | if (database.getType() == null) { 62 | throw new MojoExecutionException("Property 'type' should be specified inside 'database' block"); 63 | } 64 | 65 | final var oldCL = Thread.currentThread().getContextClassLoader(); 66 | final var mavenClassloader = getMavenClassloader(); 67 | 68 | try (var targetDatasource = TargetDatasource.createOrJoinExisting(jooq, database)) { 69 | doExecute(mavenClassloader, targetDatasource); 70 | } catch (Exception ex) { 71 | throw new MojoExecutionException("Error running jOOQ code generation tool", ex); 72 | } finally { 73 | closeClassloader(oldCL, mavenClassloader); 74 | } 75 | } 76 | 77 | private void doExecute(URLClassLoader mavenClassloader, TargetDatasource targetDatasource) throws Exception { 78 | var properties = RunnerProperties.builder() 79 | .targetDatasource(targetDatasource) 80 | .mavenProject(project) 81 | .log(getLog()) 82 | .mavenClassloader(mavenClassloader) 83 | .build(); 84 | Thread.currentThread().setContextClassLoader(mavenClassloader); 85 | 86 | final var oFlyway = Optional.ofNullable(flyway); 87 | final var oLiquibase = Optional.ofNullable(liquibase); 88 | if (bothPresent(oFlyway, oLiquibase)) { 89 | getLog().error( 90 | """ 91 | Incorrect configuration is provided.Plugin supports only one migration tool. 92 | Please remain only flyway or liquibase."""); 93 | throw new MojoExecutionException( 94 | "Both configurations for migration tool are provided, pick either flyway or liquibase"); 95 | } 96 | 97 | oLiquibase 98 | .or(() -> oFlyway) 99 | .orElseThrow(() -> new IllegalArgumentException("Neither liquibase nor flyway provided!")) 100 | .run(properties); 101 | 102 | getLog().info("Migration completed"); 103 | 104 | jooqGenerator.generateSources(properties, jooq); 105 | } 106 | 107 | private void closeClassloader(ClassLoader oldCL, URLClassLoader mavenClassloader) { 108 | Thread.currentThread().setContextClassLoader(oldCL); 109 | try { 110 | mavenClassloader.close(); 111 | } catch (Throwable e) { 112 | getLog().error("Couldn't close the classloader.", e); 113 | } 114 | } 115 | 116 | private URLClassLoader getMavenClassloader() throws MojoExecutionException { 117 | try { 118 | List classpathElements = project.getRuntimeClasspathElements(); 119 | if (classpathElements == null) { 120 | classpathElements = List.of(); 121 | } 122 | URL[] urls = new URL[classpathElements.size()]; 123 | 124 | for (int i = 0; i < urls.length; i++) { 125 | urls[i] = new File(classpathElements.get(i)).toURI().toURL(); 126 | } 127 | 128 | return new URLClassLoader(urls, getClass().getClassLoader()); 129 | } catch (Exception e) { 130 | throw new MojoExecutionException("Couldn't create a classloader.", e); 131 | } 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Apache Maven Wrapper startup batch script, version 3.2.0 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 28 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 29 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 30 | @REM e.g. to debug Maven itself, use 31 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 32 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 33 | @REM ---------------------------------------------------------------------------- 34 | 35 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 36 | @echo off 37 | @REM set title of command window 38 | title %0 39 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 40 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 41 | 42 | @REM set %HOME% to equivalent of $HOME 43 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 44 | 45 | @REM Execute a user defined script before this one 46 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 47 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 48 | if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* 49 | if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* 50 | :skipRcPre 51 | 52 | @setlocal 53 | 54 | set ERROR_CODE=0 55 | 56 | @REM To isolate internal variables from possible post scripts, we use another setlocal 57 | @setlocal 58 | 59 | @REM ==== START VALIDATION ==== 60 | if not "%JAVA_HOME%" == "" goto OkJHome 61 | 62 | echo. 63 | echo Error: JAVA_HOME not found in your environment. >&2 64 | echo Please set the JAVA_HOME variable in your environment to match the >&2 65 | echo location of your Java installation. >&2 66 | echo. 67 | goto error 68 | 69 | :OkJHome 70 | if exist "%JAVA_HOME%\bin\java.exe" goto init 71 | 72 | echo. 73 | echo Error: JAVA_HOME is set to an invalid directory. >&2 74 | echo JAVA_HOME = "%JAVA_HOME%" >&2 75 | echo Please set the JAVA_HOME variable in your environment to match the >&2 76 | echo location of your Java installation. >&2 77 | echo. 78 | goto error 79 | 80 | @REM ==== END VALIDATION ==== 81 | 82 | :init 83 | 84 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 85 | @REM Fallback to current working directory if not found. 86 | 87 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 88 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 89 | 90 | set EXEC_DIR=%CD% 91 | set WDIR=%EXEC_DIR% 92 | :findBaseDir 93 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 94 | cd .. 95 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 96 | set WDIR=%CD% 97 | goto findBaseDir 98 | 99 | :baseDirFound 100 | set MAVEN_PROJECTBASEDIR=%WDIR% 101 | cd "%EXEC_DIR%" 102 | goto endDetectBaseDir 103 | 104 | :baseDirNotFound 105 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 106 | cd "%EXEC_DIR%" 107 | 108 | :endDetectBaseDir 109 | 110 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 111 | 112 | @setlocal EnableExtensions EnableDelayedExpansion 113 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 114 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 115 | 116 | :endReadAdditionalConfig 117 | 118 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 119 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 120 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 121 | 122 | set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" 123 | 124 | FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 125 | IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B 126 | ) 127 | 128 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 129 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 130 | if exist %WRAPPER_JAR% ( 131 | if "%MVNW_VERBOSE%" == "true" ( 132 | echo Found %WRAPPER_JAR% 133 | ) 134 | ) else ( 135 | if not "%MVNW_REPOURL%" == "" ( 136 | SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" 137 | ) 138 | if "%MVNW_VERBOSE%" == "true" ( 139 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 140 | echo Downloading from: %WRAPPER_URL% 141 | ) 142 | 143 | powershell -Command "&{"^ 144 | "$webclient = new-object System.Net.WebClient;"^ 145 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 146 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 147 | "}"^ 148 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ 149 | "}" 150 | if "%MVNW_VERBOSE%" == "true" ( 151 | echo Finished downloading %WRAPPER_JAR% 152 | ) 153 | ) 154 | @REM End of extension 155 | 156 | @REM If specified, validate the SHA-256 sum of the Maven wrapper jar file 157 | SET WRAPPER_SHA_256_SUM="" 158 | FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 159 | IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B 160 | ) 161 | IF NOT %WRAPPER_SHA_256_SUM%=="" ( 162 | powershell -Command "&{"^ 163 | "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ 164 | "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ 165 | " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ 166 | " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ 167 | " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ 168 | " exit 1;"^ 169 | "}"^ 170 | "}" 171 | if ERRORLEVEL 1 goto error 172 | ) 173 | 174 | @REM Provide a "standardized" way to retrieve the CLI args that will 175 | @REM work with both Windows and non-Windows executions. 176 | set MAVEN_CMD_LINE_ARGS=%* 177 | 178 | %MAVEN_JAVA_EXE% ^ 179 | %JVM_CONFIG_MAVEN_PROPS% ^ 180 | %MAVEN_OPTS% ^ 181 | %MAVEN_DEBUG_OPTS% ^ 182 | -classpath %WRAPPER_JAR% ^ 183 | "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ 184 | %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 185 | if ERRORLEVEL 1 goto error 186 | goto end 187 | 188 | :error 189 | set ERROR_CODE=1 190 | 191 | :end 192 | @endlocal & set ERROR_CODE=%ERROR_CODE% 193 | 194 | if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost 195 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 196 | if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" 197 | if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" 198 | :skipRcPost 199 | 200 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 201 | if "%MAVEN_BATCH_PAUSE%"=="on" pause 202 | 203 | if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% 204 | 205 | cmd /C exit /B %ERROR_CODE% 206 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # testcontainers-jooq-codegen-maven-plugin 2 | 3 | The `testcontainers-jooq-codegen-maven-plugin` simplifies the jOOQ code generation 4 | by using [Testcontainers](https://www.testcontainers.org/) and applying database migrations. 5 | 6 | [![Build](https://github.com/testcontainers/testcontainers-jooq-codegen-maven-plugin/actions/workflows/build.yml/badge.svg)](https://github.com/testcontainers/testcontainers-jooq-codegen-maven-plugin/actions/workflows/build.yml) 7 | ![Maven Central](https://img.shields.io/maven-central/v/org.testcontainers/testcontainers-jooq-codegen-maven-plugin?label=latest-version) 8 | 9 | ## Summary 10 | 11 | - Plugin migration and code generation might be skipped using `skip` property 12 | - If you need to reuse existing database connection - take a look at [Jooq section](#Jooq) 13 | 14 | ## Database Configuration 15 | 16 | To configure a target database, you need to specify at least database `type` property. 17 | 18 | #### Properties 19 | 20 | | Parameter | Required | Default value | Description | 21 | |----------------|----------|----------------------------------------------------------------------------|----------------------------------------------------------------| 22 | | type | yes | | Database implementation one of: `POSTGRES` `MYSQL` `MARIADB` | 23 | | containerImage | | Provided from database type,usually latest version from official container | Image of used container if not default picked | 24 | | username | | Provided from database container if not specified | Database username for container | 25 | | password | | Provided from database container if not specified | Database password for container | 26 | | databaseName | | Provided from database container if not specified | Database name for container | 27 | 28 | #### `database` block configuration 29 | 30 | ```xml 31 | 32 | 33 | POSTGRES 34 | postgres:15-alpine 35 | test 36 | test 37 | test 38 | 39 | ``` 40 | 41 | ## Migration tools: 42 | 43 | ### Flyway 44 | 45 | Flyway works the same way as the original plugin 46 | Please find original documentation by link https://flywaydb.org/documentation/usage/maven/ 47 | 48 | #### Configuration 49 | 50 | At runtime default configuration files will be autoloaded as it documented - 51 | https://flywaydb.org/documentation/configuration/configfile 52 | Currently, the plugin supports all properties existing in Flyway 53 | You can find them by original link 54 | https://flywaydb.org/documentation/configuration/parameters/ 55 | Now [config files parameter](https://flywaydb.org/documentation/configuration/parameters/configFiles) is not 56 | implemented yet, but you can use config file at default location ${baseDir}/flyway.conf 57 | 58 | #### `flyway` block configuration 59 | 60 | - Zero configuration with defaults 61 | 62 | ```xml 63 | 64 | 65 | ``` 66 | 67 | - Adding properties 68 | 69 | ```xml 70 | 71 | 72 | bank 73 | true 74 | my_custom_history_table
75 | 76 | filesystem:src/main/resources/db/migration/postgres, 77 | filesystem:src/main/resources/db/migration/postgresql 78 | 79 |
80 | ``` 81 | 82 | ### Liquibase 83 | 84 | Liquibase's configuration works the same way as the original maven plugin, with some limitations 85 | Please find documentation by 86 | link https://docs.liquibase.com/tools-integrations/maven/using-liquibase-and-maven-pom-file.html 87 | 88 | #### Properties 89 | 90 | Now supports only the most useful properties 91 | 92 | | Property | type | default | 93 | |--------------------------------|--------|------------------------------------------------------------------------------------------------------------------------------| 94 | | changeLogPath | String | if changeLogDirectory is provided - db.changelog-root.xml, otherwise - src/main/resources/db/changelog/db.changelog-root.xml | 95 | | changeLogDirectory | String | projectBaseDir | 96 | | parameters | Map | | 97 | | defaultSchemaName | String | | 98 | | liquibaseSchemaName | String | | 99 | | databaseChangeLogTableName | String | | 100 | | databaseChangeLogLockTableName | String | | 101 | 102 | Reference to Liquibase properties - https://docs.liquibase.com/concepts/connections/creating-config-properties.html 103 | 104 | #### `liquibase` block configuration 105 | 106 | - Zero configuration with defaults 107 | 108 | ```xml 109 | 110 | 111 | ``` 112 | 113 | - Adding properties 114 | 115 | ```xml 116 | 117 | 118 | db.changelog-root.yml 119 | src/main/resources/db/postgres/changelog 120 | custom 121 | 122 | ``` 123 | 124 | ### JOOQ 125 | 126 | #### Properties 127 | 128 | `generator` - property to configure JOOQ code generation settings. 129 | See https://www.jooq.org/doc/latest/manual/code-generation/codegen-configuration for all the supporting configuration 130 | properties. 131 | `configurationFiles` / `configurationFile` - are not implemented yet 132 | `jdbc` - If it has all the necessary JDBC parameters (URL, name, password), it will use the existing database, and no container will be spun up. 133 | `baseDir` - directory relative to which generated sources will be generated , `{project.basedir}` - default 134 | 135 | #### `jooq` block configuration 136 | 137 | ```xml 138 | 139 | 140 | 141 | 142 | ... 143 | 144 | 145 | 146 | .... 147 | 148 | 149 | ``` 150 | 151 | #### Plugin dependencies configuration 152 | 153 | ```xml 154 | 155 | 156 | org.postgresql 157 | postgresql 158 | ${postgresql.version} 159 | 160 | ``` 161 | 162 | ## Examples 163 | 164 | ### Complete example 165 | 166 | Example with `PostgreSQL` and minimal configuration with `Flyway` and `JOOQ` 167 | 168 | ```xml 169 | 170 | 171 | org.testcontainers 172 | testcontainers-jooq-codegen-maven-plugin 173 | ${testcontainers-jooq-codegen-maven-plugin.version} 174 | 175 | 176 | org.testcontainers 177 | postgresql 178 | ${testcontainers.version} 179 | 180 | 181 | org.postgresql 182 | postgresql 183 | ${postgresql.version} 184 | 185 | 186 | 187 | 188 | generate-jooq-sources 189 | 190 | generate 191 | 192 | generate-sources 193 | 194 | 195 | POSTGRES 196 | 197 | 198 | 199 | 200 | 201 | .* 202 | public 203 | 204 | 205 | org.jooq.codegen.maven.example 206 | target/generated-sources/jooq 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | ``` 215 | 216 | ### More examples 217 | 218 | [MariaDB + Flyway](examples/mariadb-flyway-example ) 219 | [MySQL + Flyway](examples/mysql-flyway-example ) 220 | [Postgres + Flyway](examples/postgres-flyway-example ) 221 | [Postgres + Liquibase](examples/postgres-liquibase-example ) 222 | 223 | ### Try with example application 224 | 225 | ```shell 226 | $ cd examples/postgres-flyway-example 227 | $ mvn clean package 228 | ``` 229 | 230 | The JOOQ code should be generated under example/target/generated-sources/jooq folder. 231 | 232 | ## CREDITS: 233 | 234 | This plugin is heavily based on official https://github.com/jOOQ/jOOQ/tree/main/jOOQ-codegen-maven. 235 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Apache Maven Wrapper startup batch script, version 3.2.0 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | # e.g. to debug Maven itself, use 32 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | # ---------------------------------------------------------------------------- 35 | 36 | if [ -z "$MAVEN_SKIP_RC" ] ; then 37 | 38 | if [ -f /usr/local/etc/mavenrc ] ; then 39 | . /usr/local/etc/mavenrc 40 | fi 41 | 42 | if [ -f /etc/mavenrc ] ; then 43 | . /etc/mavenrc 44 | fi 45 | 46 | if [ -f "$HOME/.mavenrc" ] ; then 47 | . "$HOME/.mavenrc" 48 | fi 49 | 50 | fi 51 | 52 | # OS specific support. $var _must_ be set to either true or false. 53 | cygwin=false; 54 | darwin=false; 55 | mingw=false 56 | case "$(uname)" in 57 | CYGWIN*) cygwin=true ;; 58 | MINGW*) mingw=true;; 59 | Darwin*) darwin=true 60 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 61 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 62 | if [ -z "$JAVA_HOME" ]; then 63 | if [ -x "/usr/libexec/java_home" ]; then 64 | JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME 65 | else 66 | JAVA_HOME="/Library/Java/Home"; export JAVA_HOME 67 | fi 68 | fi 69 | ;; 70 | esac 71 | 72 | if [ -z "$JAVA_HOME" ] ; then 73 | if [ -r /etc/gentoo-release ] ; then 74 | JAVA_HOME=$(java-config --jre-home) 75 | fi 76 | fi 77 | 78 | # For Cygwin, ensure paths are in UNIX format before anything is touched 79 | if $cygwin ; then 80 | [ -n "$JAVA_HOME" ] && 81 | JAVA_HOME=$(cygpath --unix "$JAVA_HOME") 82 | [ -n "$CLASSPATH" ] && 83 | CLASSPATH=$(cygpath --path --unix "$CLASSPATH") 84 | fi 85 | 86 | # For Mingw, ensure paths are in UNIX format before anything is touched 87 | if $mingw ; then 88 | [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] && 89 | JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)" 90 | fi 91 | 92 | if [ -z "$JAVA_HOME" ]; then 93 | javaExecutable="$(which javac)" 94 | if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then 95 | # readlink(1) is not available as standard on Solaris 10. 96 | readLink=$(which readlink) 97 | if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then 98 | if $darwin ; then 99 | javaHome="$(dirname "\"$javaExecutable\"")" 100 | javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac" 101 | else 102 | javaExecutable="$(readlink -f "\"$javaExecutable\"")" 103 | fi 104 | javaHome="$(dirname "\"$javaExecutable\"")" 105 | javaHome=$(expr "$javaHome" : '\(.*\)/bin') 106 | JAVA_HOME="$javaHome" 107 | export JAVA_HOME 108 | fi 109 | fi 110 | fi 111 | 112 | if [ -z "$JAVACMD" ] ; then 113 | if [ -n "$JAVA_HOME" ] ; then 114 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 115 | # IBM's JDK on AIX uses strange locations for the executables 116 | JAVACMD="$JAVA_HOME/jre/sh/java" 117 | else 118 | JAVACMD="$JAVA_HOME/bin/java" 119 | fi 120 | else 121 | JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)" 122 | fi 123 | fi 124 | 125 | if [ ! -x "$JAVACMD" ] ; then 126 | echo "Error: JAVA_HOME is not defined correctly." >&2 127 | echo " We cannot execute $JAVACMD" >&2 128 | exit 1 129 | fi 130 | 131 | if [ -z "$JAVA_HOME" ] ; then 132 | echo "Warning: JAVA_HOME environment variable is not set." 133 | fi 134 | 135 | # traverses directory structure from process work directory to filesystem root 136 | # first directory with .mvn subdirectory is considered project base directory 137 | find_maven_basedir() { 138 | if [ -z "$1" ] 139 | then 140 | echo "Path not specified to find_maven_basedir" 141 | return 1 142 | fi 143 | 144 | basedir="$1" 145 | wdir="$1" 146 | while [ "$wdir" != '/' ] ; do 147 | if [ -d "$wdir"/.mvn ] ; then 148 | basedir=$wdir 149 | break 150 | fi 151 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 152 | if [ -d "${wdir}" ]; then 153 | wdir=$(cd "$wdir/.." || exit 1; pwd) 154 | fi 155 | # end of workaround 156 | done 157 | printf '%s' "$(cd "$basedir" || exit 1; pwd)" 158 | } 159 | 160 | # concatenates all lines of a file 161 | concat_lines() { 162 | if [ -f "$1" ]; then 163 | # Remove \r in case we run on Windows within Git Bash 164 | # and check out the repository with auto CRLF management 165 | # enabled. Otherwise, we may read lines that are delimited with 166 | # \r\n and produce $'-Xarg\r' rather than -Xarg due to word 167 | # splitting rules. 168 | tr -s '\r\n' ' ' < "$1" 169 | fi 170 | } 171 | 172 | log() { 173 | if [ "$MVNW_VERBOSE" = true ]; then 174 | printf '%s\n' "$1" 175 | fi 176 | } 177 | 178 | BASE_DIR=$(find_maven_basedir "$(dirname "$0")") 179 | if [ -z "$BASE_DIR" ]; then 180 | exit 1; 181 | fi 182 | 183 | MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR 184 | log "$MAVEN_PROJECTBASEDIR" 185 | 186 | ########################################################################################## 187 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 188 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 189 | ########################################################################################## 190 | wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" 191 | if [ -r "$wrapperJarPath" ]; then 192 | log "Found $wrapperJarPath" 193 | else 194 | log "Couldn't find $wrapperJarPath, downloading it ..." 195 | 196 | if [ -n "$MVNW_REPOURL" ]; then 197 | wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" 198 | else 199 | wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" 200 | fi 201 | while IFS="=" read -r key value; do 202 | # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' ) 203 | safeValue=$(echo "$value" | tr -d '\r') 204 | case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;; 205 | esac 206 | done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" 207 | log "Downloading from: $wrapperUrl" 208 | 209 | if $cygwin; then 210 | wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") 211 | fi 212 | 213 | if command -v wget > /dev/null; then 214 | log "Found wget ... using wget" 215 | [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" 216 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 217 | wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 218 | else 219 | wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 220 | fi 221 | elif command -v curl > /dev/null; then 222 | log "Found curl ... using curl" 223 | [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" 224 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 225 | curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" 226 | else 227 | curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" 228 | fi 229 | else 230 | log "Falling back to using Java to download" 231 | javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" 232 | javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" 233 | # For Cygwin, switch paths to Windows format before running javac 234 | if $cygwin; then 235 | javaSource=$(cygpath --path --windows "$javaSource") 236 | javaClass=$(cygpath --path --windows "$javaClass") 237 | fi 238 | if [ -e "$javaSource" ]; then 239 | if [ ! -e "$javaClass" ]; then 240 | log " - Compiling MavenWrapperDownloader.java ..." 241 | ("$JAVA_HOME/bin/javac" "$javaSource") 242 | fi 243 | if [ -e "$javaClass" ]; then 244 | log " - Running MavenWrapperDownloader.java ..." 245 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" 246 | fi 247 | fi 248 | fi 249 | fi 250 | ########################################################################################## 251 | # End of extension 252 | ########################################################################################## 253 | 254 | # If specified, validate the SHA-256 sum of the Maven wrapper jar file 255 | wrapperSha256Sum="" 256 | while IFS="=" read -r key value; do 257 | case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;; 258 | esac 259 | done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" 260 | if [ -n "$wrapperSha256Sum" ]; then 261 | wrapperSha256Result=false 262 | if command -v sha256sum > /dev/null; then 263 | if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then 264 | wrapperSha256Result=true 265 | fi 266 | elif command -v shasum > /dev/null; then 267 | if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then 268 | wrapperSha256Result=true 269 | fi 270 | else 271 | echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." 272 | echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." 273 | exit 1 274 | fi 275 | if [ $wrapperSha256Result = false ]; then 276 | echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 277 | echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 278 | echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 279 | exit 1 280 | fi 281 | fi 282 | 283 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 284 | 285 | # For Cygwin, switch paths to Windows format before running java 286 | if $cygwin; then 287 | [ -n "$JAVA_HOME" ] && 288 | JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") 289 | [ -n "$CLASSPATH" ] && 290 | CLASSPATH=$(cygpath --path --windows "$CLASSPATH") 291 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 292 | MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") 293 | fi 294 | 295 | # Provide a "standardized" way to retrieve the CLI args that will 296 | # work with both Windows and non-Windows executions. 297 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*" 298 | export MAVEN_CMD_LINE_ARGS 299 | 300 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 301 | 302 | # shellcheck disable=SC2086 # safe args 303 | exec "$JAVACMD" \ 304 | $MAVEN_OPTS \ 305 | $MAVEN_DEBUG_OPTS \ 306 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 307 | "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 308 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 309 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 4.0.0 7 | 8 | org.testcontainers 9 | testcontainers-jooq-codegen-maven-plugin 10 | 0.0.4 11 | maven-plugin 12 | testcontainers-jooq-codegen-maven-plugin 13 | jOOQ code generator using Testcontainers 14 | https://github.com/testcontainers/testcontainers-jooq-codegen-maven-plugin 15 | 2023 16 | 17 | 18 | 19 | The Apache Software License, Version 2.0 20 | http://www.apache.org/licenses/LICENSE-2.0.txt 21 | repo 22 | 23 | 24 | 25 | 26 | 27 | author 28 | K Siva Prasad Reddy 29 | sivaprasadreddy.k@gmail.com 30 | 31 | 32 | contributor 33 | Roman Oborin 34 | deadok68@gmail.com 35 | 36 | 37 | 38 | 39 | scm:git:https://github.com/testcontainers/testcontainers-jooq-codegen-maven-plugin.git 40 | scm:git:https://github.com/testcontainers-jooq-codegen-maven-plugin.git 41 | 42 | https://github.com/testcontainers/testcontainers-jooq-codegen-maven-plugin 43 | HEAD 44 | 45 | 46 | 47 | UTF-8 48 | UTF-8 49 | 17 50 | 2.36.0 51 | 3.9.0 52 | 3.8.1 53 | 2.2.1 54 | 3.9.0 55 | 3.10.1 56 | 3.2.1 57 | 3.4.1 58 | 3.6.0 59 | 3.6.1 60 | 1.19.1 61 | 9.16.3 62 | 4.22.0 63 | 5.9.3 64 | 3.18.3 65 | 4.13.2 66 | 42.6.0 67 | 8.0.32 68 | 3.1.2 69 | 3.24.2 70 | 3.3.0 71 | 5.9.3 72 | 1.18.26 73 | 74 | 75 | 76 | 77 | org.apache.maven 78 | maven-plugin-api 79 | ${maven-plugin-api.version} 80 | 81 | 82 | org.apache.maven 83 | maven-core 84 | ${maven-core.version} 85 | 86 | 87 | junit 88 | junit 89 | 90 | 91 | 92 | 93 | org.projectlombok 94 | lombok 95 | ${lombok.version} 96 | 97 | 98 | org.apache.maven 99 | maven-compat 100 | 3.9.1 101 | test 102 | 103 | 104 | 105 | org.apache.maven.plugin-tools 106 | maven-plugin-annotations 107 | ${maven-plugin-annotations.version} 108 | 109 | 110 | 111 | org.jooq 112 | jooq-codegen 113 | ${jooq.version} 114 | 115 | 116 | org.testcontainers 117 | testcontainers 118 | 119 | 120 | org.testcontainers 121 | jdbc 122 | 123 | 124 | junit 125 | junit 126 | ${junit.version} 127 | provided 128 | 129 | 130 | org.flywaydb 131 | flyway-core 132 | ${flyway-core.version} 133 | 134 | 135 | 136 | org.flywaydb 137 | flyway-mysql 138 | ${flyway-core.version} 139 | 140 | 141 | org.liquibase 142 | liquibase-core 143 | ${liquibase-core.version} 144 | 145 | 146 | 147 | org.testcontainers 148 | postgresql 149 | 150 | 151 | org.testcontainers 152 | mysql 153 | 154 | 155 | org.testcontainers 156 | mariadb 157 | 158 | 159 | org.postgresql 160 | postgresql 161 | ${postgresql.version} 162 | provided 163 | 164 | 165 | com.mysql 166 | mysql-connector-j 167 | ${mysql-connector-j.version} 168 | provided 169 | 170 | 171 | org.mariadb.jdbc 172 | mariadb-java-client 173 | ${mariadb-java-client.version} 174 | provided 175 | 176 | 177 | 178 | org.apache.maven.plugin-testing 179 | maven-plugin-testing-harness 180 | ${maven-plugin-testing-harness.version} 181 | test 182 | 183 | 184 | org.junit.jupiter 185 | junit-jupiter 186 | ${junit-jupiter.version} 187 | test 188 | 189 | 190 | org.assertj 191 | assertj-core 192 | ${assertj-core.version} 193 | test 194 | 195 | 196 | org.junit.vintage 197 | junit-vintage-engine 198 | ${junit-vintage-engine.version} 199 | test 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | org.testcontainers 208 | testcontainers-bom 209 | ${testcontainers.version} 210 | pom 211 | import 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | org.apache.maven.plugins 220 | maven-source-plugin 221 | 3.3.0 222 | 223 | 224 | attach-sources 225 | verify 226 | 227 | jar-no-fork 228 | 229 | 230 | 231 | 232 | 233 | org.apache.maven.plugins 234 | maven-compiler-plugin 235 | ${maven-compiler-plugin.version} 236 | 237 | false 238 | true 239 | 512m 240 | 256m 241 | UTF-8 242 | ${java.version} 243 | ${java.version} 244 | ${java.version} 245 | true 246 | lines,vars,source 247 | 248 | -Xlint:varargs 249 | 250 | 251 | 252 | 253 | com.diffplug.spotless 254 | spotless-maven-plugin 255 | ${spotless-maven-plugin.version} 256 | 257 | 258 | 259 | 260 | 261 | 2.30.0 262 | 263 | 264 | 265 | 266 | 267 | 268 | compile 269 | 270 | check 271 | 272 | 273 | 274 | 275 | 276 | org.apache.maven.plugins 277 | maven-plugin-plugin 278 | ${maven-plugin-plugin.version} 279 | 280 | 281 | 282 | org.ow2.asm 283 | asm 284 | 9.4 285 | 286 | 287 | org.apache.maven.plugin-tools 288 | maven-plugin-tools-annotations 289 | ${maven-plugin-tools-annotations.version} 290 | 291 | 292 | 293 | true 294 | 295 | 296 | 297 | mojo-descriptor 298 | 299 | descriptor 300 | 301 | 302 | 303 | help-goal 304 | 305 | helpmojo 306 | 307 | 308 | 309 | 310 | 311 | org.apache.maven.plugins 312 | maven-surefire-plugin 313 | 3.0.0-M5 314 | 315 | 316 | org.junit.vintage:junit-vintage-engine 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | release 326 | 327 | 328 | 329 | org.apache.maven.plugins 330 | maven-source-plugin 331 | ${maven-source-plugin.version} 332 | 333 | 334 | attach-sources 335 | 336 | jar 337 | 338 | 339 | 340 | 341 | 342 | org.apache.maven.plugins 343 | maven-javadoc-plugin 344 | ${maven-javadoc-plugin.version} 345 | 346 | 347 | attach-javadocs 348 | 349 | jar 350 | 351 | 352 | 353 | 354 | 355 | org.jreleaser 356 | jreleaser-maven-plugin 357 | 1.6.0 358 | 359 | 360 | 361 | ALWAYS 362 | true 363 | 364 | 365 | 366 | 367 | 368 | ALWAYS 369 | https://oss.sonatype.org/service/local 370 | https://oss.sonatype.org/content/repositories/snapshots/ 371 | 372 | true 373 | true 374 | target/staging-deploy 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | --------------------------------------------------------------------------------