Skip to content

master does not build on windows with Maven 4.0.0-rc-3 #327

Closed

Description

@Bukama

Affected version

4.0.0-beta-3-SNAPSHOT

Bug description

I wanted to update parent version, but I got test errors. So I tried to build master and got the same error too.

When trying to build current master (4.0.0-beta-3-SNAPSHOT) as of commit 7d44073 the build breaks on my Windows machine

D:\Github\Maven\maven-compiler-plugin>mvn clean verify site -P run-its -V
Apache Maven 4.0.0-rc-3 (3952d00ce65df6753b63a51e86b1f626c55a8df2)
Maven home: C:\apache-maven-4.0.0-rc-3
Java version: 21.0.1, vendor: Eclipse Adoptium, runtime: C:\JDK\Java21
Default locale: de_DE, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "winnt"
[WARNING] [stderr] OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
[ERROR] Tests run: 14, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.515 s <<< FAILURE! -- in org.apache.maven.plugin.compiler.CompilerMojoTestCase
[ERROR] org.apache.maven.plugin.compiler.CompilerMojoTestCase.testCompilerFork(CompilerMojo, TestCompilerMojo) -- Time elapsed: 0.506 s <<< ERROR!
org.apache.maven.plugin.compiler.CompilationFailureException:
Cannot compile myGroupId:myArtifactId:jar:1.0-SNAPSHOT main classes.
The first error is: Input length = 1
        at org.apache.maven.plugin.compiler.AbstractCompilerMojo.compile(AbstractCompilerMojo.java:1458)
        at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:995)
        at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:165)
        at org.apache.maven.plugin.compiler.CompilerMojoTestCase.testCompilerFork(CompilerMojoTestCase.java:209)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: java.nio.charset.MalformedInputException: Input length = 1
        at java.base/java.lang.String.throwMalformed(String.java:1279)
        at java.base/java.lang.String.decodeUTF8_UTF16(String.java:1235)
        at java.base/java.lang.String.newStringUTF8NoRepl(String.java:759)
        at java.base/java.lang.String.newStringNoRepl1(String.java:790)
        at java.base/java.lang.String.newStringNoRepl(String.java:772)
        at java.base/java.lang.System$2.newStringNoRepl(System.java:2476)
        at java.base/java.nio.file.Files.readString(Files.java:3349)
        at java.base/java.nio.file.Files.readString(Files.java:3305)
        at org.apache.maven.plugin.compiler.ForkedTool.run(ForkedTool.java:167)
        at org.apache.maven.plugin.compiler.ForkedCompiler$1.call(ForkedCompiler.java:96)
        at org.apache.maven.plugin.compiler.CompilationTaskSources.compile(CompilationTaskSources.java:55)
        at org.apache.maven.plugin.compiler.AbstractCompilerMojo.compile(AbstractCompilerMojo.java:1395)
        ... 6 more

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   CompilerMojoTestCase.testCompilerFork:209 » CompilationFailure Cannot compile myGroupId:myArtifactId:jar:1.0-SNAPSHOT main classes.
The first error is: Input length = 1

Activity

  1. desruisseaux commented on Apr 25, 2025

    @desruisseaux
    Contributor

    I think that this is a duplicated of #326. The master is known to not compile against Maven 4.0.0-rc-3. This is already fixed in pull request #320, which is waiting since April 6th for a volunteer to review it.

  2. Bukama commented on Apr 25, 2025

    @Bukama
    ContributorAuthor

    I think that this is a duplicated of #326. The master is known to not compile against Maven 4.0.0-rc-3. This is already fixed in pull request #320, which is waiting since April 6th for a volunteer to review it.

    I cloned the branch of your PR and get the same error there.

    Needed to run as admin, as one other test otherwise fails due to execution rights.

  3. desruisseaux commented on Apr 25, 2025

    @desruisseaux
    Contributor

    This error didn't occurred in the GitHub action, including on Windows. What is the full name of the directory where the plugin has been cloned on your machine? For checking if there is a special character which appears when the plugin converts a path to an absolute path.

  4. desruisseaux commented on Apr 25, 2025

    @desruisseaux
    Contributor

    Correction: maybe no need to provide the full path. Looking at the line where the error occurred, I think that this is an encoding issue. What is the encoding of your Windows system? Can you check if System.getProperty("native.encoding") returns the right encoding on your system?

  5. Bukama commented on Apr 25, 2025

    @Bukama
    ContributorAuthor

    Path of my plugin fork:

    D:\Github\Maven\maven-compiler-plugin

    path of the clone of your PR

    D:\Github\Maven-Official-Testwiese\maven-compiler-plugin

    Output

    C:\Windows\system32>jshell
    |  Willkommen bei JShell - Version 21.0.1
    |  Geben Sie für eine Einführung Folgendes ein: /help intro
    
    jshell> System.getProperty("native.encoding")
    $1 ==> "Cp1252"
    
    jshell>
    
  6. desruisseaux commented on Apr 25, 2025

    @desruisseaux
    Contributor

    Thanks. I wll try tomorrow to add a commit using the encoding returned by System.getProperty("native.encoding") for parsing the file produced by the forked compiler.

  7. desruisseaux commented on Apr 26, 2025

    @desruisseaux
    Contributor

    Should be fixed in commit 7bac7a5. Can you try again please?

  8. desruisseaux commented on May 4, 2025

    @desruisseaux
    Contributor

    Fixed by 3a56f5a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions