[ 
https://issues.apache.org/jira/browse/MRESOURCES-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17225722#comment-17225722
 ] 

Matthias Wiedemann commented on MRESOURCES-265:
-----------------------------------------------

I ran into this issue when upgrading to 3.2.0

I reproduced the error while having a filtered resource file encoded in 
windows-1252 containing an umlaut.
{code:bash}
<?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.apache.maven.plugins</groupId>
    <artifactId>MRESOURCES-265</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <!-- https://issues.apache.org/jira/browse/MRESOURCES-265 -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.2.0</version>
            </plugin>
        </plugins>
    </build>

</project> {code}
Runs fine:
{code:bash}
$ echo ü > src/main/resources/foo {code}
Now changing encoding:
{code:bash}
$ iconv -f utf-8 -t cp1252 < src/main/resources/foo > src/main/resources/foo1 
{code}
And now it fails:
{code:bash}
 $ mvn resources:resources
 [INFO] Scanning for projects...
 [INFO]
 [INFO] -------------< org.apache.maven.plugins:MRESOURCES-265 >--------------
 [INFO] Building MRESOURCES-265 0.0.1-SNAPSHOT
 [INFO] -------------------------------[ jar ]--------------------------------
 [INFO] — maven-resources-plugin:3.2.0:resources (default-cli) @ MRESOURCES-265 
—
 [WARNING] File encoding has not been set, using platform encoding UTF-8. Build 
is platform dependent!
 [WARNING] See https://maven.apache.org/general.html#encoding-warning
 [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, 
i.e. build is platform dependent!
 [INFO] Using 'null' encoding to copy filtered properties files.
 [INFO] Copying 2 resources
 [INFO] ------------------------------------------------------------------------
 [INFO] BUILD FAILURE
 [INFO] ------------------------------------------------------------------------
 [INFO] Total time: 0.671 s
 [INFO] Finished at: 2020-11-03T23:25:33+01:00
 [INFO] ------------------------------------------------------------------------
 [ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-cli) 
on project MRESOURCES-265: Input length = 1 ->{code}
So to me it looks like an encoding issue, which is already told about in the 
warnings. It seems, that the platform encoding is used and not 'null'.

Changing platform encoding brings back a successful build:

 

{{}}
{code:java}
$ export LC_ALL="en_US.ISO-8859-1"
$ mvn resources:resources
[INFO] Scanning for projects...
[INFO]
[INFO] --------------< org.apache.maven.plugins:MRESOURCES-265 >---------------
[INFO] Building MRESOURCES-265 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:resources (default-cli) @ 
MRESOURCES-265 ---
[WARNING] File encoding has not been set, using platform encoding ISO-8859-1. 
Build is platform dependent!
[WARNING] See https://maven.apache.org/general.html#encoding-warning
[WARNING] Using platform encoding (ISO-8859-1 actually) to copy filtered 
resources, i.e. build is platform dependent!
[INFO] Using 'null' encoding to copy filtered properties files.
[INFO] Copying 2 resources
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------ 
{code}
{{}}

 

> Resource copying not using specified encoding
> ---------------------------------------------
>
>                 Key: MRESOURCES-265
>                 URL: https://issues.apache.org/jira/browse/MRESOURCES-265
>             Project: Maven Resources Plugin
>          Issue Type: Bug
>          Components: copy
>    Affects Versions: 3.2.0
>         Environment: Linux, CentOS 7
> Jenkins 2.251
> Jenkins Maven Integration plugin 3.1.2
> Java 1.8
>            Reporter: Duncan Kinnear
>            Priority: Major
>
> Overnight our Jenkins builds stopped working. On investigation we found that 
> maven-resources-plugin version used yesterday was 3.1.0 (which worked fine) 
> and today it was using 3.2.0.
> The stacktrace produced by adding the "e" switch to the maven command line 
> had the following root cause (truncated for brevity):-
> Caused by: java.nio.charset.MalformedInputException: Input length = 1
>  at java.nio.charset.CoderResult.throwException (CoderResult.java:281)
>  at sun.nio.cs.StreamDecoder.implRead (StreamDecoder.java:339)
>  at sun.nio.cs.StreamDecoder.read (StreamDecoder.java:178)
>  at java.io.InputStreamReader.read (InputStreamReader.java:184)
>  at java.io.BufferedReader.read1 (BufferedReader.java:210)
>  at java.io.BufferedReader.read (BufferedReader.java:286)
>  at java.io.BufferedReader.fill (BufferedReader.java:161)
>  at java.io.BufferedReader.read (BufferedReader.java:182)
>  at org.apache.maven.shared.filtering.BoundedReader.read 
> (BoundedReader.java:85)
>  at 
> org.apache.maven.shared.filtering.MultiDelimiterInterpolatorFilterReaderLineEnding.read
>  (MultiDelimiterInterpolatorFilterReaderLineEnding.java:235)
>  at 
> org.apache.maven.shared.filtering.MultiDelimiterInterpolatorFilterReaderLineEnding.read
>  (MultiDelimiterInterpolatorFilterReaderLineEnding.java:197)
>  at java.io.Reader.read (Reader.java:140)
>  at org.apache.maven.shared.utils.io.IOUtil.copy (IOUtil.java:199)
>  
> After a google search told us this was an encoding issue, we added the 
> following to the maven command line, but this made no difference:
> -Dproject.build.sourceEncoding=UTF-8 -Dproject.reporting.outputEncoding=UTF-8
>  
> The maven build log has these info messsage just before the error:
> [INFO] — maven-resources-plugin:3.2.0:resources (default-cli) @ uniworks —
>  [INFO] Using 'UTF-8' encoding to copy filtered resources.
>  [INFO] Using 'UTF-8' encoding to copy filtered properties files.
>  [INFO] Copying 430 resources
> We only 'fixed' the problem by specifying version 3.1.0 of the plugin in the 
> projects POM 'pluginManagement' section.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to