getgauge-contrib/gauge-maven-plugin

Classes from test source root are not being included in the generated jar

IgorJoin opened this issue · 3 comments

I have a Gauge project that doesn't have anything in the source root folder. All the code is in the test root folder (...\src\test\java...). When I run mvn clean install, the following configuration

<plugin> <groupId>com.thoughtworks.gauge.maven</groupId> <artifactId>gauge-maven-plugin</artifactId> <version>1.2.1</version> <executions> <execution> <phase>test</phase> <configuration> <specsDir>specs</specsDir> </configuration> <goals> <goal>execute</goal> </goals> </execution> </executions> </plugin>

is not putting the .class files inside the my project's jar file.

Is there any parameter or compilation command to make the plugin include the sources from the test source root ?

sriv commented

Please try mvn test-compile to compile the test classes.

Ref: https://stackoverflow.com/a/4796020/326543

That's not the point. The instruction mvn gauge:execute -DspecsDir=specs doesn't find the step implementations because the project's generated jar doesn't have any .class, since it will only have .class of the source dir (src\main\java...). I generated another jar using maven-jar-plugin, but apparently mvn gauge:execute only searches inside the first jar.

Here's the pom.xml that generates two jar files when issuing mvn clean install:

<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.6</version> <!--<configuration>--> <!--<includes>--> <!--<include>**/specs/*</include>--> <!--</includes>--> <!--</configuration>--> <executions> <execution> <goals> <goal>test-jar</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>com.thoughtworks.gauge.maven</groupId> <artifactId>gauge-maven-plugin</artifactId> <version>1.2.1</version> <executions> <execution> <phase>test</phase> <configuration> <specsDir>specs</specsDir> </configuration> <goals> <goal>execute</goal> </goals> </execution> </executions> </plugin> </plugins> </build>

Well, actually I'm not sure if it doesn't find the step implementation because of the generated jars..