diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
index 56bb0164ec17..be4fea70726b 100755
--- a/.mvn/wrapper/maven-wrapper.properties
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -1 +1 @@
-distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip
\ No newline at end of file
+distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
diff --git a/.travis.yml b/.travis.yml
index 55e3db0f7528..28d739d7b132 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,10 +6,11 @@ language: java
dist: trusty
jdk:
- - oraclejdk8
+ - openjdk8
+ - openjdk11
env:
- - MAVEN_VERSION=3.5.4
+ - MAVEN_VERSION=3.6.3
install:
- "mvn -N io.takari:maven:wrapper -Dmaven=${MAVEN_VERSION} -Dhttps.protocols=TLSv1.2"
diff --git a/pom.xml b/pom.xml
index af519f2cc2ab..f2eebe1c1c02 100644
--- a/pom.xml
+++ b/pom.xml
@@ -235,6 +235,7 @@
src/it/projects
verify
+ setup
diff --git a/src/it/projects/no-overwrite/.flattened-pom.xml b/src/it/projects/no-overwrite/.flattened-pom.xml
index c7c5b9618a4c..27dc6199dba8 100644
--- a/src/it/projects/no-overwrite/.flattened-pom.xml
+++ b/src/it/projects/no-overwrite/.flattened-pom.xml
@@ -1,5 +1,5 @@
-
4.0.0
org.codehaus.mojo.flatten.its
diff --git a/src/it/projects/no-overwrite/verify.groovy b/src/it/projects/no-overwrite/verify.groovy
index bb001673354e..5c4dc10ae1f0 100644
--- a/src/it/projects/no-overwrite/verify.groovy
+++ b/src/it/projects/no-overwrite/verify.groovy
@@ -19,5 +19,6 @@
File flattendPom = new File( basedir, '.flattened-pom.xml' )
assert flattendPom.exists()
-assert System.currentTimeMillis() - flattendPom.lastModified() > 30*1000
+long now = System.currentTimeMillis()
+assert now - flattendPom.lastModified() > 20*1000
diff --git a/src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java b/src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java
index 4cde5d4bc942..b9cd7227b7e8 100644
--- a/src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java
+++ b/src/main/java/org/codehaus/mojo/flatten/FlattenMojo.java
@@ -492,20 +492,25 @@ protected void writePom( Model pom, File pomFile, String headerComment )
protected void writeStringToFile( String data, File file, String encoding )
throws MojoExecutionException
{
- try (OutputStream outStream = new FileOutputStream( file ))
+
+ byte[] binaryData;
+
+ try
{
- byte[] binaryData = data.getBytes( encoding );
+ binaryData = data.getBytes( encoding );
if ( file.isFile() && file.canRead() && file.length() == binaryData.length )
{
-
try (InputStream inputStream = new FileInputStream( file ))
{
- byte[] buffer = new byte[ binaryData.length ];
+ byte[] buffer = new byte[binaryData.length];
inputStream.read( buffer );
- if ( Arrays.equals( buffer, binaryData ) ) {
+ if ( Arrays.equals( buffer, binaryData ) )
+ {
+ getLog().debug( "Arrays.equals( buffer, binaryData ) " );
return;
}
+ getLog().debug( "Not Arrays.equals( buffer, binaryData ) " );
}
catch ( IOException e )
{
@@ -513,6 +518,16 @@ protected void writeStringToFile( String data, File file, String encoding )
getLog().debug( "Issue reading file: " + file.getPath(), e );
}
}
+ else
+ {
+ getLog().debug( "file: " + file + ",file.length(): " + file.length() + ", binaryData.length: " + binaryData.length );
+ }
+ } catch ( IOException e )
+ {
+ throw new MojoExecutionException( "cannot read String as bytes" , e );
+ }
+ try (OutputStream outStream = new FileOutputStream( file ))
+ {
outStream.write( binaryData );
}
catch ( IOException e )