aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Problems with Multi Module project 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 "Problems with Multi Module project" Watch "Problems with Multi Module project" New topic
Author

Problems with Multi Module project

Matt Kurz
Ranch Hand

Joined: Jan 02, 2010
Posts: 40
Hello.

Given is a multi module project. I could run mvn test from the base dir or one of it's sub projects. Everything was fine. Now I wrote a unit test which starts a servlet like container and some first tests. I started mvn test from the sub project. Now I run mvn test from the base dir and got errors. After some exploration with several code and mvn clean/ mvn test iterations from both dirs, it's seem's as mvn test behaves different, dependend on where I start it. Sometimes it causes an error in the subdir, but in the base dir not, sometimes the other way arround. What could be the reason? Do you have hints to investigate this?

Best regards.
mattk1
Matt Kurz
Ranch Hand

Joined: Jan 02, 2010
Posts: 40
Found out, that some Modules are not loaded if I run mvn test in the basedir, but don't know why. Here are some more observations: I run the following from the basedir of the Multi Module project:
mvn clean package -> all ok
mvn clean install -> all ok
mvn clean test -> error

I'am wondering about this, because install and package come after test in the maven lifecycle, so the test run in these cases, too. But they cause no error. What could be the reason? What can I do to investigate this? Already run the stuff with -X, but difficult to see the relevant part?
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2448
    
  28

When you say "Some modules not loaded", what do you mean? loaded where? Do you mean some modules are not built? or do you mean some modules aren;t able to find other module artifacts while running the test

What's your exact error?
Matt Kurz
Ranch Hand

Joined: Jan 02, 2010
Posts: 40
Thank you for your attention. (-:
Jayesh A Lalwani wrote:When you say "Some modules not loaded", what do you mean? loaded where? Do you mean some modules are not built? or do you mean some modules aren;t able to find other module artifacts while running the test

What's your exact error?


It's a Tapestry app. I've added a test in a sub project, which uses PageTester, which starts a servlet like container. When it starts it normally should search in the Manifest files for entries which match a name convention. A match is a class which ends with "Module". Which Module-classes are found depends on how and where I start mvn, like I already described.

To be complete: The Module-classes start services. The error messages says, that some of them are missing. It's because the Module classes are not loaded.

Maybe I have to investigate the machanism how moduls are found in detail, and it has to do with the servlet like functionality. Or maybe it has to do with mvn. I'am unsure about what to investigate next. It's strange that mvn install works and mvn test not.
Matt Kurz
Ranch Hand

Joined: Jan 02, 2010
Posts: 40
The Manifest files are not available during mvn test. So the question is how I make them available during mvn test, considering that some of the sub projects use the surefire plugin.

Another hint is, that some of the modules are loaded when I run mvn test, although there is no jar and therefore no Manifest.

It's still unclear why mvn install or package runs ok, although test comes before in the maven build lifecycle.
Matt Kurz
Ranch Hand

Joined: Jan 02, 2010
Posts: 40
Found a perfect solution. The container offers the posibility to add Modules explicit.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems with Multi Module project