Announcement Announcement Module
Collapse
No announcement yet.
mvn test configuration, spring context in subprojects Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    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

    Comment

    Working...
    X