Hi @Stefan_Wolf,
Thanks for looking into this issue. Please see below for the commands I used and the log.
You can see that after running "./gradlew jar -i " command, the git.properties is not there (the command “ls project1/build/resources/” didn’t show anything.)
And you can see the problem is because “processResources” task (running after “generateGitProperties” task) deleted the generated file:
Task :project1:processResources NO-SOURCE
Deleting stale output file: /home/tha/test/example/project1/build/resources/main
This is the full log
tha@tha:~/test$ wget https://github.com/n0mer/gradle-git-properties/files/3384489/example.zip
..
2019-09-16 17:50:41 (413 KB/s) - ‘example.zip’ saved [68341/68341]
tha@tha:~/test$ unzip example.zip
..
tha@tha:~/test/example$ chmod u+x gradlew
tha@tha:~/test/example$ ./gradlew jar -i
Downloading https://services.gradle.org/distributions/gradle-5.1.1-all.zip
............................................................................................................................
Unzipping /home/tha/.gradle/wrapper/dists/gradle-5.1.1-all/97z1ksx6lirer3kbvdnh7jtjg/gradle-5.1.1-all.zip to /home/tha/.gradle/wrapper/dists/gradle-5.1.1-all/97z1ksx6lirer3kbvdnh7jtjg
Set executable permissions for: /home/tha/.gradle/wrapper/dists/gradle-5.1.1-all/97z1ksx6lirer3kbvdnh7jtjg/gradle-5.1.1/bin/gradle
Initialized native services in: /home/tha/.gradle/native
Welcome to Gradle 5.1.1!
Here are the highlights of this release:
- Control which dependencies can be retrieved from which repositories
- Production-ready configuration avoidance APIs
For more details see https://docs.gradle.org/5.1.1/release-notes.html
Using 4 worker leases.
Starting Build
<-------------> 0% INITIALIZING [0s]
> Evaluating settings
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/home/tha/.gradle/wrapper/dists/gradle-5.1.1-all/97z1ksx6lirer3kbvdnh7jtjg/gradle-5.1.1/lib/groovy-all-1.0-2.5.4.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
Compiling settings file '/home/tha/test/example/settings.gradle' using SubsetScriptTransformer.ations
Compiling settings file '/home/tha/test/example/settings.gradle' using BuildScriptTransformer.
Settings evaluated using settings file '/home/tha/test/example/settings.gradle'.
Projects loaded. Root project using build file '/home/tha/test/example/build.gradle'.
Included projects: [root project 'project1-root', project ':project1']
> Configure project :
Evaluating root project 'project1-root' using build file '/home/tha/test/example/build.gradle'.
Compiling build file '/home/tha/test/example/build.gradle' using SubsetScriptTransformer.
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/gradle/plugin/com/gorylenko/gradle-git-properties/gradle-git-properties/2.0.0/gradle-git-properties-2.0.0.pom, /home/tha/.gradle/caches/modules-2/files-2.1/gradle.plugin.com.gorylenko.gradle-git-properties/gradle-git-properties/2.0.0/16d72a6f767d2df87a8ac513c9434228e2f9e59d/gradle-git-properties-2.0.0.pom]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/org/ajoberstar/grgit/grgit-core/3.0.0/grgit-core-3.0.0.pom, /home/tha/.gradle/caches/modules-2/files-2.1/org.ajoberstar.grgit/grgit-core/3.0.0/216e0970c0465ea6bb6fa9c45e0b58e5cdaf1b85/grgit-core-3.0.0.pom]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/org/eclipse/jgit/org.eclipse.jgit/5.1.3.201810200350-r/org.eclipse.jgit-5.1.3.201810200350-r.pom, /home/tha/.gradle/caches/modules-2/files-2.1/org.eclipse.jgit/org.eclipse.jgit/5.1.3.201810200350-r/64fb79859c8d126206a6bc79634739e097ffad8d/org.eclipse.jgit-5.1.3.201810200350-r.pom]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/org/eclipse/jgit/org.eclipse.jgit-parent/5.1.3.201810200350-r/org.eclipse.jgit-parent-5.1.3.201810200350-r.pom, /home/tha/.gradle/caches/modules-2/files-2.1/org.eclipse.jgit/org.eclipse.jgit-parent/5.1.3.201810200350-r/68fb1fa149b97a735ad82ad3dd8816e89178e1ae/org.eclipse.jgit-parent-5.1.3.201810200350-r.pom]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/com/jcraft/jsch/0.1.54/jsch-0.1.54.pom, /home/tha/.gradle/caches/modules-2/files-2.1/com.jcraft/jsch/0.1.54/8e82e6a2cb5664170faa2a5abdc297e589a37df1/jsch-0.1.54.pom]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/org/slf4j/slf4j-api/1.7.2/slf4j-api-1.7.2.pom, /home/tha/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.2/3fceb45ce8f7a6f87f3f2077a24a3833d1ecb4c6/slf4j-api-1.7.2.pom]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/com/googlecode/javaewah/JavaEWAH/1.1.6/JavaEWAH-1.1.6.pom, /home/tha/.gradle/caches/modules-2/files-2.1/com.googlecode.javaewah/JavaEWAH/1.1.6/759dda489d69ebd237d9ee353e67a460274b14f0/JavaEWAH-1.1.6.pom]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/com/jcraft/jzlib/1.1.1/jzlib-1.1.1.pom, /home/tha/.gradle/caches/modules-2/files-2.1/com.jcraft/jzlib/1.1.1/d990b68017884e9615990c39ef81cf2b5884d464/jzlib-1.1.1.pom]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/org/slf4j/slf4j-parent/1.7.2/slf4j-parent-1.7.2.pom, /home/tha/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-parent/1.7.2/26c68730e36b29249e0c3bb70eba4a5dbaa4f76c/slf4j-parent-1.7.2.pom]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/org/sonatype/oss/oss-parent/5/oss-parent-5.pom, /home/tha/.gradle/caches/modules-2/files-2.1/org.sonatype.oss/oss-parent/5/3ae20880ad3d5da6b1caec19e3de7e70dd2dd762/oss-parent-5.pom]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/org/sonatype/oss/oss-parent/6/oss-parent-6.pom, /home/tha/.gradle/caches/modules-2/files-2.1/org.sonatype.oss/oss-parent/6/765c355ec09ad070065d9d12a9245bba5c689d96/oss-parent-6.pom]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/com/jcraft/jsch/0.1.54/jsch-0.1.54.jar, /home/tha/.gradle/caches/modules-2/files-2.1/com.jcraft/jsch/0.1.54/da3584329a263616e277e15462b387addd1b208d/jsch-0.1.54.jar]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/com/googlecode/javaewah/JavaEWAH/1.1.6/JavaEWAH-1.1.6.jar, /home/tha/.gradle/caches/modules-2/files-2.1/com.googlecode.javaewah/JavaEWAH/1.1.6/94ad16d728b374d65bd897625f3fbb3da223a2b6/JavaEWAH-1.1.6.jar]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/gradle/plugin/com/gorylenko/gradle-git-properties/gradle-git-properties/2.0.0/gradle-git-properties-2.0.0.jar, /home/tha/.gradle/caches/modules-2/files-2.1/gradle.plugin.com.gorylenko.gradle-git-properties/gradle-git-properties/2.0.0/106853534412510693fcc24982b6046583dfa472/gradle-git-properties-2.0.0.jar]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/com/jcraft/jzlib/1.1.1/jzlib-1.1.1.jar, /home/tha/.gradle/caches/modules-2/files-2.1/com.jcraft/jzlib/1.1.1/a1551373315ffc2f96130a0e5704f74e151777ba/jzlib-1.1.1.jar]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/org/slf4j/slf4j-api/1.7.2/slf4j-api-1.7.2.jar, /home/tha/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.2/81d61b7f33ebeab314e07de0cc596f8e858d97/slf4j-api-1.7.2.jar]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/org/ajoberstar/grgit/grgit-core/3.0.0/grgit-core-3.0.0.jar, /home/tha/.gradle/caches/modules-2/files-2.1/org.ajoberstar.grgit/grgit-core/3.0.0/741436d5e7321148a284096629b5b9bcd6e94792/grgit-core-3.0.0.jar]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/org/eclipse/jgit/org.eclipse.jgit/5.1.3.201810200350-r/org.eclipse.jgit-5.1.3.201810200350-r.jar, /home/tha/.gradle/caches/modules-2/files-2.1/org.eclipse.jgit/org.eclipse.jgit/5.1.3.201810200350-r/f270dbd1d792d5ad06074abe018a18644c90b60e/org.eclipse.jgit-5.1.3.201810200350-r.jar]
Compiling build file '/home/tha/test/example/build.gradle' using BuildScriptTransformer.
> Configure project :project1
Evaluating project ':project1' using build file '/home/tha/test/example/project1/build.gradle'.
All projects evaluated.
Selected primary task 'jar' from project :
Tasks to be executed: [task ':project1:compileJava', task ':project1:generateGitProperties', task ':project1:processResources', task ':project1:classes', task ':project1:jar']
:project1:compileJava (Thread[Execution worker for ':',5,main]) started.
> Task :project1:compileJava
Task ':project1:compileJava' is not up-to-date because:
No history is available.
All input files are considered out-of-date for incremental task ':project1:compileJava'.
Full recompilation is required because no incremental change information is available. This is usually caused by clean builds or changing compiler arguments.
Compiling with JDK Java compiler API.
Created classpath snapshot for incremental compilation in 0.002 secs.
:project1:compileJava (Thread[Execution worker for ':',5,main]) completed. Took 1.325 secs.
:project1:generateGitProperties (Thread[Execution worker for ':' Thread 3,5,main]) started.
> Task :project1:generateGitProperties
dotGitDirectory = [/home/tha/test/example/.git]
Task ':project1:generateGitProperties' is not up-to-date because:
Task.upToDateWhen is false.
git.properties location = [/home/tha/test/example/project1/build/resources/main/com/git.properties]
Written properties to [/home/tha/test/example/project1/build/resources/main/com/git.properties]...
:project1:generateGitProperties (Thread[Execution worker for ':' Thread 3,5,main]) completed. Took 0.553 secs.
:project1:processResources (Thread[Execution worker for ':' Thread 3,5,main]) started.
> Task :project1:processResources NO-SOURCE
Deleting stale output file: /home/tha/test/example/project1/build/resources/main
Skipping task ':project1:processResources' as it has no source files and no previous output files.
:project1:processResources (Thread[Execution worker for ':' Thread 3,5,main]) completed. Took 0.02 secs.
:project1:classes (Thread[Execution worker for ':' Thread 3,5,main]) started.
> Task :project1:classes
Skipping task ':project1:classes' as it has no actions.
:project1:classes (Thread[Execution worker for ':' Thread 3,5,main]) completed. Took 0.003 secs.
:project1:jar (Thread[Execution worker for ':' Thread 3,5,main]) started.
> Task :project1:jar
Task ':project1:jar' is not up-to-date because:
No history is available.
:project1:jar (Thread[Execution worker for ':' Thread 3,5,main]) completed. Took 0.231 secs.
BUILD SUCCESSFUL in 39s
3 actionable tasks: 3 executed
jars (/home/tha/.gradle/caches/jars-3) removing files not accessed on or after Mon Sep 09 17:51:48 PDT 2019.
jars (/home/tha/.gradle/caches/jars-3) cleaned up in 0.086 secs.
artifact cache (/home/tha/.gradle/caches/modules-2) [subdir: /home/tha/.gradle/caches/modules-2/resources-2.1] removing files not accessed on or after Sat Aug 17 17:51:49 PDT 2019.
artifact cache (/home/tha/.gradle/caches/modules-2) [subdir: /home/tha/.gradle/caches/modules-2/files-2.1] removing files not accessed on or after Sat Aug 17 17:51:49 PDT 2019.
artifact cache (/home/tha/.gradle/caches/modules-2) cleaned up in 0.118 secs.
Artifact transforms cache (/home/tha/.gradle/caches/transforms-2) [subdir: /home/tha/.gradle/caches/transforms-2/files-2.1] removing files not accessed on or after Mon Sep 09 17:51:53 PDT 2019.
Artifact transforms cache (/home/tha/.gradle/caches/transforms-2) cleaned up in 0.0 secs.
tha@tha:~/test/example$ ls project1/build/resources/
tha@tha:~/test/example$
tha@tha:~/test/example$ ./gradlew --version
------------------------------------------------------------
Gradle 5.1.1
------------------------------------------------------------
Build time: 2019-01-10 23:05:02 UTC
Revision: 3c9abb645fb83932c44e8610642393ad62116807
Kotlin DSL: 1.1.1
Kotlin: 1.3.11
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 11.0.4 (Ubuntu 11.0.4+11-post-Ubuntu-1ubuntu219.04)
OS: Linux 5.0.0-27-generic amd64