Make maven fail safe pluing to run test from included jar

250 Views Asked by At

I have a test code deployed to antifactory Based on this Guide to using attached tests I want to invoke that test from plugin

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>

The test code is included as part of dependency

<dependency>
  <groupId>org.myproject</groupId>
  <artifactId>tests</artifactId>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>org.myproject</groupId>
  <artifactId>tests</artifactId>
  <type>test-jar</test>
  <scope>test</scope>
</dependency>

maven failsafe plugin

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.22.2</version>
    <scope>test</scope>
    <configuration>
      <dependenciesToScan> 
        <dependency>org.myproject:tests</dependency>
      </dependenciesToScan>
    </configuration>
    <executions>
      <execution>
        <goals>
           <goal>integration-test</goal>
           <goal>verify</goal>
        </goals>
      </execution>
    </executions>
</plugin>

I am trying to invoke mvn command as

mvn clean verify -Dit.test=com.myproject.TestRunner

I am getting the error as

integration-test: (default) on project testproject: No test where executed!

Now how do I make the maven-failsafe-plugin to call the class inside the dependency jar

--- EDIT ---

as a workaround I unzip the jar from .m2 folder to the local folder path target/test-classess then it picks up the compiled code .class files and testing is working

0

There are 0 best solutions below