Gradle is generating files with their names too big in cucumber tests

I am using gradle 2.2.1, java 8, cucumber 1.2.2 and my CI build has been broken because my cucumber tests through gradle build generated files that have names bigger than Windows API support to generate. Sounds that Windows API is restrict to 260 characters in a new file operation.
When I run my tests through Eclipse JUnit plugin (or even through Cucumber plugin for Eclipse), all works fine.
Is there a way to change the gradle behavior not to use the Windows API to generate theses files?

Here is a sample of my gradle build feedback:

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ':test'.
> Could not write XML test results for Cenßrio: listagem do indicador de custo de treinamento, agrupado por classificaþÒo de cargo com hist¾rico nÝvel hierßrquico, realizado com o filtro de perÝodo e classificaþÒo de funcionßrio com hist¾rico Tipo de salßrio/Mensalista que possui mudanþa de valores em 03/2014 to file C:\Desenvolvimento\JoinRH\joinrhweb_tarefas\build\test-results\TEST-Cen#e1rio#3a#20listagem#20do#20indicador#20de#20custo#20de#20treinamento#2c#20agrupado#20por#20classifica#e7#e3o#20de#20cargo#20com#20hist#f3rico#20n#edvel#20hier#e1rquico#2c#20realizado#20com#20o#20filtro#20de#20per#edodo#20e#20classifica#e7#e3o#20de#20funcion#e1rio#20com#20hist#f3rico#20Tipo#20de#20sal#e1rio#2fMensalista#20que#20possui#20mudan#e7a#20de#20valores#20em#2003#2f2014.xml.

Note the size of the file name: “TEST-Cen#e1rio#3a#20listagem#20do#20indicador#20de#20custo#20de#20treinamento#2c#20agrupado#20por#20classifica#e7#e3o#20de#20cargo#20com#20hist#f3rico#20n#edvel#20hier#e1rquico#2c#20realizado#20com#20o#20filtro#20de#20per#edodo#20e#20classifica#e7#e3o#20de#20funcion#e1rio#20com#20hist#f3rico#20Tipo#20de#20sal#e1rio#2fMensalista#20que#20possui#20mudan#e7a#20de#20valores#20em#2003#2f2014.xml.”

Any ideas?

Thanks in advance!

Interesting. If the Gradle code has any control over this, I recently discovered that I was having similar problems in code of mine using normal Java IO. When I converted it to use the “Files” class in the NIO package, it worked perfectly fine. The file names were still just as long, but NIO was able to create them.

@David_Karr I understood what you said, but I don’t know what I can do.

I was looking at the code and it seems that the method generate() in the class Binary2JUnitXmlReportGenerator is the one which is throwing the Exception. I think is the call of saxWriter.write(result, output);

Well, I think it is platform specific and I don’t know how to handle this. Is there a way to customize it in my build file a task or something like that to truncate or to shorten my file names?

Sorry, I should have made it clear this was just an observation. There’s not much you can do with that information. It’s more of a hint to anyone that might attempt to rectify this in the Gradle code, that they should perhaps use the NIO classes in Java 7 instead of the old File class.