This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi I am converting a build procedure from ant to maven and have a set of junittest the exercise a mysql database via a hibernate layer.
The tests are set up to run via the surefire plugin.
When I run I get errors during my hibernate session factory setup (which runs out of a @Before method). I resolved the errors by adding antlr-runtime and javaassist artifacts to my dependency tree. This , however , puzzles me to no end as already have hibernate-core on my list of dependencies.
By my way of thinking I should not have had to add the secondary dependencies; in fact, our whole motivation for moving to maven is to eliminate these kinds of problems .
No solution for you offhand, but here is what you can do to get to the root cause of this issue. I've done this quite often...
First, run the Maven build you currently have passing the -X option. This will generate a lot of output so you should redirect stdout and stderr to a file. Among the information available will be the classpath built for running the unit tests. And actually, you can see that same classpath by examining the manifest in the JAR file located in the target/surefire directory.
Now do the same thing with your prior pom.xml. What you are looking for is things that are different. That should bring something to mind which will lead to a solution.