@@ -43,24 +43,20 @@ package org.graalvm.buildtools.maven
4343
4444import org.eclipse.jetty.server.Server
4545import org.eclipse.jetty.server.ServerConnector
46- import org.eclipse.jetty.server.SymlinkAllowedResourceAliasChecker
4746import org.eclipse.jetty.server.handler.ContextHandler
4847import org.eclipse.jetty.server.handler.ResourceHandler
4948import spock.lang.Specification
5049import spock.lang.TempDir
5150
52- import java.nio.file.FileVisitResult
5351import java.nio.file.Files
5452import java.nio.file.Path
55- import java.nio.file.SimpleFileVisitor
5653import java.nio.file.StandardCopyOption
57- import java.nio.file.attribute.BasicFileAttributes
5854
5955abstract class AbstractGraalVMMavenFunctionalTest extends Specification {
60-
56+ @TempDir
6157 Path testDirectory
6258
63- Path testOrigin;
59+ Path testOrigin
6460
6561 private IsolatedMavenExecutor executor
6662
@@ -69,18 +65,11 @@ abstract class AbstractGraalVMMavenFunctionalTest extends Specification {
6965 Server server
7066 ServerConnector connector
7167
72- boolean IS_WINDOWS = System . getProperty(" os.name" , " unknown" ). contains(" Windows" );
73- boolean IS_LINUX = System . getProperty(" os.name" , " unknown" ). contains(" Linux" );
74- boolean IS_MAC = System . getProperty(" os.name" , " unknown" ). contains(" Mac" );
68+ boolean IS_WINDOWS = System . getProperty(" os.name" , " unknown" ). contains(" Windows" )
69+ boolean IS_LINUX = System . getProperty(" os.name" , " unknown" ). contains(" Linux" )
70+ boolean IS_MAC = System . getProperty(" os.name" , " unknown" ). contains(" Mac" )
7571
7672 def setup () {
77- Path HomeDir = Path . of(System . getProperty(" user.home" ))
78- testDirectory = HomeDir . resolve(" tests" )
79-
80- if (Files . notExists(testDirectory)) {
81- Files . createDirectory(testDirectory)
82- }
83-
8473 executor = new IsolatedMavenExecutor (
8574 new File (System . getProperty(" java.executable" )),
8675 testDirectory. resolve(" m2-home" ). toFile(),
@@ -89,19 +78,6 @@ abstract class AbstractGraalVMMavenFunctionalTest extends Specification {
8978 }
9079
9180 def cleanup () {
92- Files . walkFileTree(testDirectory, new SimpleFileVisitor<Path > () {
93- @Override
94- FileVisitResult visitFile (Path file , BasicFileAttributes attrs ) throws IOException {
95- Files . delete(file);
96- return FileVisitResult . CONTINUE ;
97- }
98- @Override
99- FileVisitResult postVisitDirectory (Path dir , IOException exc ) throws IOException {
100- Files . delete(dir);
101- return FileVisitResult . CONTINUE ;
102- }
103- });
104-
10581 if (server != null ) {
10682 server. stop()
10783 server. destroy()
@@ -177,12 +153,13 @@ abstract class AbstractGraalVMMavenFunctionalTest extends Specification {
177153 }
178154
179155 void mvn (List<String > args , Map<String , String > systemProperties ) {
180- System . out . println (" Running copy of maven project ` " + testOrigin + " ` with " + args);
156+ println (" Running copy of maven project ${ testOrigin} in ${ testDirectory } with $ args " )
181157 var resultingSystemProperties = [
182158 " common.repo.uri" : System . getProperty(" common.repo.uri" ),
183159 " seed.repo.uri" : System . getProperty(" seed.repo.uri" ),
184- " maven.repo.local" : testDirectory. resolve(" local repo" ). toFile(). absolutePath
160+ " maven.repo.local" : testDirectory. resolve(" local- repo" ). toFile(). absolutePath
185161 ]
162+ println " Using local repo: ${ resultingSystemProperties['maven.repo.local']} "
186163 resultingSystemProperties. putAll(systemProperties)
187164
188165 result = executor. execute(
@@ -192,7 +169,7 @@ abstract class AbstractGraalVMMavenFunctionalTest extends Specification {
192169 * args],
193170 new File (System . getProperty(" maven.settings" ))
194171 )
195- System . out . println ( " Exit code is ${ result.exitCode} " )
172+ println " Exit code is ${ result.exitCode} "
196173
197174 }
198175
0 commit comments