The code generated by the Build Init plugin already placed a comment on the demo/Library.java file. You can find your newly packaged JAR file in the lib/build/libs directory with the name lib.jar. For the other questions, press enter to use the default values. The resulting file is found in lib/build/libs, with a name using the conventional classifier -sources. You can now customize this to your own project needs. Configuration properties for Gradle Wrapper. Add the following to the end of your build script: To confirm that these changes work as expected, run the jar task again, and this time also unpack the manifest file from the JAR: Now view the contents of the META-INF/MANIFEST.MF file and you should see the following: You can easily generate a sources JAR for your library: The additional JAR will be produced as part of the assemble or build lifecycle tasks and will be part of the publication. To compile and execute the above script use the below given commands. More information about the features the java-library plugin adds to any JVM library project, such as API and implementation separation, can be found in the Java Library Plugin documentation. The path can be relative to the build file. The gradlew is a Gradle wrapper script for UNIX based OS. The first time you run the wrapper script. In the problems panel, I get: Support for builds using Gradle versions older than 2.6 was removed in tooling API version 5.0. Next you can choose the DSL for writing buildscripts - 1 : Groovy or 2: Kotlin. You can use the regular gradle command, but when a project includes a wrapper script, it is considered good form to use it instead. Version is used for the Gradle property project.version value in the build.gradle file. When prompted, select the 3: library project type and 3: Java as implementation language. The settings.gradle(.kts) file has two active line: rootProject.name assigns a name to the build, which overrides the default behavior of naming the build after the directory it’s in. Run gradle tasks again, and you see new tasks added to the list, including tasks for building the project, creating JavaDoc, and running tests. A text editor or IDE - for example IntelliJ IDEA, A Java Development Kit (JDK), version 8 or higher - for example AdoptOpenJDK. This dependency is exported to consumers, that is to say found on their compile classpath. For this example, enter my_gradle_plugin. This can be done like so: dependencies { compile fileTree(dir: 'libs', include: '*.jar') } Where libs would be the directory containing the jars and *.jar would be the filter of which files to include. This tutorial provides a practical guide on how to build a Java-based project using Gradle. The settings script for configuring the Gradle build. You can unsubscribe at any time. The init task generates the new project with the following structure: You now have the project setup to build a Java library. You can view the test report by opening the HTML output file, located at lib/build/reports/tests/test/index.html. More subprojects can be added by additional include(…​) statements. To build the project, run the build task. This task compiles, tests, and assembles the code into a JAR file. It’s recommended to set a fixed name as the folder might change if the project is shared - e.g. For e.g. An executable JAR file is used as a Gradle wrapper. However, this tutorial didn't really explain how any of this was supposed to work, and it seemed to assume that you were following some specific system for the layout of your project. apply plugin: 'java' apply plugin: 'eclipse' version = '1.0' sourceCompatibility = 1.7 targetCompatibility = 1.7 //create a single Jar with all dependencies task fatJar (type: Jar) { manifest { attributes 'Implementation-Title': 'Gradle Jar File Example', 'Implementation-Version': version, 'Main-Class': 'com.mkyong.DateUtils' } baseName = project .name + '-all' from { configurations.