title: jooq codegen with JPADatabase not working
body: <p>I have an issue using jooq codegen with JPADatabase. I have gone through this <a href="https://stackoverflow.com/questions/42968155/unable-to-generate-jooq-classes-from-h2-using-jpadatabase">post</a> and made the changes accordingly. My project contains sub modules and the entity classes are in domain module. I have biz module on which depends on domain. So I have this build configuration in biz module's pom.xml.</p>
  
  <pre><code>&lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.8&lt;/source&gt;
                  &lt;target&gt;1.8&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.jooq&lt;/groupId&gt;
              &lt;artifactId&gt;jooq-codegen-maven&lt;/artifactId&gt;
              &lt;version&gt;3.9.1&lt;/version&gt;
  
              &lt;!-- The plugin should hook into the generate goal --&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;generate-sources&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;generate&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
  
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;org.jooq&lt;/groupId&gt;
                      &lt;artifactId&gt;jooq-meta-extensions&lt;/artifactId&gt;
                      &lt;version&gt;3.9.1&lt;/version&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;
  
              &lt;configuration&gt;
  
                  &lt;!-- Generator parameters --&gt;
                  &lt;generator&gt;
  
                      &lt;database&gt;
                          &lt;name&gt;org.jooq.util.jpa.JPADatabase&lt;/name&gt;
                          &lt;properties&gt;
                              &lt;!-- A comma separated list of Java packages, that contain your entities --&gt;
                              &lt;property&gt;
                                  &lt;key&gt;packages&lt;/key&gt;
                                  &lt;value&gt;com.yaswanth.domain.entity&lt;/value&gt;
                              &lt;/property&gt;
                          &lt;/properties&gt;
                      &lt;/database&gt;
  
                      &lt;target&gt;
                          &lt;packageName&gt;com.yaswanth.domain.entity.jooq&lt;/packageName&gt;
                          &lt;directory&gt;target/generated-sources/jooq&lt;/directory&gt;
                      &lt;/target&gt;
                  &lt;/generator&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>The plugin fails with ClassNotFoundException on the entities. This is the stack trace.</p>
  
  <pre><code>Caused by: org.jooq.exception.DataAccessException: Error while exporting schema
      at org.jooq.util.jpa.JPADatabase.create0(JPADatabase.java:147)
      at org.jooq.util.AbstractDatabase.create(AbstractDatabase.java:221)
      at org.jooq.util.AbstractDatabase.create(AbstractDatabase.java:213)
      at org.jooq.util.AbstractDatabase.getDialect(AbstractDatabase.java:195)
      at org.jooq.util.AbstractGenerator.logDatabaseParameters(AbstractGenerator.java:129)
      at org.jooq.util.JavaGenerator.generate(JavaGenerator.java:243)
      at org.jooq.util.GenerationTool.run(GenerationTool.java:610)
      at org.jooq.util.GenerationTool.generate(GenerationTool.java:199)
      at org.jooq.util.maven.Plugin.execute(Plugin.java:188)
      ... 22 more
  Caused by: java.lang.ClassNotFoundException: com.walmartlabs.sc.domain.entity.ItemNames
      at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
      at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
      at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
      at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:264)
      at org.jooq.util.jpa.JPADatabase.create0(JPADatabase.java:135)
      ... 30 more
  </code></pre>
  
  <p>The domain module classes have already been generated but still the plugin says ClassNotFoundException. I am using jooq version 3.9.1. Can anyone tell me what am I doing wrong here?</p>
  
  <p>Update: Lukas Eder's answer is correct answer and accepted one. My own answer for this question worked for me because I had that specific version cached in the maven repo. My answer is wrong.</p>