Maven : Copy Dependencies in Target Folder

How do I get my project’s runtime dependencies copied into the target/lib folder?

Copy below XML code into pom.xml

<project>
  ...
  <profiles>
    <profile>
      <id>qa</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <phase>install</phase>
                <goals>
                  <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}/lib</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>

Run mvn install command on shell
maven

Now Run copy denpendencies command
mvn install dependency:copy-dependencies

copydependencies

That’s it you re done!!