File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes maven surefire junit hibernate dependency issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "maven surefire junit hibernate dependency issue" Watch "maven surefire junit hibernate dependency issue" New topic

maven surefire junit hibernate dependency issue

Robert Hogan

Joined: Apr 09, 2007
Posts: 4
Hi I am converting a build procedure from ant to maven and have a set of junit test 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 .

Anyone ???

Peter Johnson

Joined: May 14, 2008
Posts: 5852

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.

JBoss In Action
I agree. Here's the link:
subject: maven surefire junit hibernate dependency issue
It's not a secret anymore!