maven.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 29 May 2019 23:17:25 +0300
changeset 2370 a3abad65bf9f
parent 2230 9e6ad6607a9e
child 2394 7df4f3650b8a
permissions -rw-r--r--
Fixed spelling.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1395
afa2a45a49fa Search for maven artifact by Java package or class name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
.. -*- coding: utf-8; -*-
afa2a45a49fa Search for maven artifact by Java package or class name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
afa2a45a49fa Search for maven artifact by Java package or class name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
========
afa2a45a49fa Search for maven artifact by Java package or class name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
 Maven.
afa2a45a49fa Search for maven artifact by Java package or class name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
========
afa2a45a49fa Search for maven artifact by Java package or class name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
.. contents::
1905
fba288d59662 Include only local subsections into TOC. This prevent duplication of
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1679
diff changeset
     7
   :local:
1395
afa2a45a49fa Search for maven artifact by Java package or class name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
1396
f5ac2d7c9317 Maven tutorial. Generate simple project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1395
diff changeset
     9
Maven tutorial.
f5ac2d7c9317 Maven tutorial. Generate simple project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1395
diff changeset
    10
===============
f5ac2d7c9317 Maven tutorial. Generate simple project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1395
diff changeset
    11
2228
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2139
diff changeset
    12
* http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2139
diff changeset
    13
* http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
1396
f5ac2d7c9317 Maven tutorial. Generate simple project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1395
diff changeset
    14
1439
afa9be44e23c Maven FAQ.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1421
diff changeset
    15
Maven FAQ.
afa9be44e23c Maven FAQ.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1421
diff changeset
    16
==========
afa9be44e23c Maven FAQ.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1421
diff changeset
    17
2228
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2139
diff changeset
    18
* http://maven.apache.org/general.html
1439
afa9be44e23c Maven FAQ.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1421
diff changeset
    19
1440
712f5bd9d59b Maven plugins.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1439
diff changeset
    20
Maven plugins.
712f5bd9d59b Maven plugins.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1439
diff changeset
    21
==============
712f5bd9d59b Maven plugins.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1439
diff changeset
    22
2228
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2139
diff changeset
    23
* http://maven.apache.org/plugins/
1440
712f5bd9d59b Maven plugins.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1439
diff changeset
    24
1581
84a5029867c2 Maven config location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1580
diff changeset
    25
Maven config location.
84a5029867c2 Maven config location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1580
diff changeset
    26
======================
84a5029867c2 Maven config location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1580
diff changeset
    27
84a5029867c2 Maven config location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1580
diff changeset
    28
``~/.m2/settings.xml``.
84a5029867c2 Maven config location.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1580
diff changeset
    29
2109
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    30
Maven package repositories
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    31
==========================
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    32
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    33
Maven Central official aliases (in past - mirrors):
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    34
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    35
* https://repo1.maven.org/maven2/
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    36
* https://uk.maven.org/maven2/
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    37
* https://central.maven.org/maven2/
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    38
2110
1cf4c735fa6d Spring repos.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2109
diff changeset
    39
Spring repos is server by Artifactory and available on:
2109
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    40
2110
1cf4c735fa6d Spring repos.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2109
diff changeset
    41
* https://repo.spring.io/
1cf4c735fa6d Spring repos.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2109
diff changeset
    42
* https://maven.springframework.org/
2109
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    43
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    44
Sonatype Releases Repository:
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    45
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    46
* https://oss.sonatype.org/content/repositories/releases/
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    47
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    48
NetBeans:
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    49
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    50
* http://bits.netbeans.org/maven2/
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    51
2110
1cf4c735fa6d Spring repos.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2109
diff changeset
    52
JBoss Enterprise Maven Repository:
1cf4c735fa6d Spring repos.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2109
diff changeset
    53
1cf4c735fa6d Spring repos.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2109
diff changeset
    54
* https://maven.repository.redhat.com/ga/
1cf4c735fa6d Spring repos.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2109
diff changeset
    55
2109
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    56
https://mvnrepository.com/repos
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    57
  List of popular public Maven repositories.
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    58
http://blog.sonatype.com/2010/10/new-official-maven-central-repository-in-europe/
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    59
  New official Maven Central repository in Europe.
f6f8041d49d6 Maven package repositories
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2089
diff changeset
    60
1396
f5ac2d7c9317 Maven tutorial. Generate simple project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1395
diff changeset
    61
Generate simple project.
f5ac2d7c9317 Maven tutorial. Generate simple project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1395
diff changeset
    62
========================
f5ac2d7c9317 Maven tutorial. Generate simple project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1395
diff changeset
    63
::
f5ac2d7c9317 Maven tutorial. Generate simple project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1395
diff changeset
    64
f5ac2d7c9317 Maven tutorial. Generate simple project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1395
diff changeset
    65
  $ mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
f5ac2d7c9317 Maven tutorial. Generate simple project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1395
diff changeset
    66
1665
45c70a566ed9 Debug Maven build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1663
diff changeset
    67
Debug Maven build.
45c70a566ed9 Debug Maven build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1663
diff changeset
    68
==================
45c70a566ed9 Debug Maven build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1663
diff changeset
    69
45c70a566ed9 Debug Maven build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1663
diff changeset
    70
Run build with ``-X`` option for verbose logging.
45c70a566ed9 Debug Maven build.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1663
diff changeset
    71
1662
2fc04c90ddd3 Introduction to the Standard Directory Layout.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1632
diff changeset
    72
Project directory layout.
2fc04c90ddd3 Introduction to the Standard Directory Layout.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1632
diff changeset
    73
=========================
2fc04c90ddd3 Introduction to the Standard Directory Layout.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1632
diff changeset
    74
2230
9e6ad6607a9e Fixed formatting.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2228
diff changeset
    75
http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
9e6ad6607a9e Fixed formatting.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2228
diff changeset
    76
  Introduction to the Standard Directory Layout.
1662
2fc04c90ddd3 Introduction to the Standard Directory Layout.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1632
diff changeset
    77
1395
afa2a45a49fa Search for maven artifact by Java package or class name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    78
Search for maven artifact by Java package or class name.
afa2a45a49fa Search for maven artifact by Java package or class name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    79
========================================================
afa2a45a49fa Search for maven artifact by Java package or class name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    80
2228
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2139
diff changeset
    81
* https://repository.sonatype.org/
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2139
diff changeset
    82
* http://search.maven.org/
1395
afa2a45a49fa Search for maven artifact by Java package or class name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    83
2087
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    84
Get help on Maven plug-in
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    85
=========================
1397
d96348dbf006 Get help on Maven plug-in.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1396
diff changeset
    86
::
d96348dbf006 Get help on Maven plug-in.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1396
diff changeset
    87
d96348dbf006 Get help on Maven plug-in.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1396
diff changeset
    88
  $ mvn help:describe -DartifactId=maven-war-plugin -DgroupId=org.apache.maven.plugins
d96348dbf006 Get help on Maven plug-in.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1396
diff changeset
    89
  $ mvn help:describe -Dcmd=dependency:resolve -Ddetail
d96348dbf006 Get help on Maven plug-in.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1396
diff changeset
    90
d96348dbf006 Get help on Maven plug-in.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1396
diff changeset
    91
  $ mvn -X ...
d96348dbf006 Get help on Maven plug-in.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1396
diff changeset
    92
1580
638073b869c6 Fix docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1512
diff changeset
    93
What actual code processed by Maven (dump Maven config)::
1412
77b08d4c703b What actual code processed by Maven.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1398
diff changeset
    94
1414
a1792156210d mvn help:effective-settings
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1413
diff changeset
    95
  $ mvn help:effective-settings
1412
77b08d4c703b What actual code processed by Maven.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1398
diff changeset
    96
  $ mvn help:effective-pom
77b08d4c703b What actual code processed by Maven.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1398
diff changeset
    97
2087
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    98
Investigating and resolving dependencies
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    99
========================================
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   100
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   101
List dependencies::
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   102
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   103
  $ mvn dependency:tree
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   104
  $ mvn dependency:list
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   105
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   106
Resolve dependencies::
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   107
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   108
  $ mvn dependency:resolve
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   109
  $ mvn dependency:resolve-plugins
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   110
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   111
Just download dependencies::
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   112
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   113
  $ mvn dependency:get
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   114
2133
e966e3f7378f Download specific dependency.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2110
diff changeset
   115
or download specific dependency::
e966e3f7378f Download specific dependency.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2110
diff changeset
   116
e966e3f7378f Download specific dependency.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2110
diff changeset
   117
  $ mvn dependency:get -Dartifact=$groupId:$artifactId:$version
e966e3f7378f Download specific dependency.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2110
diff changeset
   118
2087
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   119
Reason for inclusion or omitting dependencies::
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   120
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   121
  $ mvn dependency:tree -Dverbose=true
20c626d79da8 Investigating and resolving dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   122
2134
a83e8b6cbf8b Latest dependency version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2133
diff changeset
   123
Update ``pom.xml`` with latest dependency version::
a83e8b6cbf8b Latest dependency version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2133
diff changeset
   124
a83e8b6cbf8b Latest dependency version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2133
diff changeset
   125
  $ mvn versions:use-latest-releases -Dincludes=$groupId:$artifactId
a83e8b6cbf8b Latest dependency version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2133
diff changeset
   126
2135
3b94fc89d75a Print build classpath.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2134
diff changeset
   127
Print build classpath::
3b94fc89d75a Print build classpath.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2134
diff changeset
   128
3b94fc89d75a Print build classpath.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2134
diff changeset
   129
  $ mvn dependency:build-classpath
3b94fc89d75a Print build classpath.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2134
diff changeset
   130
2088
e42e4484ff0b Reoder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2087
diff changeset
   131
Download all external dependencies sources and javadocs
e42e4484ff0b Reoder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2087
diff changeset
   132
=======================================================
e42e4484ff0b Reoder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2087
diff changeset
   133
::
e42e4484ff0b Reoder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2087
diff changeset
   134
e42e4484ff0b Reoder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2087
diff changeset
   135
  mvn dependency:resolve -Dclassifier=javadoc
e42e4484ff0b Reoder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2087
diff changeset
   136
  mvn dependency:resolve -Dclassifier=sources
e42e4484ff0b Reoder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2087
diff changeset
   137
2133
e966e3f7378f Download specific dependency.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2110
diff changeset
   138
Force update of dependencies
e966e3f7378f Download specific dependency.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2110
diff changeset
   139
============================
1679
f0434ace37ce Order to perform really clean download.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1678
diff changeset
   140
f0434ace37ce Order to perform really clean download.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1678
diff changeset
   141
You can try redownload snapshots by::
1678
b06128a21eca Force update of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1666
diff changeset
   142
b06128a21eca Force update of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1666
diff changeset
   143
  $ mvn -U compile
b06128a21eca Force update of dependencies.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1666
diff changeset
   144
1679
f0434ace37ce Order to perform really clean download.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1678
diff changeset
   145
You can fix damaged local ``~/.m2`` with::
f0434ace37ce Order to perform really clean download.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1678
diff changeset
   146
f0434ace37ce Order to perform really clean download.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1678
diff changeset
   147
  $ mvn dependency:purge-local-repository
f0434ace37ce Order to perform really clean download.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1678
diff changeset
   148
f0434ace37ce Order to perform really clean download.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1678
diff changeset
   149
In order to perform really clean download::
f0434ace37ce Order to perform really clean download.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1678
diff changeset
   150
f0434ace37ce Order to perform really clean download.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1678
diff changeset
   151
  $ mvn -Dmaven.repo.local=$HOME/.my/other/repository clean install
f0434ace37ce Order to perform really clean download.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1678
diff changeset
   152
2138
1130d83b83ae Find newer library and plugin versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2135
diff changeset
   153
Find newer library and plugin versions
1130d83b83ae Find newer library and plugin versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2135
diff changeset
   154
======================================
1663
01e26f1cb256 Find newer library and plugin versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1662
diff changeset
   155
01e26f1cb256 Find newer library and plugin versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1662
diff changeset
   156
Check commands from ``versions-maven-plugin``::
01e26f1cb256 Find newer library and plugin versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1662
diff changeset
   157
01e26f1cb256 Find newer library and plugin versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1662
diff changeset
   158
  $ mvn versions:display-dependency-updates
01e26f1cb256 Find newer library and plugin versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1662
diff changeset
   159
  $ mvn versions:display-plugin-updates
01e26f1cb256 Find newer library and plugin versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1662
diff changeset
   160
2138
1130d83b83ae Find newer library and plugin versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2135
diff changeset
   161
Update ``pom.xml`` with latest dependency version::
1130d83b83ae Find newer library and plugin versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2135
diff changeset
   162
1130d83b83ae Find newer library and plugin versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2135
diff changeset
   163
  $ mvn versions:use-latest-releases -Dincludes=$groupId:$artifactId
1130d83b83ae Find newer library and plugin versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2135
diff changeset
   164
1130d83b83ae Find newer library and plugin versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2135
diff changeset
   165
Update all versions in ``pom.xml`` to latest::
1130d83b83ae Find newer library and plugin versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2135
diff changeset
   166
1130d83b83ae Find newer library and plugin versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2135
diff changeset
   167
  $ mvn versions:use-latest-releases
2139
4fb937ae8807 More details about ``versions`` plugin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2138
diff changeset
   168
  $ rm pom.xml.versionsBackup
4fb937ae8807 More details about ``versions`` plugin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2138
diff changeset
   169
4fb937ae8807 More details about ``versions`` plugin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2138
diff changeset
   170
or::
4fb937ae8807 More details about ``versions`` plugin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2138
diff changeset
   171
4fb937ae8807 More details about ``versions`` plugin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2138
diff changeset
   172
  $ mvn versions:use-latest-releases -DgenerateBackupPoms=false
4fb937ae8807 More details about ``versions`` plugin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2138
diff changeset
   173
4fb937ae8807 More details about ``versions`` plugin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2138
diff changeset
   174
Remove all ``SNAPSHOT`` versions::
4fb937ae8807 More details about ``versions`` plugin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2138
diff changeset
   175
4fb937ae8807 More details about ``versions`` plugin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2138
diff changeset
   176
  $ mvn versions:use-releases -DgenerateBackupPoms=false
4fb937ae8807 More details about ``versions`` plugin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2138
diff changeset
   177
4fb937ae8807 More details about ``versions`` plugin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2138
diff changeset
   178
More details about ``versions`` plugin::
4fb937ae8807 More details about ``versions`` plugin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2138
diff changeset
   179
4fb937ae8807 More details about ``versions`` plugin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2138
diff changeset
   180
  $ mvn help:describe -Dplugin=versions
4fb937ae8807 More details about ``versions`` plugin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2138
diff changeset
   181
  $ mvn help:describe -Dplugin=versions -Ddetail
2138
1130d83b83ae Find newer library and plugin versions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2135
diff changeset
   182
1398
c96c3d6857ea Run Java main from Maven.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1397
diff changeset
   183
Run Java main from Maven.
c96c3d6857ea Run Java main from Maven.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1397
diff changeset
   184
=========================
c96c3d6857ea Run Java main from Maven.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1397
diff changeset
   185
::
c96c3d6857ea Run Java main from Maven.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1397
diff changeset
   186
c96c3d6857ea Run Java main from Maven.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1397
diff changeset
   187
  mvn exec:java -Dexec.mainClass="com.vineetmanohar.module.Main" -Dexec.args="arg0 arg1 arg2"
c96c3d6857ea Run Java main from Maven.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1397
diff changeset
   188
1446
6c935c71520e How to run single unit test?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1445
diff changeset
   189
How to run single unit test?
6c935c71520e How to run single unit test?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1445
diff changeset
   190
============================
1512
db0fedd5662e How to run single unit test?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1465
diff changeset
   191
db0fedd5662e How to run single unit test?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1465
diff changeset
   192
``test`` property substituded to ``**/${test}.java`` pattern and override any
db0fedd5662e How to run single unit test?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1465
diff changeset
   193
include/exclude patterns::
1446
6c935c71520e How to run single unit test?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1445
diff changeset
   194
6c935c71520e How to run single unit test?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1445
diff changeset
   195
  $ mvn test -Dtest=SeriousComponentTest
6c935c71520e How to run single unit test?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1445
diff changeset
   196
1512
db0fedd5662e How to run single unit test?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1465
diff changeset
   197
or mostly same::
db0fedd5662e How to run single unit test?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1465
diff changeset
   198
db0fedd5662e How to run single unit test?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1465
diff changeset
   199
  $ mvn test-compile surefire:test -Dtest=RunMe
db0fedd5662e How to run single unit test?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1465
diff changeset
   200
1413
07f163d43116 How do I skip the tests during the default lifecycle?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1412
diff changeset
   201
How do I skip the tests during the default lifecycle?
07f163d43116 How do I skip the tests during the default lifecycle?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1412
diff changeset
   202
=====================================================
07f163d43116 How do I skip the tests during the default lifecycle?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1412
diff changeset
   203
::
07f163d43116 How do I skip the tests during the default lifecycle?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1412
diff changeset
   204
07f163d43116 How do I skip the tests during the default lifecycle?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1412
diff changeset
   205
  $ mvn -DskipTests package
1666
bdc52dabc6e9 maven.test.skip
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1665
diff changeset
   206
  $ mvn -Dmaven.test.skip=true package
1413
07f163d43116 How do I skip the tests during the default lifecycle?
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1412
diff changeset
   207
1632
e04a32e3e1d6 Fix typo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1631
diff changeset
   208
Deploy parent pom without building children.
e04a32e3e1d6 Fix typo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1631
diff changeset
   209
============================================
1631
d18d900b5023 Deploy parent pom without building childs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1581
diff changeset
   210
::
d18d900b5023 Deploy parent pom without building childs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1581
diff changeset
   211
d18d900b5023 Deploy parent pom without building childs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1581
diff changeset
   212
  $ mvn -N deploy
d18d900b5023 Deploy parent pom without building childs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1581
diff changeset
   213
2089
8cb9302cc62b Install file to local repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2088
diff changeset
   214
Install file to local repository
8cb9302cc62b Install file to local repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2088
diff changeset
   215
================================
8cb9302cc62b Install file to local repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2088
diff changeset
   216
::
8cb9302cc62b Install file to local repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2088
diff changeset
   217
8cb9302cc62b Install file to local repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2088
diff changeset
   218
  $ mvn install:install-file -Dfile=... -DgroupId=... -DartifactId=... -Dversion=...
8cb9302cc62b Install file to local repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2088
diff changeset
   219
8cb9302cc62b Install file to local repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2088
diff changeset
   220
Additional option provides packaging type (JAR/WAR), source and javadoc files::
8cb9302cc62b Install file to local repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2088
diff changeset
   221
8cb9302cc62b Install file to local repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2088
diff changeset
   222
  -Dpackaging=...
8cb9302cc62b Install file to local repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2088
diff changeset
   223
  -Dsource=...
8cb9302cc62b Install file to local repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2088
diff changeset
   224
  -Djavadoc=...
8cb9302cc62b Install file to local repository.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2088
diff changeset
   225
1447
d4399aacf09e Run Ant from Maven.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1446
diff changeset
   226
Run Ant from Maven.
d4399aacf09e Run Ant from Maven.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1446
diff changeset
   227
===================
d4399aacf09e Run Ant from Maven.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1446
diff changeset
   228
2228
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2139
diff changeset
   229
* https://support.sonatype.com/entries/20736282-executing-an-external-ant-script-in-a-maven-build
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2139
diff changeset
   230
* https://support.sonatype.com/entries/20723081-running-an-inline-ant-script-in-a-maven-build
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2139
diff changeset
   231
* https://support.sonatype.com/entries/20744068-writing-a-maven-plugin-with-ant
1447
d4399aacf09e Run Ant from Maven.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1446
diff changeset
   232