ITeye博客

Maven定制部署到本地容器

juncke · 2012-12-19 17:15 · maven · 研发管理 · 项目管理 · maven · Deploy · 部署 · Markdown

Maven定制部署到本地容器

执行步骤:

  1. Maven先使用maven-dependency-plugin将依懒包copy到dependency目录。
  2. 用maven-antrun-plugin将package之后的目标文件和dependency目录下的文件copy到指定目录(如tomcat,jboss的deploy目录)。

注:根据需要替换deploy目录,我的是 d:/jboss/deploy

plugins配置

       <plugins>
            <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>
                            <includeScope>runtime</includeScope>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <phase>install</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <echo message="ant message echo" />
                                <echo
                                    message="packageName:${project.build.directory}\${project.build.finalName}.${project.packaging}" />
                                <copy todir="d:/jboss/deploy">
                                    <fileset dir="${project.build.directory}">
                                        <include name="${project.build.finalName}.${project.packaging}" />
                                    </fileset>
                                    <fileset dir="${project.build.directory}/dependency">
                                        <include name="*.jar" />
                                    </fileset>
                                </copy>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。