How can I force maven to use my mock version of dependencies during the test phase.
- by Jayd16
Hi, so I have a Java application with a that accesses some web services. I want to mock out the appropriate classes so I can just use a few hard coded request/responses and I want maven to seamlessly use them during the tests and ignore them during the final build.
I want maven2 to:
1)compile my mock classes
2)compile the main classes that depend on the mocked code
3)run tests
4)recompile any main classes with the real dependencies, not my mocks
5)finish up the maven install
Ideally I want to just name my mock classes the same as my main class and just keep them in src/test/mocks or something. I'm kind of new to maven and so far it looks like maven will only compile the src/main and then src/test but I'm hoping I can have my way. Any ideas?