To add test resources, you’ll need to create the src/test/resources directory. Given the lifecycle phases above, this means that when the default lifecycle is used, Maven will first validate the project, then will try to compile the sources, run those against the tests, package the binaries (e.g. A resource is a file in the class path folder structure for your project. The difference is that the main resources are the resources associated to the main source code while the test resources are associated to the test source code. Test reports are available in … This is important because your test resources will be put in your test-classes folder hierarchy and your main resources will be put in your classes folder hierarchy - both in your target folder. In this tutorial, we'll show how to read the … Maven has a standard directory layout. Or, we may have a file in src/test/resources with data for stubs that could be used by libraries like WireMock. Sometimes during unit testing, we might need to read some file from the classpath or pass a file to an object under test. To create this directory execute the following commands from your project’s base directory. Project |-- pom.xml `-- src `-- main `-- resources . Plugin Testing; Plugin Tools; Resource Bundles; SCM; Shared Components; Skins; Surefire; Wagon; ASF; How Apache Works; Foundation; Sponsoring Apache; Thanks; Follow ASFMavenProject. By default, Maven will look for your project's resources under src/main/resources. Packaged jar is available in consumerBanking\target folder as consumerBanking-1.0-SNAPSHOT.jar. How to Create a Resource Folder Structure. $ cd src/test $ mkdir resources $ cd resources. Having a common directory layout would allow for users familiar with one Maven project to immediately feel at home in another Maven project. For instance, starting in Maven 2.2.0, you have the option of configuring executions with the id's default-resources and default-testResources to supply different configurations for the two different types of resources. We give maven two goals, first to clean the target directory (clean) and then package the project build output as jar (package). The next section documents the directory layout expected by Maven and the directory layout created by Maven. The Resources Plugin handles the copying of project resources to the output directory. There are two different kinds of resources: main resources and test resources. Introduction to the Standard Directory Layout. Specifying resource directories. The advantages are analogous to adopting a site-wide look-and-feel. This is the default directory in which Maven looks for unit test resources.