Results 1 to 2 of 2

Thread: mvn test configuration, spring context in subprojects

  1. #1
    Join Date
    May 2010
    Posts
    5

    Question mvn test configuration, spring context in subprojects

    Hi,

    I create a simple maven example with two subprojects.
    \moduleA\pom.xml
    \moduleA\src\main\java\ca\spring\test\SomeBean.jav a
    \moduleA\src\main\java\ca\spring\test\SomeBeanImpl .java
    \moduleA\src\main\resources\log4j.properties
    \moduleA\src\main\resources\moduleA-config.xml

    \moduleB\pom.xml
    \moduleB\.project
    \moduleB\src\main\resources\log4j.properties
    \moduleB\src\main\resources\moduleB-config.xml
    \moduleB\src\test\java\ca\spring\test\SomeBeanTest .java
    \moduleB\src\test\resources\log4j.properties
    \moduleB\src\test\resources\system-test-config.xml

    \pom.xml -> parrent pom

    My moduleB depends of moduleA.
    SomeBeanTest.java try to find “someBean” declaration and for that it use system-test-config.xml which reference moduleB-config.xml where I import moduleA-config.xml.

    When I execute my test in Eclipse, the test runs fine, but when I execute it in cmd, my test fail simply because he can’t find moduleA-config.xml even if I install my modules first (mvn install).

    Any help will be appreciated deeply!

    Regards,
    Ivat
    Attached Files Attached Files

  2. #2
    Join Date
    May 2010
    Posts
    5

    Default

    Solved!

    Adding a dependency to junit in my parent pom solved my problem:
    <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.7</version>
    <scope>test</scope>
    </dependency>

    In fact, without this dependency, all my annotations (like @Test, @Configuration …) are ignored when we execute “mvn test” in command line.

    Regards,
    Ivat

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •