This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven-execute java main class before test phase Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven-execute java main class before test phase" Watch "Maven-execute java main class before test phase" New topic
Author

Maven-execute java main class before test phase

Raghavendra K Chunduri
Greenhorn

Joined: Oct 24, 2011
Posts: 2
I want to execute a java class before my unit tests run in the project.Is there any way to do this ?

executing java main class in pre-integration-phase is not executing my java class before the maven test phase.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

What plugin are you using to run the Java class? The Exec plugin? Could you post your plugin description from the pom.xml?

Also, you could try running with the -X option. The plugin should give you more information about what it is doing. And -X also caused Maven to dump the build plan, make sure your plugin's execution appears in the build plan.

Finally, if you want you class to run before unit tests, you have to set the plugin to run during the test-compile phase; that's the phase immediately before the test phase which is when the unit tests run.


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maven-execute java main class before test phase