@ -1,5 +1,5 @@
/ *
/ *
* Copyright 2012 - 201 6 the original author or authors .
* Copyright 2012 - 201 7 the original author or authors .
*
*
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* you may not use this file except in compliance with the License .
@ -31,7 +31,7 @@ import org.xml.sax.InputSource;
import org.springframework.util.FileCopyUtils ;
import org.springframework.util.FileCopyUtils ;
public class Grad eIT {
public class Grad l eIT {
@Test
@Test
public void sampleDefault ( ) throws Exception {
public void sampleDefault ( ) throws Exception {
@ -60,7 +60,8 @@ public class GradeIT {
( ( DefaultGradleConnector ) gradleConnector ) . embedded ( true ) ;
( ( DefaultGradleConnector ) gradleConnector ) . embedded ( true ) ;
ProjectConnection project = gradleConnector . forProjectDirectory ( projectDirectory )
ProjectConnection project = gradleConnector . forProjectDirectory ( projectDirectory )
. connect ( ) ;
. connect ( ) ;
project . newBuild ( ) . forTasks ( "clean" , "build" )
project . newBuild ( ) . forTasks ( "clean" , "build" ) . setStandardOutput ( System . out )
. setStandardError ( System . err )
. withArguments ( "-PbootVersion=" + getBootVersion ( ) ) . run ( ) ;
. withArguments ( "-PbootVersion=" + getBootVersion ( ) ) . run ( ) ;
Verify . verify (
Verify . verify (
new File ( "target/gradleit/" + name + "/build/libs/" + name + ".jar" ) ,
new File ( "target/gradleit/" + name + "/build/libs/" + name + ".jar" ) ,
@ -69,7 +70,8 @@ public class GradeIT {
public static String getBootVersion ( ) {
public static String getBootVersion ( ) {
return evaluateExpression (
return evaluateExpression (
"/*[local-name()='project']/*[local-name()='version']" + "/text()" ) ;
"/*[local-name()='project']/*[local-name()='parent']/*[local-name()='version']"
+ "/text()" ) ;
}
}
private static String evaluateExpression ( String expression ) {
private static String evaluateExpression ( String expression ) {
@ -77,8 +79,7 @@ public class GradeIT {
XPathFactory xPathFactory = XPathFactory . newInstance ( ) ;
XPathFactory xPathFactory = XPathFactory . newInstance ( ) ;
XPath xpath = xPathFactory . newXPath ( ) ;
XPath xpath = xPathFactory . newXPath ( ) ;
XPathExpression expr = xpath . compile ( expression ) ;
XPathExpression expr = xpath . compile ( expression ) ;
String version = expr . evaluate (
String version = expr . evaluate ( new InputSource ( new FileReader ( "pom.xml" ) ) ) ;
new InputSource ( new FileReader ( "target/dependencies-pom.xml" ) ) ) ;
return version ;
return version ;
}
}
catch ( Exception ex ) {
catch ( Exception ex ) {