Devops prgm4
Devops prgm4
<groupId>com.example</groupId>
<artifactId>maven-example</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
package com.example;
public class App {
public static void main(String[] args) {
System.out.println("Hello, Maven");
System.out.println("This is the simple realworld example....");
int a = 5;
int b = 10;
System.out.println("Sum of " + a + " and " + b + " is " + sum(a, b));
}
step4:-run project
1.mvn clean install
2.mvn exec:java -Dexec.mainClass="com.example.App"
3.gradle init---gradle merger
open build.gradle copy paste below content
plugins {
id 'java'
}
group = 'com.example'
version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
testImplementation 'junit:junit:4.12'
}
step5:run project
1.gradlew build or gradle build
2.gradlew run or gradle run