java - maven copy a particular dependency jar to a specific directory in the .war file -
i trying out simple java web start project based on oracle tutorial. using maven package webapp , deploy application server. full source code available here
https://github.com/kiranmohan/dynamic-tree-javaws-sample-project
the maven project structure like
parent |--lib |--webapp
the webapp module maven war module. required package lib.jar @ root of webapp.war. not under web-inf/lib.
how achieve in maven?
i found right way use maven-dependency-plugin. since "lib.jar" not used in compile phase of "webapp" module, package time dependency. using maven-dependency-plugin, can copy lib.jar required directory during prepare-package phase. maven-war package include lib.jar in .war package.
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-dependency-plugin</artifactid> <executions> <execution> <id>copy</id> <phase>prepare-package</phase> <goals> <goal>copy</goal> </goals> <configuration> <artifactitems> <artifactitem> <groupid>[ group id ]</groupid> <artifactid>[artifact id]</artifactid> <version>[ version ]</version> <outputdirectory>${project.build.directory}/${project.artifactid}</outputdirectory> </artifactitem> </artifactitems> <!-- other configurations here --> </configuration> </execution> </executions> </plugin>
update: there webstart-maven-plugin better job of packaging javaws applications. see sample project
https://github.com/kiranmohan/dynamic-tree-javaws-sample-project
details
Comments
Post a Comment