Thank you for explanation, but this did not work. 'publishArtifactPublicationToMavenLocalRepository.onlyIf { jar.didWork} ’ fails saying > Task with name ‘publishArtifactPublicationToMavenLocalRepository’ not found in project ‘:my-project’
‘publishArtifactPublicationToMavenLocal.onlyIf { jar.didWork }’ and ‘publishArtifactPublicationToMavenLocalRepositoryUploading.onlyIf { jar.didWork }’
also failed to configure.
‘publishToMavenLocal.onlyIf { jar.didWork }’ does not give me any error, but still upload non-modified jar to local repository.