tags:

views:

71

answers:

4

I have a Maven build with three modules.

  • Module A exports a jar.
  • Module B depends on A and exports a jar.
  • Module C is a set of regression tests that depend on A and B.

The reason the regression tests aren't just part of module B is that they should be able to run against multiple versions of A and B to ensure backwards compatibility. I want to be able to run deploy from the top level build to create A.jar and B.jar, but not C.jar. Is this possible?

+1  A: 

Use below for module C:

<packaging>pom</packaging>
Taylor Leese
I tried that. Then I run mvn test from the top level, and C's tests don't run.
Craig P. Motlin
You may need to reorganize the heirarchy of your POM's. For example, you may need a super pom at the top and then C as a sub-module and then A and B as submodules under C.
Taylor Leese
A: 

The maven deploy plugin includes a skip options that prevents artifact deployment.

<plugin>
  <artifactId>maven-deploy-plugin</artifactId>
  <configuration>
      <skip>true</skip>
  </configuration>
</plugin>

You can try adding that to project C.

sal
A: 

Use a packaging of type pom for C and rebind all required plugins:

<project>
  ...
  <packaging>pom</packaging>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
          <execution>
            <id>test-compile</id>
            <phase>test-compile</phase>
            <goals>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>process-test-resources</id>
            <phase>process-test-resources</phase>
            <goals>
              <goal>testResources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <executions>
          <execution>
            <id>test</id>
            <phase>test</phase>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      ...
    </plugins>
    ...
  </build>
  ...
</project>
Pascal Thivent
A: 
<properties>
     <maven.deploy.skip>true</maven.deploy.skip>
</properties>
Craig P. Motlin