I'm trying to test my maven plugin.
The layout is:
src
\main\java\my.mojo.is.here
.....\it\invoke-installer-write-to-file\src\pom.xml
where .....\it\invoke-installer-write-to-file\src\pom.xml is a test project. it's pom.xml invokes plugin and then I do verify the result.
I've created two test projects and using maven-invoker-plugin to test plugin. I have a groovy verifier:
String successMessage = 'Test passed'
String outputFilePath = "${project.build.directory}/it/invoke-installer-write-to-file/target/test.output"
File outputFile = new File(outputFilePath)
println "We should get message '$successMessage' from file: $outputFile.absolutePath"
return new File(outputFilePath).exists() && new File(outputFilePath).text.contains(successMessage)
The problem is that variable project.build.directory inside test project points to the target of plugin project.
Is there any possibility to make project.build.directory point to test project target?
right now I have to hardcode a path to test project path
String outputFilePath = "${project.build.directory}/it/invoke-installer-write-to-file/target/test.output"