bug in jOOQ Maven code generation output directory

62 views
Skip to first unread message

Garret Wilson

unread,
Apr 27, 2014, 5:39:07 PM4/27/14
to jooq...@googlegroups.com
The online documentation gives the following as an example of how the output directory can be indicated for generated files:

<directory>target/generated-sources/jooq</directory>

The result is less than correct, as this will unexpectedly output the classes relative to the root project if called from a subproject in a hierarchical Maven configuration.

I could make a wild guess and say that this is probably a bug in the jOOQ Maven plugin itself, resolving the given directory relative to the "current directory" rather than first requesting the current project directory from Maven and then resolving the given directory to that. However, one can work around this bug by using the following:

<directory>${project.build.directory}/generated-sources/jooq</directory>

Lukas Eder

unread,
Apr 28, 2014, 10:30:23 AM4/28/14
to jooq...@googlegroups.com
Hi Garret,

Did you encounter this issue with jOOQ 3.3, i.e. with the latest version?

There had been a fix to correctly handle relative paths in the <directory> element:

The fix was implemented in 3.3.0 and 3.2.3

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

Trygve Laugstøl

unread,
Apr 28, 2014, 10:50:41 AM4/28/14
to jooq...@googlegroups.com
A tip from an old Maven developer; make the field a File instead of a String and any relative value given to the field will be prefixed with the current project's basedir.

-- 
Trygve

Garret Wilson

unread,
Apr 28, 2014, 10:59:49 AM4/28/14
to jooq...@googlegroups.com
On Monday, April 28, 2014 7:30:23 AM UTC-7, Lukas Eder wrote:
...

Did you encounter this issue with jOOQ 3.3, i.e. with the latest version?


Ah, you know, what? I indeed encountered that bug with an older version (which is also why I didn't see that separate name mangling issue at first). I had already worked around the relative directory issue before realizing I was using an older version.

(I'll note that the online example indicates an older version, which was why I wound up with the wrong version in the first place. I realize that it's hard to keep all the documentation up-to-date. I assume that the various Maven plugins documentations use some sort of expression evaluation to keep version numbers up-to-date.)

In any case, I think I'll keep the ${project.build.directory} in my POM as it doesn't requirement me to hard-code the targets directory.

Thanks.

Garret

Lukas Eder

unread,
Apr 28, 2014, 12:25:11 PM4/28/14
to jooq...@googlegroups.com
That would be great, although - unfortunately - we're using XJC generated artefacts, which are generated from an XSD file:

This happens to work pretty well with Maven, too. The reason for this is the fact that the XML content should be the same, regardless if you're using Maven or the standalone code generator.

But it's good to know!

Lukas Eder

unread,
Apr 28, 2014, 12:26:56 PM4/28/14
to jooq...@googlegroups.com
Hi Garret,

2014-04-28 16:59 GMT+02:00 Garret Wilson <gar...@globalmentor.com>:
On Monday, April 28, 2014 7:30:23 AM UTC-7, Lukas Eder wrote:
...

Did you encounter this issue with jOOQ 3.3, i.e. with the latest version?


Ah, you know, what? I indeed encountered that bug with an older version (which is also why I didn't see that separate name mangling issue at first). I had already worked around the relative directory issue before realizing I was using an older version.

(I'll note that the online example indicates an older version, which was why I wound up with the wrong version in the first place. I realize that it's hard to keep all the documentation up-to-date. I assume that the various Maven plugins documentations use some sort of expression evaluation to keep version numbers up-to-date.)

Hmm, the versions should all match. Where did you find the wrong version? Note that you linked to a manual from version 3.1:

In that manual, obviously, all jOOQ artefacts are also from version 3.1.x.

Garret Wilson

unread,
Apr 28, 2014, 12:30:56 PM4/28/14
to jooq...@googlegroups.com
On Monday, April 28, 2014 9:26:56 AM UTC-7, Lukas Eder wrote:
...

Hmm, the versions should all match. Where did you find the wrong version? Note that you linked to a manual from version 3.1:

In that manual, obviously, all jOOQ artefacts are also from version 3.1.x.


Oops, yes, I probably landed in an old manual through a Google search. My bad.

Lukas Eder

unread,
Apr 28, 2014, 12:34:45 PM4/28/14
to jooq...@googlegroups.com
Which is where it all began :-)

Does anyone on this group, perhaps, know a trick how to SEO-favour the latest manual / javadoc version compared to old versions? If someone googles jOOQ RecordMapper, the first match in my environment is from jOOQ 2.6, which doesn't make much sense...

Garret Wilson

unread,
Apr 28, 2014, 12:37:52 PM4/28/14
to jooq...@googlegroups.com
On Monday, April 28, 2014 9:34:45 AM UTC-7, Lukas Eder wrote:
Oops, yes, I probably landed in an old manual through a Google search. My bad.

Which is where it all began :-)

Indeed. (chuckles sheepishly) Well, at least maybe the ${project.build.directory} part will be useful to someone...
Reply all
Reply to author
Forward
0 new messages