Support environment variables in target directory of the code generator?

7 views
Skip to first unread message

Thorsten Schöning

unread,
Feb 7, 2020, 10:36:40 AM2/7/20
to jooq...@googlegroups.com
Hi all,

configs for my code generator are placed in the following directory,
of which the upper most level is an Eclipse-project:

> de.am_soft.sm_mtg.backend\src\main\code_gen\de\am_soft\sm_mtg\backend\daos\db\jooq\live\code_gen.xml
> de.am_soft.sm_mtg.backend\src\main\code_gen\de\am_soft\sm_mtg\backend\daos\db\jooq\live\logback.xml
> de.am_soft.sm_mtg.backend\src\main\code_gen\de\am_soft\sm_mtg\backend\daos\db\jooq\live\logs\2020-02.log

To execute things I'm using a launch config and am able to either set
a current directory and use relative paths to files or use absolute
paths using variable replacement provided by Eclipse.

> "${workspace_loc:de.am_soft.sm_mtg.backend/src/main/code_gen/de/am_soft/sm_mtg/backend/daos/db/jooq/code_gen.xml}"
> "-Dlogback.configurationFile=${workspace_loc:de.am_soft.sm_mtg.backend/src/main/code_gen/de/am_soft/sm_mtg/backend/daos/db/jooq/logback.xml}"

The problem is that I use subdirs based on the Java package and that
change form time to time and then I need to adopt those paths as well.
that means two changes in the launch config + one in logback.xml.
OTOH, if the launch config would only set the current working
directory to be in some lower level, I could use relative paths to
files mostly.

The only place left then based on the package is the
target directory of the generator. That needs to be adopted at least
when hierarchy changes:

> <directory>../../../../../../../../../java</directory>

How about supporting some environment variable in that path, so that
one can get a fix path always? The launch config could define one that
wouldn't change too often that way.

> XYZ=${workspace_loc:de.am_soft.sm_mtg.backend/src/main/java}
> <directory>${XYZ}</directory>

Mit freundlichen Grüßen,

Thorsten Schöning

--
Thorsten Schöning E-Mail: Thorsten....@AM-SoFT.de
AM-SoFT IT-Systeme http://www.AM-SoFT.de/

Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

Lukas Eder

unread,
Feb 7, 2020, 10:40:22 AM2/7/20
to jOOQ User Group
jOOQ 3.13 will have a configuration/basedir property for that:

In the mean time, you could run the code generation with your XYZ directory as the JVM's working directory, I suspect.

Thanks,
Lukas 

--
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/441683929.20200207163634%40am-soft.de.

Thorsten Schöning

unread,
Feb 7, 2020, 12:12:09 PM2/7/20
to jOOQ User Group
Guten Tag Lukas Eder,
am Freitag, 7. Februar 2020 um 16:40 schrieben Sie:

> jOOQ 3.13 will have a configuration/basedir property for that:
> https://github.com/jOOQ/jOOQ/issues/9727

> In the mean time, you could run the code generation with your XYZ directory
> as the JVM's working directory, I suspect.

I don't think either of both will help me: The current directory is
already so that I can configure most files with relative paths. Not
only for jOOQ itself, but e.g. Logback as well.

The only problem is the target directory of the generator, which needs
to leave that directory and where I need to hard-code many "..".

An additional "baseDir" doesn't help, because the current working dir
still needs to be like it is so that jOOQ can find it's config to read
the base dir and Logback is supported as well, which isn't aware of
"baseDir" at all. Additionally, without replacing some sort of
environment variables, "baseDir" itself could only be relative or
absolute again, with the latter is what I'm trying to avoid.

In my case, Eclipse already knows everything I need, e.g. the absolute
path to my project, I simply can't forward that easily. The only thing
I can use is the current working directory, for some things of jOOQ
the class path still works as well, but not for all, like loading
XML-schema files.

But things are not that important as well. :-)

Lukas Eder

unread,
Feb 10, 2020, 4:21:03 AM2/10/20
to jOOQ User Group
Hi Thorsten,

I'm not entirely sure if I understand the problems you're having... In any case, do note that you can always use programmatic configuration of the code generator: https://www.jooq.org/doc/latest/manual/code-generation/codegen-programmatic/

Thanks,
Lukas

--
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.
Reply all
Reply to author
Forward
0 new messages