<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${deployment.dir}</outputDirectory>
<excludeArtifactIds>javaee-api</excludeArtifactIds>
</configuration>
</execution>
</executions>
</plugin>
Add the following plugin to your pom to copy Resources :
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${deployment.dir}</outputDirectory>
<resources>
<resource>
<directory>target</directory>
<filtering>true</filtering>
<includes>
<include>*.jar</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
You can then simply run the Project and have the needed libraries in your deployment location.
But remember to define the properties for addressing the target library. In this example :
<properties>
<glassfish.home>/opt/programs/glassfish</glassfish.home>
<deployment.dir>${glassfish.home}/glassfish/domains/my-domain/lib</deployment.dir>
</properties>