Gradle 创建Web项目
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 << { }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。