zoukankan      html  css  js  c++  java
  • maven学习笔记(定制一个Web项目)

    创建web项目

    mvn archetype:generate -DgroupId=cn.net.comsys.ut4.simpleweb -DartifactId=simple-web -DpackageName=cn.net.comsys.ut4.simpleweb -Dversion=1.0 -DarchetypeArtifactId=maven-archetype-webapp  -DinteractiveMode=false
    

    向pom.xml添加jetty依赖

      <build>
        <finalName>simple-web</finalName>
    	<plugins>
    		<plugin>
    			<groupId>org.mortbay.jetty</groupId>
    			<artifactId>maven-jetty-plugin</artifactId>
    		</plugin>
    	</plugins>
      </build>
    

    jetty插件的run目标启动web项目

    mvn jetty:run
    

      

     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>cn.net.comsys.ut4.simpleweb</groupId>
      <artifactId>simple-web</artifactId>
      <packaging>war</packaging>
      <version>1.0</version>
      <name>simple-web Maven Webapp</name>
      <url>http://maven.apache.org</url>
      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
    	
    <dependency>
    	<groupId>org.mortbay.jetty</groupId>
    	<artifactId>jetty</artifactId>
    	<version>6.1.26</version>
    </dependency>
    
    
      </dependencies>
      <build>
        <finalName>simple-web</finalName>
    	<plugins>
    		<plugin>
    			<groupId>org.mortbay.jetty</groupId>
    			<artifactId>maven-jetty-plugin</artifactId>
    			<version>6.1.26</version>
    		</plugin>
    	</plugins>
      </build>
    </project>
    

    添加J2EE依赖:

    	<dependency>
    		<groupId>org.apache.geronimo.specs</groupId>
    		<artifactId>geronimo-servlet_3.0_spec</artifactId>
    		<version>1.0</version>
    	</dependency>
    
    mvn clean install
    mvn jetty:run
    

      

  • 相关阅读:
    jsonp与promise封装
    屏幕自适应问题与tab状态更新数据问题
    插槽问题
    如何封装一个组件
    在url中带参数
    vuex中mapGetters,mapActions
    eventBus 与 this.$emit
    4.24上交作业
    4.23作业
    4.17作业
  • 原文地址:https://www.cnblogs.com/jifeng/p/4786641.html
Copyright © 2011-2022 走看看