Apache Maven Péter Jeszenszky Faculty of Informatics, University of Debrecen [email protected] Last modified: March 8, 2018 Apache Maven Software project management and comprehension ● tool that provides support for Building projects in a uniform way ● Publishing project information on the web ● Release management ● Distribution of project artifacts ● Dependency management ● … ● 2 Features (1) Convention over configuration. ● E.g., defines a standard project directory layout. ● Defines project lifecycles and lifecycle phases. ● Declarative. ● Modular and extensible architecture. ● All of its functionality is provided by plugins. ● 3 Features (2) Although it is used mainly for Java projects, can be ● also used for other programming languages, such as: C/C++: ● – nar-maven-plugin http://maven-nar.github.io/ Kotlin: ● – kotlin-maven-plugin https://kotlinlang.org/docs/reference/using-maven.html Scala: ● – scala-maven-plugin http://davidb.github.io/scala-maven-plugin/ 4 Development Written in Java. ● Free and open source software. ● Distributed under the Apache License v2. ● The current stable version is 3.5.3 (released on ● March 8, 2018). https://maven.apache.org/docs/history.html Differences between versions 2.x and 3.x. ● 5 Installation Requires a JDK to be installed, not just a JRE! ● JDK 7 or later is required. ● – Download the latest Oracle JDK from here: http://www.oracle.com/technetwork/java/javase/downloads/ The JAVA_HOME environment variable must be set ● properly! Download the latest version of Apache Maven ● from here: http://maven.apache.org/download.html Installation consists of unpacking an archive and ● setting the PATH environment variable. 6 Installation (Linux) (1) If unpacked in the directory /opt/apache- ● maven-3.5.3, set the PATH environment variable as shown: export PATH=/opt/apache-maven-3.5.3/bin: ● $PATH Hint: add the above command to the ● /etc/profile.d/maven.sh file in order to be automatically executed. 7 Installation (Linux) (2) Alternatively, Apache Maven can be installed via ● the SDKMAN! tool, executing the following command: sdk install maven For the installation instructions of SDKMAN! see: ● http://sdkman.io/install.html 8 Installation (Windows) If unpacked in the directory C:\Program ● Files\apache-maven-3.5.3 Add the C:\Program Files\apache-maven- ● 3.5.3\bin directory to the PATH environment variable. 9 Verifying Successful Installation Execute one of the following two equivalent ● commands in the command line: mvn --version mvn -v If the installation was successful, you should see ● the following output: AAppaacchhee MMaavveenn 33..55..33 ((33338833cc3377ee11ff99ee99bb33bbcc33ddff55005500cc2299cc88aaffff99ff229955229977;; 22001188--0022--2244TT2200::4499::0055++0011::0000)) MMaavveenn hhoommee:: //oopptt//aappaacchhee--mmaavveenn--33..55..33 JJaavvaa vveerrssiioonn:: 11..88..00__116611,, vveennddoorr:: OOrraaccllee CCoorrppoorraattiioonn JJaavvaa hhoommee:: //hhoommee//jjeesszzyy//..ssddkkmmaann//ccaannddiiddaatteess//jjaavvaa//88uu116611--oorraaccllee//jjrree DDeeffaauulltt llooccaallee:: hhuu__HHUU,, ppllaattffoorrmm eennccooddiinngg:: UUTTFF--88 OOSS nnaammee:: ""lliinnuuxx"",, vveerrssiioonn:: ""33..1133..00--3377--ggeenneerriicc"",, aarrcchh:: ""aammdd6644"",, ffaammiillyy:: ""uunniixx"" 10
Description: