zoukankan      html  css  js  c++  java
  • gradle基础的build文件模板_tomcat

    group '组织名'
    version '版本号'
    
    /* 支持的插件 */ apply plugin: 'java' // 项目基础变成语言支持为java apply plugin: 'war' // 可将项目打包成war形式运行 apply plugin: 'eclipse' // 支持ECLIPSE的导入和编辑 apply plugin: 'eclipse-wtp' // 支持ECLIPSE-WEB的导入和编辑 apply plugin: 'idea' // 支持IntelliJ IDEA直接导入和编辑 apply plugin: 'com.bmuschko.tomcat' // 使用tomcat作为服务器 sourceCompatibility = 1.6 // jdk版本 targetCompatibility = 1.6

    compileJava.options.encoding = 'UTF-8' // 使gradle支持中文字符,如果没有这段配置,代码中的中文字符将会出现无法编译性错误
    compileTestJava.options.encoding = 'UTF-8'
    sourceSets.main.output.classesDir = file("bin") // 为了配合eclipse而定义的文件结构 

    repositories {
      maven {
        url "http://maven.aliyun.com/nexus/content/groups/public/" // 这个仓库好,下载jar包的速度超级快
      }
      mavenLocal() // maven本地仓库
      mavenCentral() // maven远程仓库
      flatDir name: 'localRepository', dirs: 'lib'
    }

    // 综合版本控制 project.ext { springVersion = '4.3.2.RELEASE' /* 框架版本控制 */ aspectjVersion = '1.8.9' jacksonVersion = '2.8.4'
       tomcatVersion = '7.0.59' } dependencies { providedCompile ( // 为了eclipse能正常编译 'javax.servlet:servlet-api:3.0-alpha-1', 'tomcat:servlet:4.1.36', 'javax.servlet:jstl:1.1.2', 'taglibs:standard:1.1.2', /* JSP的扩展标记库 */
           'javax:javaee-api:6.0' ) compile ( 'com.google.guava:guava:20.0', 'org.springframework:spring-web:' + springVersion, 'org.springframework:spring-webmvc:' + springVersion, 'org.springframework:spring-aop:' + springVersion,
           'org.apache.tomcat.embed:tomcat-embed-core:' + tomcatVersion,
           'org.apache.tomcat.embed:tomcat-embed-logging-juli:' + tomcatVersion,
           'org.apache.tomcat.embed:tomcat-embed-jasper:' + tomcatVersion
      ) runtime ( 'org.slf4j:slf4j-log4j12:1.7.5', 'log4j:log4j:1.2.17' ) testCompile ( 'junit:junit:4.4', 'org.springframework:spring-test:' + springVersion ) } tomcat {
      httpPort = 8080
      httpsPort = 8090
      enableSSL = true
      contextPath = '自定义或设置为空(ROOT)'
    } task wrapper(type: Wrapper) { gradleVersion = '2.14.1' // gradle的版本选择,可自定义版本 }

    PS:另一个版本为以GRADLE为服务器配置,戳这里

  • 相关阅读:
    区别@ControllerAdvice 和@RestControllerAdvice
    Cannot determine embedded database driver class for database type NONE
    使用HttpClient 发送 GET、POST、PUT、Delete请求及文件上传
    Markdown语法笔记
    Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
    Mysql 查看连接数,状态 最大并发数(赞)
    OncePerRequestFilter的作用
    java连接MySql数据库 zeroDateTimeBehavior
    Intellij IDEA 安装lombok及使用详解
    ps -ef |grep xxx 输出的具体含义
  • 原文地址:https://www.cnblogs.com/SummerinShire/p/6211764.html
Copyright © 2011-2022 走看看