Gradle - Add a single file to the jar

I have the file "license.txt" in the root directory of my project. In the jar-task, I want to add this file to the (root folder of the) JAR file.

I tried

jar {
  from '.' include 'license.txt'
}

but this replaces the other content (.class files) instead of adding a file. And I do not want to add the license.txt to the resources folder, because I do not want to change my project structure just because of the build tool.

Who can help? Thank you!

This question and all comments follow the "Attribution Required."

All Answers

Answers Loading...
Leave a Reply
You must be logged in to post a answer.
About the author