Maven Getting Started log (Windows)

table of Contents

A. Download

II. Installation

III. Create a project

IV. Project Inheritance

* Maven - * Commands (Google translation)


 

A. Download

https://maven.apache.org/download.cgi

II. Installation

Unzip apache-maven-3.6.1-bin.zip

The bin file with mvn command folder to the PATH environment variable (similarly configured java environment variables)

In cmd Input: mvn -v to confirm the following results

III. Create a project

In cmd, enter:

mvn -B archetype:generate -D archetypeGroupId=org.apache.maven.archetypes -D groupId=com.mycompany.app -D artifactId=my-app

The src/main/javadirectory contains the source code for the project, the src/test/javadirectory that contains the test source pom.xmlfile is a project object model of the project or POM.

Integrated IDEA, marked the district to replace its own download

IV. Project Inheritance

1

  • |-- my-module
  • | `- pom.xml
  • `- pom.xml
  1. <project>
  2. <parent>
  3. <groupId>com.mycompany.app</groupId>
  4. <artifactId>my-app</artifactId>
  5. <version>1</version>
  6. </parent>
  7. <modelVersion>4.0.0</modelVersion>
  8. <groupId> com.mycompany.app </ groupId> ( overlapping portion )
  9. <artifactId>my-module</artifactId>
  10. <version> 1 </ version> ( overlapping portion )
  11. </project>

  Sub-module may be removed redeclaration parent direct reference module

  1. <project>
  2. <parent>
  3. <groupId>com.mycompany.app</groupId>
  4. <artifactId>my-app</artifactId>
  5. <version>1</version>
  6. </parent>
  7. <modelVersion>4.0.0</modelVersion>
  8. <artifactId>my-module</artifactId>
  9. </project>

2

  • | - My - Modules
  • | | | `- pom.xml
  • `- parents
  • `- pom.xml
  1. <project>
  2. <parent>
  3. <groupId>com.mycompany.app</groupId>
  4. <artifactId>my-app</artifactId>
  5. <version>1</version>
  6. <relativePath>../parent/pom.xml</relativePath>
  7. </parent>
  8. <modelVersion>4.0.0</modelVersion>
  9. <artifactId>my-module</artifactId>
  10. </project>

relativePath name suggests, it is from the module pom.xmlrelative to the path of the parent module pom.xml.

V. everyday use and conceptual understanding

1:

生命周期clean、validate、compile、test、package、verify、install、site、deploy.

Development in general can be performed by the following sequence

clean: In addition to the project file and compile local warehouse packed files (ie local install file)

compile: That file is compiled java project, compiled and stored in the project directory

install the package code stored in the local maven repository available for other projects depend on local use

Note: Package Penalty for is to hit the jar next target of this project, while install the target of a jar attached to a local warehouse for other projects.

2

SNAPSHOT version is the final 'publication' development 'versions of the previous version. SNAPSHOT version than its "older."

* Maven - * Commands (Google translation)

-am, - also-make list specifies if the project is also to establish a list of items needed for the project
 -amd, - items on the also-make-dependents If you specify a list of items, but also to build a list of projects rely
 -B, - approved in the non-interactive processing mode (batch processing) the operating mode (color output disabled)
 -b, - Builder <Arg> Construction use policy ID
 -C, - strict-checksums checksum and if not, the game fails to build
 -c , - lax-checksums If the checksums do not match, a warning is issued
 -cpu, - check-plugin-updates invalid, leaving only the backward compatibility
 -D, - define <arg> system properties defined
 -e, - errors generated execution error message
 -emp, - encrypt-master-password <arg> primary security encryption password
 -ep, - encrypt-password <arg > password encryption server
 -f, - file <arg> forced spare POMfile (with or pom.xml directory)
 -fae, - the only fail-at-end after a build failure; allows all unaffected continue to build
 -ff, - fail-fast reactor construction stopped at the first failure
 -fn, - fail-never never let you fail to build anyway Results project
 -gs, - global-settings <arg > global backup path setting file
 -gt, - global-toolchains <arg > Global alternate path tool chain file
 -h, - help display help information
 -l, - log-file <arg > all log files to build the output (output color disabled)
 -llr , - legacy-local-repository using Maven 2 Legacy local repository behavior, that is, without the use of _remote.repositories. It may be activated by using real -Dmaven.legacyLocalRepo =
 -N, - non-recursive sub not in the recursive
 -npr, - no-plugin-registry invalid, leaving only the backward compatibility
 -npu, - no-plugin-updates invalid, leaving only the backward compatibility
 -nsu, - no-snapshot-updates inhibition SNAPSHOT update
 -ntp, - no-transfer-progress is not displayed when the transfer progress download or upload
 -o, - offline work offline
 -P, - activate -profiles <arg> a comma-separated list of profiles to activate
 -pl, - projects <arg> specify a comma-separated list of reactor construction projects all projects. An item can be specified by [groupId]: artifactId or by its relative path
 -q, - Jingjing tone output - displays only error
 -rf, - resume-from <arg > Resume reactor specified item from
 -s, - settings <arg> user backup path setting file
 -t, - toolchains <arg> user file alternate path tool chain
 -T, - threads <arg> thread count, e.g. 2.0C where C is the core multiplication
 -U , - update-snapshots mandatory check for missing publish and update remote snapshot repository
 -up, - update-plugins invalid, leaving only the backward compatibility
 -v, - version display version information
 -V, - show-version display version information is not stop building
 -X, - debug output is generated to perform debugging

Published 52 original articles · won praise 7 · views 10000 +

Guess you like

Origin blog.csdn.net/YKWNDY/article/details/98636285