[
https://issues.apache.org/jira/browse/MRESOURCES-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17177348#comment-17177348
]
Duncan Kinnear commented on MRESOURCES-265:
-------------------------------------------
I added the '-X' option to the mvn command line to give me debug level logging.
The following is a snippet of the log before the failure:
{{{color:#FF0000}[WARNING] Using platform encoding (UTF-8 actually) to copy
filtered resources, i.e. build is platform dependent!{color}}}
{{{color:#ffab00}[INFO] Using 'null' encoding to copy filtered properties
files.{color}}}
{{[DEBUG] resource with targetPath null}}
{{directory /home/duncan/NetBeansProjects/uniworks-2.2.7/src/main/resources}}
{{excludes []}}
{{includes []}}
{{[DEBUG] ignoreDelta true}}
{{[INFO] Copying 489 resources}}
{{[DEBUG] Copying file settings/settings.xml}}
{{[DEBUG] file settings.xml has a filtered file extension}}
{{{color:#ffab00}[DEBUG] Using 'null' encoding to copy filtered resource
'settings.xml'.{color}}}
{{[DEBUG] filtering
/home/duncan/NetBeansProjects/uniworks-2.2.7/src/main/resources/settings/settings.xml
to
/home/duncan/NetBeansProjects/uniworks-2.2.7/target/classes/settings/settings.xml}}
{{[DEBUG] Copying file keystore/keystore.jks}}
{{[DEBUG] file keystore.jks has a filtered file extension}}
{{{color:#ffab00}[DEBUG] Using 'null' encoding to copy filtered resource
'keystore.jks'.{color}}}
{{[DEBUG] filtering
/home/duncan/NetBeansProjects/uniworks-2.2.7/src/main/resources/keystore/keystore.jks
to
/home/duncan/NetBeansProjects/uniworks-2.2.7/target/classes/keystore/keystore.jks}}
{{So it is the second file that it is copying which fails (keystore.jks). This
file has been in our build for 8 years and is the keystore used to sign our
OSGi bundles. I will attach it to the issue.}}
{{The interesting thing about these log messages is the fact that before it
starts copying the files, Maven warns that encoding is not set, and that the
platform encoding (UTF-8) will be used (red highlight).}}
{{However, before copying each file, it states that it is "Using 'null'
encoding to copy ...." (yellow highlight). So it seems that it is not picking
up the platform encoding correctly.}}
{{If I specify version 3.1.0 of the resource plugin, the same part of the build
log has the following:}}
{{{color:#de350b}[WARNING] Using platform encoding (UTF-8 actually) to copy
filtered resources, i.e. build is platform dependent!{color}}}
{{[DEBUG] resource with targetPath null}}
{{directory /home/duncan/NetBeansProjects/clean-2.2.6/src/main/resources}}
{{excludes []}}
{{includes []}}
{{[DEBUG] ignoreDelta true}}
{{[INFO] Copying 430 resources}}
{{[DEBUG] Copying file settings/settings.xml}}
{{[DEBUG] file settings.xml has a filtered file extension}}
{{[DEBUG] filtering
/home/duncan/NetBeansProjects/clean-2.2.6/src/main/resources/settings/settings.xml
to
/home/duncan/NetBeansProjects/clean-2.2.6/target/classes/settings/settings.xml}}
{{[DEBUG] Copying file keystore/keystore.jks}}
{{[DEBUG] file keystore.jks has a filtered file extension}}
{{[DEBUG] filtering
/home/duncan/NetBeansProjects/clean-2.2.6/src/main/resources/keystore/keystore.jks
to
/home/duncan/NetBeansProjects/clean-2.2.6/target/classes/keystore/keystore.jks}}
{{[DEBUG] Copying file spring-config.xml}}
{{[DEBUG] file spring-config.xml has a filtered file extension}}
{{[DEBUG] filtering
/home/duncan/NetBeansProjects/clean-2.2.6/src/main/resources/spring-config.xml
to /home/duncan/NetBeansProjects/clean-2.2.6/target/classes/spring-config.xml}}
{{Note there is no mention of a 'null encoding.}}
> 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)