1
運行gradle腳本後,構建成功,但沒有Reports,Test-Result文件夾出現在Build文件夾下。在運行gradle腳本報告並且測試結果文件夾未顯示之後
Project strutcture is :
Gateway
src
com.pojo - Person.java
com.test -PersonTest.java
搖籃腳本:
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse'
tomcat_home='C:/apache-tomcat-6.0.37-windows-x64/apache-tomcat-6.0.37'
ext.projectJar = "C:/Users/r.kumar.verma/Desktop/referenceAppJar"
version = "1.0-${new Date().format('yyyyMMdd')}"
sourceCompatibility = 1.7
repositories {
mavenCentral()
}
dependencies {
providedCompile 'javax.servlet:servlet-api:2.5'
runtime 'javax.servlet:jstl:1.1.2'
testCompile group: 'junit', name: 'junit', version: '4.+'
compile fileTree(dir: projectJar, include: '*.jar')
}
**//This will publish the war to tomcat webapp.**
task deploylocal(dependsOn: build) << {
println "Copy from ${libsDir.getPath()} into ${tomcat_home}/webapps"
copy{
from libsDir
into "${tomcat_home}/webapps"
include '*.war'
}
}
以下運行gradle這個測試之後是輸出:
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
**After running gradle build, below is the output:**
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:war
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build
I am not clear why the folders are not getting created under it.
I did clean build and all other things.
Person類僅僅是一個字符串名稱POJO和測試只需檢查輸入和輸出是否相等的斷言。
Gateway
src
com.pojo - Person.java
com.test -PersonTest.java
Person.java:
public class Person {
private final String name;
public Person(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
PersonTest.java
import org.junit.Test;
import com.marriott.dsap.gateway.pojo.Person;
import static org.junit.Assert.*;
public class PersonTest {
@Test
public void canConstructAPersonWithAName() {
Person person = new Person("Larry");
assertEquals("Larry", person.getName());
}
}