Maven 2 multi mod pom

I recently started migrating my project from ant to maven. I have two modules in my application that I can build with maven.

Now I have an automated test project that uses the Web Driver to test the functionality of the user interface. What I'm trying to do with maven is build modular wars and deploy them to tomcat. Then run automation tests with them and pass the assembly if the automation test passes. I configured my pom like this (just mention the important part):

<packaging>pom</packaging>
<modules>
        <module>../module1</module>
        <module>../module2</module>
</modules>

Now both projects are assembled and deployed, but do not run automation tests. The reason I thought was because the type of packaging is POM. But if I change him to war, he will start throwing a mistake.

I can think of creating a third pom for automation and a parent pom to enable this as a module. But I think whether this is correct. This should be a very common scenario, and maven should support it directly.

+3
source share
3 answers

(...) - WebDriver . -, . tomcat load maven. - , " " , tomcat . ant, maven

( ). , ( , ).

, :

.
├── functests
│   ├── pom.xml            // here we configure maven to run cargo & it tests
│   └── src
│       └── it
│           ├── java
│           │   └── ...    // functional tests will go here
│           └── resources
├── pom.xml                // aggregating pom
└── mywebapp               // the application under test
    ├── pom.xml
    └── src
        ├── main
        │   ├── java
        │   ├── resources
        │   └── webapp
        └── test
            ├── java
            └── resources

pom Maven, Cargo Selenium, .

+4

, 2 - .

Hudson.

  • Hudson pom, , .
  • .

profiles , , .

Hudson .
Hudson maven, maven site, ..
"" SCM , .

+1

" "
POM? / POM.

, maven: http://docs.codehaus.org/display/MAVENUSER/Maven+and+Integration+Testing

Edit: , . , :

myWebApp/
    pom.xml
    myWebApp-web/
        pom.xml
    myWebApp-integration-tests/
        pom.xml

/myWebApp/pom.xml

<packaging>pom</packaging>
<modules>
    <!-- packaging: war; here are the sources and unit tests -->
    <module>myWebApp-web</module>

    <!-- packaging: java; here are the integration tests -->
    <module>myWebApp-integration-tests</module>
</modules>

/myWebApp/mvn deploy :

  • ( , )
  • myWebApp-web
  • myWebApp-web ( /myWebApp/myWebApp-web/pom.xml)
  • myWebApp-

, .

0

Source: https://habr.com/ru/post/1768376/


All Articles