0% found this document useful (0 votes)
52 views1 page

Cheat Sheet: Getting Started With Maven

Maven Cheat Sheet

Uploaded by

mohangbox
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views1 page

Cheat Sheet: Getting Started With Maven

Maven Cheat Sheet

Uploaded by

mohangbox
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

For m ore

awesom
cheat sheet vis it rebe e cheat s heets
ll abs.org!

Getting started with Maven Useful command line options Essential plugins
Create Java project -DskipTests=true compiles the tests, but skips Help plugin — used to get relative information about a
mvn archetype:generate running them project or the system.
-DgroupId=org.yourcompany.project mvn help:describe describes the attributes of a plugin
-DartifactId=application -Dmaven.test.skip=true skips compiling the tests mvn help:effective-pom displays the effective POM
and does not run them
as an XML for the current build, with the active profiles
Create web project -T - number of threads: factored in.
mvn archetype:generate -T 4 is a decent default
-DgroupId=org.yourcompany.project -T 2C - 2 threads per CPU Dependency plugin — provides the capability to
-DartifactId=application manipulate artifacts.
-DarchetypeArtifactId=maven-archetype-webapp -rf, --resume-from resume build from the mvn dependency:analyze analyzes the dependencies
specified project of this project
mvn dependency:tree prints a tree of dependencies
Create archetype from existing project -pl, --projects makes Maven build only specified
mvn archetype:create-from-project modules and not the whole project
Compiler plugin — compiles your java code.
-am, --also-make makes Maven figure out what Set language level with the following configuration:
Main phases
modules out target depends on and build them too <plugin>
clean — delete target directory
<groupId>org.apache.maven.plugins</groupId>
validate — validate, if the project is correct
-o, --offline work offline <artifactId>maven-compiler-plugin</
compile — compile source code, classes stored
artifactId>
in target/classes -X, --debug enable debug output
<version>3.6.1</version>
test — run tests
-P, --activate-profiles comma-delimited list <configuration>
package — take the compiled code and package it in its
of profiles to activate <source>1.8</source>
distributable format, e.g. JAR, WAR
<target>1.8</target>
verify — run any checks to verify the package is valid
-U, --update-snapshots forces a check for updated </configuration>
and meets quality criteria
dependencies on remote repositories </plugin>
install — install the package into the local repository
deploy — copies the final package to the remote repository -ff, --fail-fast stop at first failure Version plugin — used when you want to manage
the versions of artifacts in a project's POM.

compile maven-compiler-plugin compiler:compile Wrapper plugin — an easy way to ensure


Plugins
Central Dependencies
a user of your Maven build has everything
that is necessary.
test
Spring Boot plugin — compiles your
Local Repository Spring Boot app, build an executable fat jar.
~/.m2/settings.xml package maven-jar-plugin jar:jar
Exec — amazing general purpose plugin,
can run arbitrary commands :)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy