Include external file in XML used by code generation process

12 views
Skip to first unread message

c.javier...@gmail.com

unread,
Sep 6, 2016, 7:16:18 PM9/6/16
to jOOQ User Group
Hi.

I have been searching on JOOQ documentation and internet pages, but I haven't found the way to include inside the XML file used by code generation process, the jdbc configuration from external properties file.
I would like something like this:

<jdbc>
   <driver>${driverClass}</driver>
   <url>${url}</url>
   <user>${user}</user>
   <password>${password}</password>
</jdbc>

Where: ${driverClass}${url}, etc are loading from a datasource.properties file like this:

driverClass=org.postgresql.Driver
databaseName=myDatabase
...

Thanks in advance

Samir Faci

unread,
Sep 6, 2016, 11:30:57 PM9/6/16
to jooq...@googlegroups.com
How are you invoking the build task? If you're using maven or gradle, property loading is supported by each respective build tool. (Well, I assume it is for grade, but I know maven supports it)

for example:


You could easily have a datasources.properties that you read in from your maven task that loads those parameters in.  





--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Thank you
Samir Faci

c.javier...@gmail.com

unread,
Sep 7, 2016, 6:06:17 AM9/7/16
to jOOQ User Group
Hi Samir

Thanks for your answer.

I read those links some days ago however I'm using SBT to deploy my project (I'm using Play 2 framework).

Thanks.

On Wednesday, September 7, 2016 at 4:30:57 AM UTC+1, Samir Faci wrote:
How are you invoking the build task? If you're using maven or gradle, property loading is supported by each respective build tool. (Well, I assume it is for grade, but I know maven supports it)

for example:


You could easily have a datasources.properties that you read in from your maven task that loads those parameters in.  




On Tue, Sep 6, 2016 at 2:12 PM, <c.javier...@gmail.com> wrote:
Hi.

I have been searching on JOOQ documentation and internet pages, but I haven't found the way to include inside the XML file used by code generation process, the jdbc configuration from external properties file.
I would like something like this:

<jdbc>
   <driver>${driverClass}</driver>
   <url>${url}</url>
   <user>${user}</user>
   <password>${password}</password>
</jdbc>

Where: ${driverClass}${url}, etc are loading from a datasource.properties file like this:

driverClass=org.postgresql.Driver
databaseName=myDatabase
...

Thanks in advance

--
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.

For more options, visit https://groups.google.com/d/optout.

Samir Faci

unread,
Sep 7, 2016, 11:58:17 AM9/7/16
to jooq...@googlegroups.com
Sure, but if you're invoking the Jooq Generation through a build tool of some kind.  You should be able to inject those values in.  Most build system support properties loading.

For SBT just doing a quick search I assume:  https://github.com/sbt/sbt-properties would be relevant ? 

Actually from looking at the basic doc:  http://www.scala-sbt.org/0.12.4/docs/Getting-Started/Hello.html

Doesn't it seem like just adding those values in:  hello/project/build.properties

would work? (Or the equivalent path for your project ) 



To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages