Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Aphorismen
Applications
Business Economics & Admin.
My Computers
Cooking
Devices
Folders
Food
Hardware
Infos
Software Development
Sports
Operation Instructions
Todos
Test
Help
Glossary
Community portal
adaptions
Sidebar anpassen
Wiki RB4
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Maven
(section)
Page
Discussion
English
Read
Edit
View history
Toolbox
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Introduction== Maven is an attempt to apply patterns to a project's build infrastructure in order to promote comprehension and productivity by providing a clear path in the use of best practices. Maven is essentially a project management and comprehension tool and as such provides a way to help with managing: *Builds *Documentation *Reporting *Dependencies *SCMs *Releases *Distribution Maven is written in Java and is used to build projects written primariyl in Java, but also for C#, Scala, Ruby, etc. Based on the Project Object Model (POM), this tool has made the lives of Java developers easier while developing reports, checks build and testing automation setups. It defines a [https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html standard directory layout]. ===Lifecycles=== Maven beinhaltet als wichtiges Konzept genau definierte Build '''Lifecycles'''. Die drei eingebauten Standard-Lifecycle sind: * '''clean''' * '''default''', handles project build and deployment * '''site''', handles creation of documentation ===Phases=== Build Lifecycles bestehen aus Lifecycle bzw. Build-'''Phasen''', die sequentiell ausgeführt werden. mvn <PHASE> Beim Aufruf einer Phase werden vor der Phase auch die Vorgänger ausgeführt. The most common phases are (full list see [http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference here]): *clean *validate *compile *test *package: take the compiled code and package it in its distributable format, such as a JAR *integration-test *verify *install: install the package into local repository e.g. for use by different projects locally *site: generate documentation to /target/site *deploy: copy package to remote repository for sharing with other developers The '''default lifecycle''' is made up of the following phases: * validate * compile * test * package * verify * install * deploy ===Goals=== A build phase is made up of a set of '''goals'''. Goals sind somit kleinere Tasks und vergleichbar mit Ant-Tasks. Goals können auch mehreren Phasen zugeordnet werden, oder sogar keiner Phase. Einige Phasen haben Standard Goals. Goals können direkt mit der Syntax '''mvn''' <PLUGIN>''':'''<GOAL> aufgerufen. To list all goals of a phase by mvn help:describe -Dcmd=<PHASE> // e.g. mvn help:describe -Dcmd=compile To list all goals in order how they are executed mvn fr.jcgay.maven.plugins:buildplan-maven-plugin:list ===Plugins=== Maven-'''Plugins''' sind Bibliotheken, die thematisch zusammengehörende Goals implementieren bzw. Gruppen von Goals beinhalten. Wichtige Plugins sind zum Beispiel: *archetype *compiler *surefire *jar *war *install *deploy *site *dependency *eclipse *jetty. To list all goals of a plug-in mvn <PLUGIN>:help // e.g. mvn spring-boot:help or mvn exec:help ===Archetype=== Ein '''Archetype''' ist ein Projekt-Template. Über das archetype-Plugin können Standard-Directory-Layouts und Projektvorlagen für verschiedene Projekttypen erstellt werden (z.B. quickstart, webapp und mojo). Dabei wird auch eine vorläufige [[#pom.xml]] angelegt. Archetypes haben ===Artefakt=== '''Artefakt''' sind im Zusammenhang mit Maven Arbeitsergebnisse gemeint. Maven-Projekte haben in der Regel ein Hauptergebnis-Artefakt, oft eine jar-, war- oder ear-Datei. Artefakte werden in Repositories abgelegt. Mit '''Koordinaten''' werden die fünf ein Artefakt identifizierenden Informationsbestandteile bezeichnet. Oft sind vor allem die drei wichtigsten gemeint: * groupId (usually a reversed domain name), * artifactId (name of the root directory) * version (string). Maven uses the groupId, artifactId, and version to identify dependencies (usually other jar files) needed to build and run your code. Commonly a software project build with maven consists of many maven-projects that build artifacts (e.g. jars) that constitute the product. Each maven project has a unique identifier consiting of [groupId, artifactId, version]. When a maven project requires resources of another project a dependency is configured in it's pom.xml using the above-mentioned identifier. The artifacts of the required projects are then loaded either from the local repository, which is a simple directory in your user's home, or from other (remote) repositories specified in you pom.xml. In Java programmierte eigene Maven-Plugins bestehen aus '''Mojos'''. Ein Mojo ("Maven (plain) old Java Object") ist eine Java-Klasse die das Interface org.apache.maven.plugin.Mojo implementiert (oder org.apache.maven.plugin.AbstractMojo erweitert) und damit ein Plugin-Goal realisiert. ===Profiles=== '''Profiles''' let you customize the build for different environments. Often you have property files that specify database connections and passwords for your development, staging, and production environment. Profiles can obviously be defined on different levels and can contain different specifications e.g. <profiles> <profile> <id>local_dev</id> <activation> <activeByDefault>true</activeByDefault> </activation> <dependencies> <dependency> ... Profiles are activated by the -P parameter e.g. <code>mvn clean install -Plocal_dev</code>.
Summary:
Please note that all contributions to Wiki RB4 may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Uwe Heuer Wiki New:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width