On 07 Apr 2010, at 6:56 PM, Lorenzo Thurman wrote:

I've looked at a couple of the docs at the website, "Getting started in 5 minutes" and "Getting started in 10 minutes", but I'd like to find something a bit more comprehensive. For example, I was trying to build and test a simple project with only two files, MathFunctions.java and MathFunctionsTests.java. The compile ran just fine, but the unit tests were not run. I eventually figured out that my unit tests source needed to match the name of the code source with the word Test appended to the name, so after renaming my unit test file to MathFunctionsTest.java, it ran just fine. I'm sure something simple like this is documented somewhere, I just don't know where. Mind you, I'm still fairly new to Java programming and environments such as Maven, so I think I'm going to need some hand holding, so if such a naming convention is considered standard, I was unaware.

The general pattern by which maven works is that anything that maven can do, is done with a plugin, so the question you typically find yourself asking is "which plugin does X for me?".

In the case of the compile, the maven-compile-plugin does the job for you out the box with default values, which is why it "just worked".

In the case of running tests, the maven-surefire-plugin does the job for you, and it by default will run any test that matches a standard naming convention. You needed to figure out what that naming convention before it would work.

Once you know the name of the plugin that does what you need, the next step is to find the documentation for it, and usually a google for "maven foo plugin" will do the trick.

What you're encouraged to do is stick with default conventional behaviour wherever you can. In other words, if maven wants you to name a file a certain way, or look for a file in a certain directory, stick to the defaults. If you do, most stuff should just work without any modification.

Regards,
Graham
--


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to