Generate same artifact for every environment with different database names

27 views
Skip to first unread message

Josu Pagazaurtundua

unread,
Oct 11, 2023, 7:35:16 AM10/11/23
to jOOQ User Group
Hi,
We are configuring Jooq Maven plugin for automatically generating Java code. We generate it by using a CI/CD pipeline with Gitlab CI and we version and store the artifact while in develop environment to promote it to the rest of the environments without generating the code again.
We use the following configuration:
                    <generator>
                        <name>org.jooq.codegen.JavaGenerator</name>
                        <database>
                            <name>org.jooq.meta.sqlserver.SQLServerDatabase</name>
                            <inputCatalog>DATABASE</inputCatalog>
                            <includeSql>select DOMAIN_NAME  from INFORMATION_SCHEMA.DOMAINS</includeSql>
                            <includes>Pa.* | Get.*</includes>
                            <inputSchema>dbo</inputSchema>
                        </database>
                        <target>
                            <packageName>org.euskotren.persistence.framework.model</packageName>
                            <directory>/src/main/java/</directory>
                        </target>
                    </generator>
The database is a SQL Server and the problem comes with the "inputCatalog" tag. While the database model is the same in all of the environments, the database name changes with the suffix of the environment (DATABASE-DEV, DATABASE-TST, DATABASE-PRO). Is it possible to ignore this argument in anyway, or configure in a different way so we can send this parameter as a variable? The Java generated code includes it and forces us to generate an artifact for each environment.
Thanks a lot

Lukas Eder

unread,
Oct 11, 2023, 7:37:34 AM10/11/23
to jooq...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/3aae74d5-eae6-4be2-b0f6-77d4e9560864n%40googlegroups.com.

Josu Pagazaurtundua

unread,
Oct 13, 2023, 5:08:41 AM10/13/23
to jOOQ User Group
Great!! Your solution works perfectly! I didn't notice about that attribute, thanks a lot!
Reply all
Reply to author
Forward
0 new messages