Distributed build with maven?

We currently have a maven project with several thousand tests that take two hours to complete. We tried to run them in parallel, but since they are functional tests, each test tunes the system in a specific way, leading to race conditions and random crashes. What I would like to do is spin up N servers on AWS and then maven split my tests and run them on those servers (each server will run its tests sequentially, but all servers will run in parallel) and then aggregate the results. is there any plugin that does something like this? I've seen something close to what I want to implement in Jenkins, but I'd prefer it to be maven managed, so developers can use it locally without having Jenkins installed.

+3


source to share


1 answer


I don't know of a plugin that does all of this out of the box, but I believe the job can be done.

I found myself using the iterator plugin when I need to split the work. Examples are here: http://khmarbaise.github.io/iterator-maven-plugin/



For the actual loading and execution, it might be one sentence to use the ant plugin to loop through the project and then use sshexec to execute it.

   <build>
    ...
    <plugins>
    ...
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <configuration>
          <tasks>
            <scp todir="${scp.user}:${scp.password}@${scp.host}:/${scp.dirCopyTo}" trust="true" failonerror="false">
              <fileset dir="${bundle.dir}" />
            </scp>
            <sshexec host="${scp.host}"
                username="${scp.user}"
                keyfile="${user.home}/.ssh/id_dsa"
                command="touch somefile"/>
          </tasks>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>ant</groupId>
            <artifactId>ant-jsch</artifactId>
            <version>1.6.5</version>
          </dependency>
          <dependency>
            <groupId>com.jcraft</groupId>
            <artifactId>jsch</artifactId>
            <version>0.1.42</version>
          </dependency>
        </dependencies>
      </plugin>
...

      

0


source







All Articles