🎓 Top 15 Udemy Courses (80-90% Discount): My Udemy Courses - Ramesh Fadatare — All my Udemy courses are real-time and project oriented courses.
▶️ Subscribe to My YouTube Channel (178K+ subscribers): Java Guides on YouTube
▶️ For AI, ChatGPT, Web, Tech, and Generative AI, subscribe to another channel: Ramesh Fadatare on YouTube
Pre-requisites
- A Java project set up with Gradle. If you don't have one, you can start by creating a simple project using the gradle init command or from an existing source.
- Gradle installed locally (or use the Gradle Wrapper, which comes bundled in most modern Java projects).
Building the JAR
1. Navigate to your project directory
Open your terminal or command prompt and navigate to the root directory of your Gradle project.
2. Execute the JAR task
Run the following command:
gradle jarIf your project includes the Gradle Wrapper (which is recommended for ensuring consistent builds):
./gradlew jarOn Windows:
gradlew.bat jar3. Locate the JAR
After executing the command, Gradle will compile your project and package it into a JAR file.
By default, you can find this JAR in the build/libs directory of your project.
What's happening behind the scenes?
When you issue the jar task:
Compilation: Gradle compiles the project's source code.
Packaging: All compiled classes and resources are packaged into a JAR file.
Output: The JAR file is saved in the build/libs directory with a default name pattern:
jar {
manifest {
attributes 'Implementation-Title': 'My Project',
'Implementation-Version': '1.0'
}
// Exclude test classes, for example
exclude '**/*Test.class'
}Customizing the JAR Packaging
You can customize the packaging process using the jar task in your build.gradle file. For instance, if you want to change the manifest or include/exclude certain files:
jar {
manifest {
attributes 'Implementation-Title': 'My Project',
'Implementation-Version': '1.0'
}
// Exclude test classes, for example
exclude '**/*Test.class'
}Building an Executable JAR
In case you're working with Spring Boot or other frameworks that require an executable JAR, you'd usually rely on specific plugins (like spring-boot-gradle-plugin). Once the plugin is applied, you can use:
gradle bootJarThis will produce an executable JAR with embedded dependencies, ensuring your application can run standalone.
My Top and Bestseller Udemy Courses. The sale is going on with a 70 - 80% discount. The discount coupon has been added to each course below:
Build REST APIs with Spring Boot 4, Spring Security 7, and JWT
🆕 High-Demand
80–90% OFF
[NEW] Learn Apache Maven with IntelliJ IDEA and Java 25
🆕 High-Demand
80–90% OFF
ChatGPT + Generative AI + Prompt Engineering for Beginners
🚀 Trending Now
80–90% OFF
Spring 7 and Spring Boot 4 for Beginners (Includes 8 Projects)
🔥 Bestseller
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Building Real-Time REST APIs with Spring Boot - Blog App
🔥 Bestseller
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Building Microservices with Spring Boot and Spring Cloud
🌟 Top Rated
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Java Full-Stack Developer Course with Spring Boot and React JS
🔥 Bestseller
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Build 5 Spring Boot Projects with Java: Line-by-Line Coding
🌟 Top Rated
80–90% OFF
Testing Spring Boot Application with JUnit and Mockito
🔥 Bestseller
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Spring Boot Thymeleaf Real-Time Web Application - Blog App
🔥 Bestseller
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Master Spring Data JPA with Hibernate
🔥 Bestseller
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Spring Boot + Apache Kafka Course - The Practical Guide
🎓 Student Favorite
80–90% OFF
Available in Udemy for Business
Available in Udemy for Business
Comments
Post a Comment
Leave Comment