Monday, December 1, 2008

maven: copy libraries to classpath

การเพิ่มคำสั่งให้ maven copy library ที่ dependencies ไปยัง target path ที่ทำการ package .jar ของเราเอาไว้
ตัวอย่าง แ้ก้ไขที่ pom.xml เพิ่ม plug-in ที่ช่วย copy library ไปยัง targetpath
.......
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNever>true</overWriteIfNever>
</configuration>
</execution>
</executions>
</plugin>
.......

No comments: