2

I am trying to introduce MUnit unit tests to an existing Mule project which is using Maven for builds and dependency management.

However I am unable to run the tests visually through Mule Anypoint Studio, when I try to debug them I get the error:

MUnit test could not be run, The Archive C:/pathtomyuserfolder/.m2/commons-logging/1.2/commons-logging-1.2.jar which is referenced by the classpath, does not exist.

I can however run the test using Maven using the command "mvn test" but this is not ideal as I want to be able to debug the test, pausing at breakpoints etc.

I can reproduce this problem using the Mule Anypoint Exchange sample here: https://www.mulesoft.com/exchange/#!/munit-example. When I open this project I can debug the tests with no problems, but if I then right click on the project and select Maven Support In Studio -> Mavenize. I am then unable to debug the tests in Studio.

What am I doing wrong? Is this behavior supported?

Rob Bird
  • 3,764
  • 2
  • 28
  • 38
  • 1
    When you run Maven Support In Studio - Mavenize, there will be some information logged to the Console view. Look through it to see if you can find any errors. I have noticed at times that this output includes "BUILD SUCCEEDED" at the end, but that some errors actually did occur earlier. If you find any, please add them to the question. – Ryan Hoegg Nov 12 '15 at 03:52
  • Hi there, if the project is maven based and as you say it run ok. Could you please confirm that the missing jar is in the path that's being looked at? – Dds Nov 30 '15 at 11:51
  • Thanks for the comments guys, sorry to have wasted your time but I have now managed to get this fixed with the help of someone at work showing me where my build path was wrong. – Rob Bird Nov 30 '15 at 13:22

1 Answers1

1

This turned out to be a problem with the build path on my machine and nothing to do with MUnit.

The clue was in the actual error message above - that the path was missing the /repository folder under my /.m2 folder. I'm not sure how it happened by my M2_REPO was pointing to the wrong level.

The strange thing is that the two projects I tried would still actually run ok, so that's why I thought it was just a problem with MUnit. Sorry for the confusion and thanks to @Ryan and @Dds for your comments. I should have first tried to fix the problems highlighted in Mule Studio before posting.

Rob Bird
  • 3,764
  • 2
  • 28
  • 38