Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get rid of files with names bin$

Using Jooq generator, by Gradle plugin, I am getting now with POJOs and tables not only classes with normal names, bu also heaps of files whose names start by bin$.

They are not necessary, for only yesterday the generator did not make these files. And everything works OK with or without them. But I don't want the project to be littered with tens of excessive files.

like image 245
Gangnus Avatar asked Feb 10 '17 16:02

Gangnus


2 Answers

Since 10'th version, Oracle puts the dropped tables to the recycle bin. They have names starting by Bin$. So, JooQ simply makes classes for dropped tables. That could be blocked in two ways: To stop use recycling bean in Oracle or to filter the tables for which the Jooq generator makes classes.

ALTER SYSTEM SET RECYCLEBIN = OFF DEFERRED;
purge dba_recyclebin;

or to change the generator setting (the example is for Gradle)

generator{
   ...
   database {
      ...
      excludes = '(?i:BIN\\$.*)'

Edit: Finally after several attempts (by Lukas) and checks (by me) Lukas had found the correct meaning for excludes. Its form, IMHO, has the only explanation - JOOQ doesn't work with regex'es correctly, for Groovy does not parse the strings in single quotes.

like image 191
Gangnus Avatar answered Sep 29 '22 18:09

Gangnus


jOOQ's <excludes/> setting is a Java regular expression. You have to properly form it like this:

excludes = '(?i:BIN\\$.*)'

Explanation:

  • Use (?i:...) for case-insensitivity. Just in case. Pun intended.
  • Use \\ before the $ sign because the $ means "end of line" in regular expressions. You want to escape that. And because Groovy/Gradle parses (as in "look for escape sequences") your string, you need to escape the backslash too, for it to reach the Java Pattern.compile() call
  • Use .* to indicate that after the $, you want to match any number of characters. . = any character and * = any number of repetitions
like image 28
Lukas Eder Avatar answered Sep 29 '22 17:09

Lukas Eder