H2 Trigger classes

Answered

While building a testing db using an embedded H2 database I have run into a problem executing DDL against the configured datasource. Namely, the Trigger classes under src/test declared in the DDL are not found. The best way to resolve this would be to add target/test-classes to the same classpath as the H2 jar. Is there a way to customize the Run to do this? Moving the Trigger classes to src/main (highly undesirable) doesn't seem to work either.

See: org.h2.util.JdbcUtils.loadUserClass

3 comments
Comment actions Permalink

>The best way to resolve this would be to add target/test-classes to the same classpath as the H2 jar. Is there a way to customize the Run to do this?

If you mean the IDE data source: for the process which runs the Data Source connection you can add additional libraries in the classpath in same settings were you add a jdbc driver jar - see Driver settings tab.

If you mean the data source which you create in your program: if you use Maven/Gradle you should configure corresponding pom.xml/guild.gradle files as for such projects IDE takes all the configuration (classpath, dependencies, compile parameters, project structure etc) from Mven/Gradle. If you do not use Maven/Gradle you can configure dependencies for the modules manually in IDE Project Structure settings for the module.

0
Comment actions Permalink

Driver settings allows you to add jars; is there a way to add a directory - that is, defining the CLASSPATH?

0
Comment actions Permalink

Only files can be specified there, not directories.

0

Please sign in to leave a comment.