Q1: What’s maven?
Maven is one project management system which is actually a plugin execution framework where every task is done by its’ plugins
Q2: How many standard life circles does maven usually have?
Maven has 3 standard life circles:
- clean
- default(or build)
- site
Q3: Based Q2, for each life circle, what phases does it have?
each life circle has several phases.
1.clean lifecycle
It has three phases: pre-clean, clean and post-clean
2. default (or build) lifecycle
It has 21 phases which are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy
3. site lifecycle
It has four phases: pre-site, site, post-site, site-deploy
Q4: which command can be used to see dependency tree?
mvn dependency:tree
Q5:What are dependencyManagement和pluginManagement used for?
dependencyManagement is used for managing dependencies across parent and its’ children especially for managing version across parent and its’ children
pluginManagement is used for defining build information across parent and its’ children
Q6. What is the difference between dependencyManagement and dependencies?
dependencyManagement focuses on lowering the conflicts caused by using different version/scope for a specific jar across parent and its’ children. In other words, child will apply version/scope declared in its’ parent’s POM only if the child doesn’t specify the version/scope. And dependencyManagement is just a declaration which means child doesn’t download a dependency if it is not declared in children’s POM.
dependencies focuses on addressing 3-party dependencies.
all of dependencies delared in parent wil be definitly downloaded
Q7. How to check the goal for a plugin?
mvn help:describe -Dplugin=groupId:artifactId
Q8. what types does maven repository have? what’s the search order?
local, central, remote( developer’s own custom repository )
search order: local -> central -> remote
Q9. What’s maven profile used for?
It is used to define a set of configuration values which can be used to set/overwrite default values in maven build
Q10. How to check super POM:
mvn help:effective-pom
Q11. what are the scope for a dependency?
compile、provided、runtime、system、test、import
Q12. How to deal with external dependency?
< scope >system</ scope >
< systemPath>xxx</ systemPath>
xxx is the dir where we put the external jars