C4 - Lesson 3: Dependency Management with Maven Flashcards
What is a plugin?
- Any application that performs actions during the maven build process.
- perform goals
Ex: packaging
Plugin Management vs. Plugins.
- Plugins: customization for this project only
- PluginManagement: customization for all projects that inherit this as well
How to configure plugins?
You can pass additional properties to plugins using the element [configure]
What is mavens default lifecycle
Validate, compile, test, package, install, deploy.
How to run a specific phase?
mvn {phase}
It will execute all previous phase and the phase
Pom 4 required elements:
- modelVersion: The format of the current pom. Should always be 4.0.0 at this time.
- groupId: The group identifier for your project. Can be shared with other projects.
- artifactId: The specific identifier for this project. Combination of artifactId and groupId uniquely identifies your project.
What is maven standard layout?
src:
main: Contains source code and resources related to your project.
test: Contains source code and resources for testing your project.
java: Both Java folders hold your .java source files.
resources: Contains non-java files related to running and building your project. Commonly holds properties files, images
filters: Contains resource filter files that Maven will use when filtering resources. Property files inject values
Maven benefits:
Maven can automatically download project dependencies and include them as part of your project build
What is Dependency Scope?
The scope element of a dependency tells Maven when to include that dependency.
- Compile: Default scope. Dependency will be available for all Maven actions.
- Test, Runtime
What are transitive dependencies?
- A transitive dependency is a resource required by one of the dependencies included in your project.
- If your project has multiple transitive dependencies, the nearest definition will win.
How to Resolving Transitive Dependencies
- Directly include the dependency in question. The version you use will become the nearest definition and be selected by Maven.
- Use the [exclusion] tag to specifically exclude versions you do not wish to use.
What uniquely identifies your project.
Combination of artifactId and groupId uniquely identifies your project.
How to create a New Maven Project
You can create Maven projects running the archetype:generate goal
How to add Maven Run Configurations?
You can save various Maven commands as run configurations. Click Add Configuration on the above screen and then use the + icon and scroll down to Maven
How to execute maven phases in IntelliJ?
opening the Maven tools window on the right side of your IDE, expanding the lifecycle category, and then right clicking on the phase you want to run