zoukankan      html  css  js  c++  java
  • eclipse web项目转maven项目

    ps:好久没写博客了,工作了人就懒了,加油加油,up,up

    1 eclipse web项目目录

    /web app

       src

           com.xx.xx

           *.properties

           *.xml

        WebRoot

            ​WEB-INF

        ​    ​    ​classes

        ​    ​    ​lib

        ​    ​    ​*.xml

        ​    ​index.jsp

    2 转为maven项目,添加pom.xml

    1) 创建maven web项目,把eclipse web文件拷贝到新的项目中

    2) 通过在项目上右键->转为maven项目,填写信息自动创建pom.xml

    3)直接在项目中创建pom.xml文件

    原始pom.xml文件:

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

      <modelVersion>4.0.0</modelVersion>

      <groupId>com.syx</groupId>

      <artifactId>web</artifactId>

      <packaging>war</packaging>

      <version>0.0.1-SNAPSHOT</version>

      <name>web Maven Webapp</name>

      <url>http://maven.apache.org</url>

      <dependencies>

      </dependencies>

      <build>

        <finalName>web</finalName>

      </build>

    </project>

    3 配置class输出目录和项目jar包依赖

      1)把项目的src目录配置/WebRoot/WEB-INF/classes目录下

      2)把项目的lib目录jar添加到classpath

    4 添加pom jetty插件和配置

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

      <modelVersion>4.0.0</modelVersion>

      <groupId>Maven Web</groupId>

      <artifactId>Maven Web</artifactId>

      <version>0.0.1-SNAPSHOT</version>

      <build>

        <plugins>

          <plugin>

            <groupId>org.mortbay.jetty</groupId>

            <artifactId>maven-jetty-plugin</artifactId>

            <version>6.1.15</version> 

            <configuration>

              <contextPath>/</contextPath>

              <webAppSourceDirectory>WebRoot</webAppSourceDirectory>  

              <scanIntervalSeconds>2</scanIntervalSeconds>

              <stopKey>foo</stopKey>

              <stopPort>9090</stopPort>

              <connectors>

                <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">

                  <port>8080</port>

                  <maxIdleTime>60000</maxIdleTime>

                </connector>

              </connectors>

            </configuration>

          </plugin>

          <plugin>

            <artifactId>maven-clean-plugin</artifactId>

            <configuration>

              <filesets>

                <fileset>

                  <directory>WebRoot/WEB-INF</directory>

                  <includes><include>classes</include></includes>

                  <followSymlinks>false</followSymlinks>

                </fileset>

              </filesets>

            </configuration>

          </plugin>

        </plugins>

      </build>

    </project>

  • 相关阅读:
    [flash]准备添加动态加载flash,防止浏览者下载
    [Question]如何将韩文数据存入到数据库中,并在数据库中正确显示
    [other]毕业一年同学聚会
    [Question]要建立这样一个网站,应该怎么建立架构?
    [other]配置了一台K8平台的电脑
    Internet Explorer 7 Beta, Summer 2005
    [程序]粗制烂造的第一个windows应用程序
    [method]how to learn a language
    [other]昨天坐公交车没有买票!?
    五一长假你快乐吗?
  • 原文地址:https://www.cnblogs.com/syxchina/p/3526770.html
Copyright © 2011-2022 走看看