maven copy有不少種方法:html
1.maven-antrun-plugin (使用ant複製)web
<build> <finalName>flex</finalName> <sourceDirectory>src</sourceDirectory> <outputDirectory>../monitorweb/src/main/webapp/topoview</outputDirectory> <plugins> <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.7</version> <executions> <execution> <phase>validate</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <echo message="*****copy LocalConnectionSender.html and LocalConnectionSender.swf to ../monitorweb/src/main/webapp/topoview*****"/> <copy todir="../monitorweb/src/main/webapp/topoview" overwrite="true"> <fileset dir="src/assets/dragapp"/> </copy> </tasks> </configuration> </execution> </executions> </plugin> </plugins> </build>
2.maven-dependency-plugin apache
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>copy-installed</id> <phase>install</phase> <goals> <goal>copy</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>${project.groupId}</groupId> <artifactId>${project.artifactId}</artifactId> <version>${project.version}</version> <type>${project.packaging}</type> </artifactItem> </artifactItems> <outputDirectory>some-other-place</outputDirectory> </configuration> </execution> </executions> </plugin>
3.maven-jar-pluginapp
<project> ... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> ... <configuration> <archive> <manifest> <addClasspath>true</addClasspath> </manifest> </archive> </configuration> ... </plugin> </plugins> </build> ... <dependencies> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.1</version> </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-utils</artifactId> <version>1.1</version> </dependency> </dependencies> ... </project>
最後我使用了maven ant ,感受它控制的比較細,上手也比較快。webapp