Maven build - surefire plugin error - File name too long
Asked Answered
R

2

5

I was building project as usual with mvn clean install and following error happened:

(File name too long) -> [Help 1]

Full maven output:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:19 min
[INFO] Finished at: 2017-02-23T13:42:19+01:00
[INFO] Final Memory: 67M/544M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project union-sme-webapp: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test failed: java.lang.RuntimeException: org.apache.maven.surefire.report.ReporterException: When writing report: /home/gondy/projects/xxxxxxx/xxxxxxxxx/webapp/target/surefire-reports/TEST-xx.xxxxx.xxxx.xxxx.webapp.service.document.generator.statics.arrangements.XxxxxxxxxxXxxxxxxXxxxxxxxxxxxXxxxxxxxXxxxxxxxxXxxx.xml (File name too long) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.

I am working on Ubuntu 16.04 LTS. My colleagues are building the same project without any problem, it works even on Jenkins CI. What is the problem here? The filename is 144 chars long, which should be fine, ext has limit of 255 charactes.

Redoubtable answered 23/2, 2017 at 13:1 Comment(0)
R
10

The problem is, I have encrypted home directory and Ubuntu allows filename only 143 chars long:

From one of authors of eCryptfs:

Empirically, we have found that character filenames longer than 143 characters start requiring >255 characters to encrypt. So we (as eCryptfs upstream developers) typically recommend you limit your filenames to ~140 characters. https://unix.stackexchange.com/a/32834/82647

So options basically are:

  • Make filename shorter by renaming methods and classes
  • Move your project outside encrypted directory
  • Remove encryption of your home directory
Redoubtable answered 23/2, 2017 at 13:1 Comment(0)
A
3

you can always disable file reporting via pom.xml file or console parameters

mvn clean install -Dsurefire.useFile=false -DredirectTestOutputToFile=false -DdisableXmlReport=true

Test results will be logged to console

Other way (untested by me) would be aggregating report, mentioned here maven surefire reporting plugin configuration

Akvavit answered 6/4, 2017 at 22:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.