Announcement Announcement Module
No announcement yet.
roo: problem with junit tests after adding an entity Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • roo: problem with junit tests after adding an entity

    Hi there

    I used the roo 1.1.2 in STS 2.6.0.
    When I added a new entity and run again the tests if failed to see the applicationContext.xml
    the message I got is:
    Caused by: class path resource [META-INF/spring/applicationContext.xml] cannot be opened because it does not exist

    However the applicationContext.xml does exist in src/main/resources

    I coped the contents of this folder in the src/test/resources and it did see the applicationContext.xml the first time but after the second run I had the same problem.

    Today I updated in STS 2.6.0 SR1 with roo 1.1.3.
    Everything was alright, the tests run normally.
    When I added a new relationship, I had the same problem.

    I am new to roo. Is it a bug or do I do something wrong?

  • #2
    if you use STS, only in menu Project > Clean and rebuild the project and run again.
    It's a litle problem in the IDE


    • #3
      roo: problem with junit tests after adding an entity

      Thank you for your reply.
      It works.


      • #4
        Sorry for the late bump, but do you know if there is a JIRA for this issue? I run into this all the time, and it gets extremely annoying. I'm always Project->Cleaning and Server Cleaning, and tc Server Work Directory Cleaning...just so I can make sure the next run will work.


        • #5
          There could be several causes, but the most likely one is related to defaults when handling Maven resource directories. Not sure whether its STS or M2 eclipse doing it.

          If you check your Java Build Path, you'll see 4 source folders, however the src/main/resources and src/test/resources will have exclude ** set. That prevents eclipse from copying those files to the output directories if you change them in the IDE.

          Removing the exclusions usually solves that.


          • #6
            Hey thanks for the response. I've done that before, but removing those exclusions generally causes other problems with my build. Specifically, I normally have property file filtering enabled to use different settings for different levels of deployment. For instance:

            db.username = ${db.username}
            Then I will define the actual value some place like src/main/filters/ and src/main/filters/ What happens next is I get a recursive placeholder error. Then, I have to do the Project->Clean raindance a few times to get the build to work. Damned if I do. Damned if I don't. (Granted, I could solve that by changing ${db.username} to something different like ${} but it seems like a hack. Given this behavior, it probably is M2Eclipse that's the culprit.