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

1.1.1.1. pre-clean

1.1.1.1.1. mvn pre-clean

1.1.1.2. clean

1.1.1.2.1. mvn clean or mvn clean:clean(plugin included in pom)

1.1.1.3. post-clean

1.1.1.3.1. mvn post-clean

1.2. default/build

1.2.1. phases

1.2.1.1. validate

1.2.1.1.1. mvn validate

1.2.1.2. compile

1.2.1.2.1. mvn compile or mvn compiler:compile(include plugin)

1.2.1.3. test

1.2.1.3.1. mvn test or mvn surefire:test(include plugin in pom)

1.2.1.4. package

1.2.1.4.1. "mvn package" or mvn jar:jar/mvn war:war etc

1.2.1.5. verify

1.2.1.5.1. mvn verify

1.2.1.6. install

1.2.1.6.1. mvn install

1.2.1.7. deploy

1.2.1.7.1. mvn deploy

1.3. site

1.3.1. phases

1.3.1.1. pre-site

1.3.1.2. site

1.3.1.2.1. mvn site or mvn site:site(include plugin in pom.xml)

1.3.1.3. post-site

1.3.1.4. site-deploy

1.3.1.4.1. 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

4.3.5.1. Eclipse

4.3.5.1.1. mvn eclipse:eclipse

4.3.5.2. IntelliJ

4.3.5.2.1. 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

7.3.1.1. Transitive Dependencies

7.3.1.2. Scope

7.3.1.2.1. compile

7.3.1.2.2. provided

7.3.1.2.3. runtime

7.3.1.2.4. test

7.3.1.2.5. system

7.3.1.2.6. import

7.3.1.3. Structure in pom.xml

7.3.1.3.1. <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