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>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值