Exp 4
Exp 4
To compile and package your project into a .jar file, you need to add the Maven Compiler and Jar plugins. 🔧
1. Open the pom.xml file. 📄
2. Add the following inside the <project> tag:
1 <build>
2 <plugins>
3 <!-- Compiler Plugin -->
4 <plugin>
5 <groupId>org.apache.maven.plugins</groupId>
6 <artifactId>maven-compiler-plugin</artifactId>
7 <version>3.8.1</version>
8 <configuration>
9 <source>1.8</source>
10 <target>1.8</target>
1 D:\Idea Projects\MVNGRDLDEMO\target\MVNGRDLDEMO-1.0-SNAPSHOT.jar
2
1 cd "D:\Idea Projects\MVNGRDLDEMO"
2
This command will convert your Maven pom.xml into a Gradle build.gradle file. 🏗️
1 plugins {
2 id 'java'
3 }
4
5 group = 'com.example'
6 version = '1.0-SNAPSHOT'
7
8 repositories {
9 mavenCentral()
10 }
11
12 dependencies {
13 testImplementation 'junit:junit:4.13.2'
14 }
15
16 jar {
17 manifest {
18 attributes(
19 'Main-Class': 'com.example.App'
20 )
21 }
22 }
23
🎉 Conclusion
Congratulations! You have successfully: