I would like to include scripts files as part of packaging test files using maven. I ma using the below plugin configuration however config and jython files the files are not package in the test jar
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
<configuration>
<includes>
<include>**/config/*</include>
<include>**/jython/*</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
is there anyway to include the files which are not in src/test/java and src/test/resources in test-jar?
To include a resource, we only need to add an <includes> element. And to exclude a resource, we only need to add an <excludes> element. For example, if we want to include all text and RTF files under our src/my-resources directory and in all its subdirectories, we can do the following: <project>
You can produce a jar which will include your test classes and resources. To reuse this artifact in an other project, you must declare this dependency with type test-jar : <project>
pedr0: you should utilize the resources plugin in that case to manually include/exclude non java files copy.
plug-in is a software component that adds a specific feature to any computer program.It specially use to customize any computer program. But . jar file is a java executable file which can only run on an environment which Java installed.
Specify additional test resource folders using:
<build>
<testResources>
<testResource>
<directory>src/test</directory>
<includes>
<include>**/config/*</include>
<include>**/jython/*</include>
</includes>
</testResource>
</testResources>
</build>
You should then find that no config is required for the maven-jar-plugin.
The build-helper-maven-plugin may also be used. See: Maven - Add directory to classpath while executing tests
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With