Apache Maven

Get Started. It's Free
or sign up with your email address
Apache Maven by Mind Map: Apache Maven

1. Build Life Cycle

1.1. clean

1.1.1. phases pre-clean mvn pre-clean clean mvn clean or mvn clean:clean(plugin included in pom) post-clean mvn post-clean

1.2. default/build

1.2.1. phases validate mvn validate compile mvn compile or mvn compiler:compile(include plugin) test mvn test or mvn surefire:test(include plugin in pom) package "mvn package" or mvn jar:jar/mvn war:war etc verify mvn verify install mvn install deploy mvn deploy

1.3. site

1.3.1. phases pre-site site mvn site or mvn site:site(include plugin in pom.xml) post-site site-deploy mvn site-deploy or mvn site:deploy(with plugin included in pom.xml)

1.3.2. Generated documentation under target/site

2. Maven vs ANT vs Gradle

3. Common tasks

3.1. mvn clean

3.2. mvn package

3.3. mvn clean package

3.4. mvn clean install

3.5. mvn plugin:goal

3.5.1. mvn archetype:generate

3.5.2. mvn compiler:compile

3.5.3. mvn jar:jar

3.5.4. mvn tomcat7:run

3.5.5. mvn jetty6:run

3.5.6. mvn dependency:tree

3.5.7. mvn surefire:test

4. What is Maven?

4.1. BUILD management TOOL for Java projects

4.2. manages a project's build, reporting and documentation

4.3. Features?

4.3.1. quick project setup

4.3.2. standard directory structure

4.3.3. Adds Jars/Dependencies/libraries automatically(dependency management)

4.3.4. build multi-module projects

4.3.5. IDE Integration Eclipse mvn eclipse:eclipse IntelliJ mvn idea:idea

5. Define Plugin, Phases, Goals

5.1. Life cycle is a sequence of named phases.

5.2. Phases executes sequentially. Executing a phase means executes all previous dependent phases, life cycles

5.3. Plugin are used to add additional collection of goals.

5.4. Goal is like an action in Plugin. So if plugin is a class, goal is a method

6. References

6.1. Links

6.1.1. https://dzone.com/refcardz/apache-maven-2

6.2. Books

7. POM

7.1. What?

7.1.1. Project Object Model(POM)

7.1.2. it is a Maven project configuration file

7.1.3. is an XML file

7.1.4. located/placed in base dir of project

7.1.5. Maven reads pom.xml and executes a goal to build project

7.2. Elements*

7.2.1. project

7.2.2. modelVersion

7.2.3. groupId

7.2.4. artifactId

7.2.5. version

7.3. Configuration

7.3.1. Dependencies Transitive Dependencies Scope compile provided runtime test system import Structure in pom.xml <dependencies> <dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> <version>${scalaVersion}</version> </dependency> <dependencies>

7.3.2. Plugins

7.3.3. Goals

7.3.4. Build Profiles

7.4. Super POM

7.4.1. *POMs that extend a parent POM inherit certain values from that parent(just like Inheritance in Java). *All Project Object Models inherit from a base Super POM

7.4.2. General Dependencies

7.4.3. Def. of version numbers

7.4.4. General plugin and extensions

8. Repositories

8.1. What?

8.1.1. Maven searches for dependencies in the repositories

8.1.2. is a place/directory of packaged JAR files, project jars, library jar, plugins or any other project specific artifacts are stored

8.1.3. maven Searches first in Local then Central then Remote

8.2. Local

8.3. Central

8.4. Remote

9. Standard Project Structure

10. Installation

10.1. Windows

10.2. Linux

10.3. OSX

11. New Topic