-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
README-MAVEN.txt
104 lines (70 loc) · 3.3 KB
/
README-MAVEN.txt
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
This file provides brief instructions on how to add this repository to
a Maven build, from Eclipse, NetBeans, IntelliJ, or the command line.
Specifically, it provides instructions on creating a version of algs4.jar
that you can use as a dependency in your projects.
These instructions assume that you already have installed Java 7
(JDK 1.7) or above.
Using Maven in Eclipse for Java Developers
------------------------------------------
If m2e (Maven plugin) is not built into Eclipse, follow these steps to install the plugin:
* Open Eclipse.
* Go to Help -> Eclipse Marketplace.
* Search for Maven.
* Click "Install" button at "Maven Integration for Eclipse" or "m2e" section.
* Follow the instruction step by step.,
Restart Eclipse after installing m2e.
Now you can import algs4 as "Maven Project" into Eclipse:
* Open menu: File-> Import-> Maven-> Existing Maven Projects...
* Choose directory of algs4.
* Confirm import.
To complete dependencies resolution after import:
* Right click on the project, choose Maven -> Update Project...
* Confirm project update.
To build project in Eclipse:
Eclipse automatically builds the project every time it saved.
But if you want enforce build, do following:
* Right click on the project in Eclipse.
* Choose Run as... Maven build.
Maven will put algs4-<version>.jar in the directory <algs4 directory>/target.
You can use this jar as a dependency in your projects.
Using Maven in IntelliJ IDEA
----------------------------
Using Maven in Netbeans
-----------------------
Using Maven from the Windows Command Prompt
-------------------------------------------
Download and install Maven by following the instructions at
https://maven.apache.org.
Locate the installation directory for Maven, e.g., C:\<apache-maven-x-y-z>
Locate the installation directory for Java, e.g., C:\Program Files\Java\<JDK-x-y-z>
Set the following environment variables:
set JAVA_HOME=C:\Program Files\Java\<JDK-x-y-z>
set PATH=%JAVA_HOME%\bin;%PATH%
set M2_HOME=C:\<apache-maven-x-y-z>
set PATH=%M2_HOME%\bin;%PATH%
To create the algs4-<version>.jar package and install it in the local
repository for reuse from other projects, change to the directory of
the algs4 repository and run Maven.
cd <algs4 directory>
mvn clean install
Maven will put algs4-<version>.jar in the directory <algs4 directory>/target.
You can use this jar as a dependency in your projects.
Using Maven from the Linux / Mac OS X bash shell
------------------------------------------------
Download and install Maven, either by using your favorite package
manager (such as apt-get) or by following the instructions at
https://maven.apache.org.
Locate the installation directory for Maven, e.g., /my/maven/<apache-maven-x-y-z>
Locate the installation directory for Java, e.g., /my/java/<JDK-x-y-z->
Set the following environment variables:
export JAVA_HOME=/my/java/<JDK-x-y-z>
export PATH=$JAVA_HOME/bin:$PATH
export M2_HOME=/my/maven/<apache-maven-x-y-z>
export PATH=$M2_HOME/bin:$PATH
To create the algs4-<version>.jar package and install it in the local
repository for reuse from other projects, change to the directory of
the algs4 repository and run Maven.
cd <algs4 directory>
mvn clean install
Maven will put algs4-<version>.jar in the directory <algs4 directory>/target.
You can use this jar as a dependency in your projects.