0

I've used maven-one-jar plugin , exported runnable jars and used them.
Can I export a test-one-jar containing the junit test classes along with the other dependencies using this plugin?

What changes should I make in the pom(.xml) configuration?

user2537987
  • 31
  • 1
  • 4
  • Why do you need a test-jar with all dependencies? Integration tests? – khmarbaise Jul 01 '13 at 19:50
  • @khmarbaise: I want to run the test suite from terminal and with cron.I also have a test runner class(with a main method) that I want to use as the main class. – user2537987 Jul 02 '13 at 04:50
  • Usually unit tests will run during the build and not via cron. This is usually done by a CI environment like Jenkins, Hudson, Travis-Ci or TeamCity etc. Furthermore it sounds more and more like integration tests. – khmarbaise Jul 02 '13 at 07:10

1 Answers1

0

The best solution to create a test-jar is simply using the maven-jar-plugin like this:

<project>
  ...
  <build>
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      ...
    </plugins>
  </build>
  ...
</project>
khmarbaise
  • 92,914
  • 28
  • 189
  • 235