码迷,mamicode.com
首页 > Web开发 > 详细

Gradle 创建Web项目

时间:2015-01-15 17:31:06      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:

apply plugin: ‘java‘
apply plugin: ‘war‘
apply plugin: ‘eclipse-wtp‘
apply plugin: ‘maven‘
 
def projectName = "finance-site"
version = ‘0.0.1-SNAPSHOT‘
sourceCompatibility = 1.7
webAppDirName = ‘WebContent‘  
[compileJava, javadoc, compileTestJava]*.options*.encoding = ‘UTF-8‘
 
//源码结构
sourceSets {
    main {
        java {
            srcDir ‘src/main/java‘
        }
        resources {
            srcDir ‘src/main/resources‘
        }
    }
}
  
 
//在线仓库
repositories {  
    maven { url ‘http://maven.oschina.net/content/groups/public/‘ } 
    mavenCentral() 
}
 
//项目依赖
dependencies {
    providedRuntime project(‘:core-service-interface‘) 
    providedCompile ‘javax.servlet:servlet-api:2.5‘
    providedRuntime ‘javax.servlet:jstl:1.2‘ 
    providedRuntime ‘org.freemarker:freemarker:2.3+‘
    providedRuntime ‘commons-fileupload:commons-fileupload:1.2.2‘
    providedRuntime ‘org.springframework:spring-webmvc:3.2.4.RELEASE‘
    providedRuntime "org.springframework:spring-web:3.2.4.RELEASE"
    providedRuntime ‘org.springframework:spring-context-support:3.2.4.RELEASE‘ 
    testCompile(‘junit:junit:4.7‘)
}
 
 
//eclipse 配置
eclipse {
    wtp {
        contextPath = "WebContent"
        deployName = "finance"
        component {
            resource sourcePath: ‘src/main/java‘, deployPath: ‘/WEB-INF/classes‘
            resource sourcePath: ‘WebContent‘, deployPath: ‘/‘
            resource sourcePath: ‘/remote‘, deployPath: ‘/WEB-INF/classes‘
        }
    }
}
 
uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: "http://192.168.2.167:8888/nexus/content/repositories/snapshots/") {
                authentication(userName: "admin", password: "admin123")
                pom.groupId = "com.ff"
                pom.version = version
                pom.artifactId = projectName
            }
        }
    }
}
build.dependsOn uploadArchives
 
/*-----------发布编码 --------------- */
task publishCode << {
    /*copy {
        from 
        into 
    } */
}
/*-----------发布测试 --------------- */
task publishTest << {
}
/*-----------发布线上 --------------- */
task publishOnline << {
}

 

Gradle 创建Web项目

标签:

原文地址:http://www.cnblogs.com/jinxue0302/p/4226498.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!