web普通项目映射为maven项目

<build>
        <!-- 发布名 www.locathost:80/HelloWeb可以访问,如果改成ROOT那么 默认的tomcat也就能访问了 -->
<!--         以下用于映射路径 -->
        <finalName>yourWebLocation</finalName>

        <sourceDirectory>${basedir}/src</sourceDirectory>
        <outputDirectory>${basedir}/WebRoot/WEB-INF/classes</outputDirectory>
        <resources>
            <resource>
                <directory>${basedir}/src</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
        </resources>
      <!--配置以上 所需要的插件-->
        <plugins>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <webappDirectory>${basedir}/WebRoot</webappDirectory>
                    <warSourceDirectory>${basedir}/WebRoot</warSourceDirectory>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>

<!--                 用于映射路径所需要的 -->
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.2.3</version>
                <configuration>
                    <container>
                        <containerId>tomcat7x</containerId>
                        <home>D:\Program Files\Java\Apache Tomcat\apache-tomcat-7.0.37-windows-x86\apache-tomcat-7.0.37</home>
                    </container>
                    <configuration>
                        <type>existing</type>
                        <home>D:\Program Files\Java\Apache Tomcat\apache-tomcat-7.0.37-windows-x86\apache-tomcat-7.0.37</home>
                        <properties>
<!--                          端口 -->
                            <cargo.servlet.port>80</cargo.servlet.port>
                        </properties>
                    </configuration>
                </configuration>
                <executions>
                    <execution>
                        <id>cargo-run</id>
                        <phase>install</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

        </plugins>

    </build>

你可能感兴趣的:(web普通项目映射为maven项目)