Filipe Roque created SUREFIRE-2233:
--------------------------------------
Summary: Unable to create file for report (File name too long)
Key: SUREFIRE-2233
URL: https://issues.apache.org/jira/browse/SUREFIRE-2233
Project: Maven Surefire
Issue Type: Bug
Affects Versions: 3.2.5
Environment: Linux with encripted home using ecryptfs
Reporter: Filipe Roque
surefire tries to create report files where the filename includes the package.
On Linux with eCryptfs, it easily fails with _File name too long_ ([What is the
maximum allowed filename (and folder) size with
eCryptfs?|https://unix.stackexchange.com/questions/32795/what-is-the-maximum-allowed-filename-and-folder-size-with-ecryptfs/32834]),
without failing the maven build.
* Should this error fail the build ?
* What is the solution for this, besides shorter packages and file names, or
non encrypted file systems ?
** Maybe create sub directories under target/surefire-reports matching the
packages
** shorten the filename like logback
(https://logback.qos.ch/manual/layouts.html#conversionWord)
*pom.xml*
{code:java}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>long-filenames</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
</plugin>
</plugins>
</build>
</project>
{code}
{*}src/test/java/package1/subpackage2/subpackage3/subpackage4/subpackage5/subpackage6/subpackage7/TestWithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName.java{*}{*}{*}
{code:java}
{code}
*package
package1.subpackage2.subpackage3.subpackage4.subpackage5.subpackage6.subpackage7;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class
TestWithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName \{
@Test
public void test() {
Assertions.assertTrue(true);
}
}*
{code:java}
{code}
*❯ /opt/maven/apache-maven-3.9.5/bin/mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< org.example:long-filenames >---------------------
[INFO] Building long-filenames 1.0-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ long-filenames ---
[INFO] Deleting /home/froque/workspace/testes/long-filenames/target
[INFO]
[INFO] --- resources:3.3.1:resources (default-resources) @ long-filenames ---
[INFO] Copying 0 resource from src/main/resources to target/classes
[INFO]
[INFO] --- compiler:3.11.0:compile (default-compile) @ long-filenames ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- resources:3.3.1:testResources (default-testResources) @
long-filenames ---
[INFO] skip non existing resourceDirectory
/home/froque/workspace/testes/long-filenames/src/test/resources
[INFO]
[INFO] --- compiler:3.11.0:testCompile (default-testCompile) @ long-filenames
---
[INFO] Changes detected - recompiling the module! :source
[INFO] Compiling 1 source file with javac [debug target 21] to
target/test-classes
[INFO]
[INFO] --- surefire:3.2.5:test (default-test) @ long-filenames ---
[INFO] Using auto detected provider
org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running
package1.subpackage2.subpackage3.subpackage4.subpackage5.subpackage6.subpackage7.TestWithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName
[WARNING] ForkStarter IOException: Unable to create file for report:
/home/froque/workspace/testes/long-filenames/target/surefire-reports/package1.subpackage2.subpackage3.subpackage4.subpackage5.subpackage6.subpackage7.TestWithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName.txt
(File name too long). See the dump file
/home/froque/workspace/testes/long-filenames/target/surefire-reports/2024-01-15T16-58-22_070-jvmRun1.dumpstream
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- jar:3.3.0:jar (default-jar) @ long-filenames ---
[INFO] Building jar:
/home/froque/workspace/testes/long-filenames/target/long-filenames-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.523 s
[INFO] Finished at: 2024-01-15T16:58:22Z
[INFO]
------------------------------------------------------------------------*
--
This message was sent by Atlassian Jira
(v8.20.10#820010)