-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathmaven
54 lines (29 loc) · 1.1 KB
/
maven
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Installing java and maven and building and testing maven:
First install Java:
sudo apt update
Step 1: Download the JDK Binaries
sudo apt install openjdk-17-jre-headless
Step 3: Verify the Java Installation
java -version
Now install setup Maven:
sudo apt install maven
# To check maven version
mvn --version
Create sample project and run Maven.
https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false
cd my-app
Tree
# Check maven version
mvn --version
Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 13.0.1, vendor: Oracle Corporation, runtime: /opt/jdk-13.0.1
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "5.19.0-42-generic", arch: "amd64", family: "unix
Build the Project
mvn package
You may test the newly compiled and packaged JAR with the following command:
java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App
Which will print the quintessential:
Hello World!