11apply plugin : ' java'
2- apply plugin : ' maven '
2+ apply plugin : ' war '
33apply plugin : ' jetty'
4+ apply plugin : ' checkstyle'
5+ apply plugin : ' jacoco'
6+ apply plugin : ' idea'
47
58group = ' cn.edu.uestc.acmicpc'
69version = ' 2.0'
@@ -10,62 +13,170 @@ description = """UESTC Online Judge"""
1013sourceCompatibility = 1.7
1114targetCompatibility = 1.7
1215
16+ [jettyRunWar, jettyRun]* . contextPath = ' /'
17+ project. stopPort = 8005
18+ project. stopKey = ' stop'
19+
20+ task checkControllerDoNotContainDaos (type : Exec ) {
21+ commandLine " python" , " src/test/python/check_controller_not_contain_daos.py"
22+ }
23+
24+ task checkDtosDoNotContainEntities (type : Exec ) {
25+ commandLine " python" , " src/test/python/check_dtos_not_contain_entities.py"
26+ }
27+
28+ task checkTestingCodeAllDoNotUseJunit (type : Exec ) {
29+ commandLine " python" , " src/test/python/check_testing_code_all_not_use_junit.py"
30+ }
31+
32+ task createSchema (type : Exec ) {
33+ if (dbPassword == " " ) {
34+ commandLine " mysql" , " -u$dbUser "
35+ } else {
36+ commandLine " mysql" , " -u$dbUser " , " -p$dbPassword "
37+ }
38+ standardInput = new FileInputStream (new File (" src/test/sql/uestcojtest.sql" ))
39+ }
40+
41+ task generateData (type : Exec ) {
42+ if (dbPassword == " " ) {
43+ commandLine " mysql" , " -u$dbUser "
44+ } else {
45+ commandLine " mysql" , " -u$dbUser " , " -p$dbPassword "
46+ }
47+ standardInput = new FileInputStream (new File (" src/test/sql/uestcojtest-data0.sql" ))
48+ }
49+
50+ task generateMainPropertyFile (type : Exec ) {
51+ commandLine " bash" , " scripts/configure_project.sh" ,
52+ " src/main/resources/resources.properties.template" ,
53+ " src/main/resources/resources.properties" ,
54+ " $dbUser " , " $dbPassword "
55+ }
56+
57+ task generateTestPropertyFile (type : Exec ) {
58+ commandLine " bash" , " scripts/configure_project.sh" ,
59+ " src/test/resources/resources.properties.template" ,
60+ " src/test/resources/resources.properties" ,
61+ " $dbUser " , " $dbPassword "
62+ }
63+
64+ task cleanResources << {
65+ delete " src/main/resources/resources.properties"
66+ delete " src/test/resources/resources.properties"
67+ }
68+
69+ compileJava. dependsOn(checkControllerDoNotContainDaos)
70+ compileJava. dependsOn(checkDtosDoNotContainEntities)
71+ compileJava. dependsOn(checkTestingCodeAllDoNotUseJunit)
72+ compileJava. dependsOn(createSchema)
73+ compileJava. dependsOn(generateData)
74+ generateData. dependsOn(createSchema)
75+ compileJava. dependsOn(generateMainPropertyFile)
76+ compileJava. dependsOn(generateTestPropertyFile)
77+ clean. dependsOn(cleanResources)
78+
79+ configurations {
80+ provided
81+ }
82+
83+ sourceSets {
84+ main. compileClasspath + = configurations. provided
85+ test. compileClasspath + = configurations. provided
86+ test. runtimeClasspath + = configurations. provided
87+ }
88+
1389repositories {
1490 mavenCentral();
1591}
1692
1793dependencies {
18- compile group : ' org.ow2.asm' , name : ' asm' , version :' 4.1'
19- compile group : ' org.ow2.asm' , name : ' asm-tree' , version :' 4.1'
20- compile group : ' org.ow2.asm' , name : ' asm-analysis' , version :' 4.1'
21- compile group : ' org.ow2.asm' , name : ' asm-util' , version :' 4.1'
22- compile group : ' org.springframework' , name : ' spring-core' , version :' 4.0.0.RELEASE'
23- compile group : ' org.springframework' , name : ' spring-expression' , version :' 4.0.0.RELEASE'
24- compile group : ' org.springframework' , name : ' spring-beans' , version :' 4.0.0.RELEASE'
25- compile group : ' org.springframework' , name : ' spring-aop' , version :' 4.0.0.RELEASE'
26- compile group : ' org.springframework' , name : ' spring-context' , version :' 4.0.0.RELEASE'
27- compile group : ' org.springframework' , name : ' spring-context-support' , version :' 4.0.0.RELEASE'
28- compile group : ' org.springframework' , name : ' spring-tx' , version :' 4.0.0.RELEASE'
29- compile group : ' org.springframework' , name : ' spring-jdbc' , version :' 4.0.0.RELEASE'
30- compile group : ' org.springframework' , name : ' spring-orm' , version :' 4.0.0.RELEASE'
31- compile group : ' org.springframework' , name : ' spring-oxm' , version :' 4.0.0.RELEASE'
32- compile group : ' org.springframework' , name : ' spring-web' , version :' 4.0.0.RELEASE'
33- compile group : ' org.springframework' , name : ' spring-webmvc' , version :' 4.0.0.RELEASE'
34- compile group : ' org.springframework' , name : ' spring-webmvc-portlet' , version :' 4.0.0.RELEASE'
35- compile group : ' cglib' , name : ' cglib' , version :' 2.2.2'
36- compile group : ' aopalliance' , name : ' aopalliance' , version :' 1.0'
37- compile group : ' org.eclipse.jetty' , name : ' jetty-server' , version :' 9.1.0.M0'
38- compile group : ' org.eclipse.jetty' , name : ' jetty-servlet' , version :' 9.1.0.M0'
39- compile group : ' org.eclipse.jetty' , name : ' jetty-webapp' , version :' 9.1.0.M0'
40- compile group : ' org.eclipse.jetty' , name : ' jetty-servlets' , version :' 9.1.0.M0'
41- compile group : ' org.eclipse.jetty' , name : ' jetty-jsp' , version :' 9.1.0.M0'
42- compile group : ' org.eclipse.jetty' , name : ' jetty-util' , version :' 9.1.0.M0'
43- compile group : ' javax.servlet' , name : ' jstl' , version :' 1.2'
44- compile group : ' opensymphony' , name : ' sitemesh' , version :' 2.4.2'
45- compile group : ' org.hibernate' , name : ' hibernate-validator' , version :' 4.2.0.Final'
46- compile group : ' org.hibernate' , name : ' hibernate-core' , version :' 4.3.0.Final'
47- compile group : ' mysql' , name : ' mysql-connector-java' , version :' 5.1.22'
48- compile group : ' com.jolbox' , name : ' bonecp' , version :' 0.8.0-rc1'
49- compile group : ' org.aspectj' , name : ' aspectjweaver' , version :' 1.7.1'
50- compile group : ' org.aspectj' , name : ' aspectjrt' , version :' 1.7.1'
51- compile group : ' com.alibaba' , name : ' fastjson' , version :' 1.1.38'
52- compile group : ' log4j' , name : ' log4j' , version :' 1.2.17'
53- compile group : ' org.slf4j' , name : ' slf4j-log4j12' , version :' 1.7.5'
54- compile group : ' javax.servlet' , name : ' jsp-api' , version :' 2.0'
55- compile group : ' net.sourceforge.jexcelapi' , name : ' jxl' , version :' 2.6.12'
56- compile group : ' commons-io' , name : ' commons-io' , version :' 1.3.2'
57- compile group : ' commons-fileupload' , name : ' commons-fileupload' , version :' 1.3'
58- compile group : ' commons-lang' , name : ' commons-lang' , version :' 2.0'
59- compile group : ' org.apache.commons' , name : ' commons-lang3' , version :' 3.1'
60- compile group : ' javax.servlet' , name : ' servlet-api' , version :' 3.0-alpha-1'
61- compile group : ' javax.mail' , name : ' mail' , version :' 1.5.0-b01'
62- compile group : ' com.sun.mail' , name : ' smtp' , version :' 1.5.0'
63- testCompile group : ' org.springframework' , name : ' spring-test' , version :' 4.0.0.RELEASE'
64- testCompile group : ' org.hamcrest' , name : ' hamcrest-all' , version :' 1.3'
65- testCompile group : ' com.jayway.jsonpath' , name : ' json-path' , version :' 0.8.1'
94+ final asmGroup = ' org.ow2.asm'
95+ final asmVersion = ' 4.1'
96+ compile " $asmGroup :asm:$asmVersion "
97+ compile " $asmGroup :asm-analysis:$asmVersion "
98+ compile " $asmGroup :asm-tree:$asmVersion "
99+ compile " $asmGroup :asm-util:$asmVersion "
100+
101+ final springGroup = ' org.springframework'
102+ final springVersion = ' 4.0.0.RELEASE'
103+ compile " $springGroup :spring-core:$springVersion "
104+ compile " $springGroup :spring-expression:$springVersion "
105+ compile " $springGroup :spring-beans:$springVersion "
106+ compile " $springGroup :spring-aop:$springVersion "
107+ compile " $springGroup :spring-context:$springVersion "
108+ compile " $springGroup :spring-context-support:$springVersion "
109+ compile " $springGroup :spring-tx:$springVersion "
110+ compile " $springGroup :spring-jdbc:$springVersion "
111+ compile " $springGroup :spring-orm:$springVersion "
112+ compile " $springGroup :spring-oxm:$springVersion "
113+ compile " $springGroup :spring-web:$springVersion "
114+ compile " $springGroup :spring-webmvc:$springVersion "
115+ compile " $springGroup :spring-webmvc-portlet:$springVersion "
116+
117+ compile " cglib:cglib:2.2.2"
118+ compile " aopalliance:aopalliance:1.0"
119+ compile " javax.servlet:jstl:1.2"
120+ compile " com.jolbox:bonecp:0.8.0-rc1"
121+ compile " com.alibaba:fastjson:1.1.38"
122+
123+ final jettyGroup = ' org.eclipse.jetty'
124+ final jettyVersion = ' 9.1.0.M0'
125+ compile " $jettyGroup :jetty-server:$jettyVersion "
126+ compile " $jettyGroup :jetty-servlet:$jettyVersion "
127+ compile " $jettyGroup :jetty-webapp:$jettyVersion "
128+ compile " $jettyGroup :jetty-servlets:$jettyVersion "
129+ compile " $jettyGroup :jetty-jsp:$jettyVersion "
130+ compile " $jettyGroup :jetty-util:$jettyVersion "
131+
132+ final hibernateGroup = ' org.hibernate'
133+ final hibernateVersion = ' 4.2.0.Final'
134+ compile " $hibernateGroup :hibernate-core:$hibernateVersion "
135+ compile " $hibernateGroup :hibernate-validator:$hibernateVersion "
136+ compile " mysql:mysql-connector-java:5.1.22"
137+
138+ final aspectjGroup = ' org.aspectj'
139+ final aspectjVersion = ' 1.7.1'
140+ compile " $aspectjGroup :aspectjweaver:$aspectjVersion "
141+ compile " $aspectjGroup :aspectjrt:$aspectjVersion "
142+
143+ compile " log4j:log4j:1.2.17"
144+ compile " org.slf4j:slf4j-log4j12:1.7.5"
145+
146+ compile " net.sourceforge.jexcelapi:jxl:2.6.12"
147+ compile " commons-io:commons-io:1.3.2"
148+ compile " commons-fileupload:commons-fileupload:1.3"
149+ compile " commons-lang:commons-lang:2.0"
150+ compile " org.apache.commons:commons-lang3:3.1"
151+ compile " javax.mail:mail:1.5.0-b01"
152+ compile " com.sun.mail:smtp:1.5.0"
153+
154+ testCompile " $springGroup :spring-test:$springVersion "
155+ testCompile " org.hamcrest:hamcrest-all:1.3"
156+ testCompile " com.jayway.jsonpath:json-path:0.8.1"
66157 testCompile(group : ' junit' , name : ' junit' , version :' 4.11' ) {
67158 exclude(module : ' hamcrest-core' )
68159 }
69- testCompile group : ' org.testng' , name : ' testng' , version :' 6.1.1'
70- testCompile group : ' org.mockito' , name : ' mockito-all' , version :' 1.9.5'
160+ testCompile " org.testng:testng:6.1.1"
161+ testCompile " org.mockito:mockito-all:1.9.5"
162+
163+ provided " javax.servlet:jsp-api:2.0"
164+ provided " org.glassfish:javax.servlet:3.0"
165+ provided " javax.servlet:servlet-api:3.0-alpha-1"
166+ }
167+
168+ test {
169+ doFirst {
170+ jettyRun. daemon = true
171+ jettyRun. execute()
172+ }
173+ doLast {
174+ jettyStop. execute()
175+ }
176+ useTestNG()
71177}
178+
179+ jacoco {
180+ toolVersion = " 0.6.5.201403032054"
181+ }
182+
0 commit comments