Kotlin.compiler.incremental not copying resources


#1

I think it may be a bug

<kotlin.compiler.incremental>false</kotlin.compiler.incremental>
mvn clean compile install
find . -name ‘log4j.properties’
./target/classes/log4j.properties
./src/main/resources/log4j.properties

But , when setting kotlin.compiler.incremental to true
<kotlin.compiler.incremental>true</kotlin.compiler.incremental>
mvn clean compile install
find . -name ‘log4j.properties’
./src/main/resources/log4j.properties

NOT output to target/classes

environment

<kotlin.version>1.2.0</kotlin.version>
<kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>

$ mvn -version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00)
Maven home: /Users/smallufo/maven
Java version: 9, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home
Default locale: zh_TW, platform encoding: UTF-8
OS name: “mac os x”, version: “10.13.1”, arch: “x86_64”, family: “mac”


#2

Same issue here. Seems to be a bug. When is it fixed?


#3

This issue is confusing. I thought resources were copied by maven-resources-plugin. How can it be possibly affected by compiler configuration?


#4

I got into the same problem. The incremental compilation cleans the target/classes and target/testClasses directories. maven-resources-plugin is run before and so the resources are all gone.

This is definitely a bug and very hard to find :confused:


#5

In that case, this might be a possible workaround (although the resources would be copied twice in this scenario):

<plugin>
	<artifactId>maven-resources-plugin</artifactId>
	<version>3.0.2</version>
	<executions>
		<execution>
			<id>extra-copy-resources</id>
			<phase>process-classes</phase>
			<goals>
				<goal>resources</goal>
			</goals>          
		</execution>
		<execution>
			<id>extra-copy-test-resources</id>
			<phase>process-test-classes</phase>
			<goals>
				<goal>testResources</goal>
			</goals>          
		</execution>
	</executions>
</plugin>

#6

Run into the same issue using version 1.2.21 of the compiler plugin and wasted hours before randomly trying this after determining that if I did a ‘clean’ and then ‘package’ the resources weren’t there, but doing another ‘package’ retained them, and figured it might be something to do with Kotlin not recompiling anything the second time around.

This used to work however as I have jar files that contain these missing resources, but reverting to earlier versions of my POM with earlier plugin versions didn’t seem to fix it. It feels like something else is involved but this was the only consistent factor I could find