zoukankan      html  css  js  c++  java
  • Web项目构建

    Gradle为Web开发提供了两个插件,war和jetty

    apply plugin: 'war'
    
    
    apply plugin: 'jetty'

    war插件继承了java插件,jetty插件继承了war插件

    war插件用于打war包

    jetty作为工程部署的容器

    web项目的基本配置

    group 'org.zln.learning'
    version '1.0-SNAPSHOT'
    
    apply plugin: 'maven'
    apply plugin: 'jetty'
    
    sourceCompatibility = 1.8
    
    repositories {
        mavenLocal()
        mavenCentral()
    }
    
    dependencies {
        testCompile 'junit:junit:4.12'
    }
    
    
    uploadArchives {
        repositories {
            mavenDeployer {
                repository(url: "file:/Users/sherry/WorkPath/maven/repository/")
            }
        }
    }

    依赖的jar的生命周期是不一样的

    compile:编译时

    testCompile:测试时

    runtime:运行时,如jstl。打war时会成为war的一部分

    providedCompile:编译时需要,但是运行时不需要。如 servlet-api,一般由容器提供。被标记为provide的依赖不会被打到war包中

    web应用的源代码目录

    webAppDirName=src/main/webapp

    定制jetty插件

    jettyRun{
      httpPort=9000
      contextPath='webName'
    }
  • 相关阅读:
    jquery mobile
    可能用到的负边距应用
    兼容性问题
    less和scss
    函数的继承
    关于canvas
    html5表单属性
    html代码
    git 拉取远程分支 --本地分支不存在
    git 删除分支
  • 原文地址:https://www.cnblogs.com/sherrykid/p/5928036.html
Copyright © 2011-2022 走看看