--Learn about Maven at the following site and curate (summary) what you learned
https://www.techscore.com/tech/Java/ApacheJakarta/Maven/index/
--Software PJ management tool developed by ʻApache Software Foundation --Manage PJ life cycle with the idea of
Project Object Model (POM) -<font color = "Red"> All PJ information is aggregated in
pom.xml` </ font>
――The merit is ** Support function to support developers to understand PJ in a short period of time **
--The disadvantage is that you can't benefit if you don't understand Maven **
--Available from the following site
https://maven.apache.org/download.cgi
--Qiita article that will be helpful for introduction
https://qiita.com/saitoryc/items/737ee9e711f1ebe0dcfa
参照元:https://www.techscore.com/tech/Java/ApacheJakarta/Maven/index/
--Each task can be performed using the mvn command
--The build method is the same even if the PJ is different ( Advantages of Maven </ font>)
--Plugins and libraries are placed in local / remote repositories
--Life cycle flow
① PJ creation
② Compile
③ Unit test
④ Documentation
⑤JAR creation
⑥ Reflection in local repository
⑦ Reflection in remote repository
⑧ PJ clear
--Execute the mvn command
--Specify the task you want to perform with an argument
--Set conf / setting.xml
according to the environment
--You can check the unknown part with -help argument
--Check points for each life cycle
--You can create a PJ template (skeleton)
--pom.xml
is created by default
--Standard directory structure is recommended
--Files required to create artifacts are placed under src
|path|Commentary|
|:--|:--|
|src/main/java|java source code|
|src/test/java|Java source code for testing|
--Each element of pom.xml
|element|Commentary|
| :-- | :-- |
| modelversion |POM version
* No special changes required|
| groupId |A name that uniquely identifies the PJ.
It is common to specify the root package name of PJ.|
| artifactId |The name of the PJ artifact.
Jar to create/Used for names such as war.|
| packaging |The package type of the artifact to be created.
The default is jar.|
| version |PJ version.|
| name |Display name of PJ.
Used when creating documents.|
| url |URL of PJ's site.
Used when creating documents.|
| dependencies |Information about the libraries that PJ depends on.|
$ mvn archetype:generate -DgroupId=<ID> -DartifactId=<ID>
[Explanation of arguments]
- archetype:generate → Arguments that specify template creation
- -DgroupId → PJ root package name
- -DartifactId → PJ name
--Convert source code to PJ executable format (.class)
--The created class file will be output under target / class
$ mvn compile
$ mvn test
--By default, files that meet the following conditions are run as tests
```
*/Test.java **/*Test.java **/*TestCase.java
--By default, files that meet the following conditions are excluded from the test
```
**/Abstract*Test.java
**/Abstract*TestCase.java
**/*$*
--Javadoc is placed under target / javadoc
$ mvn javadoc:javadoc
--By default, necessary information is placed under src / site
--Information on site creation can be found in src / site / site.xml
$ mvn site
--The name of the JAR file is determined from ʻartifactId and
versionin
pom.xml`
--JAR file is placed under target
mvn package
--The created JAR file can be installed (reflected) in the local repository. --When the installation (reflection) is completed, you can refer to it from other PJs.
mvn install
--It is necessary to set the required repository information in pom.xml
--Add a repository
element as a nest of the pom.xml> project / project / distributionManagement
element
--Child element of repository
|Element name|Commentary|
|:--|:--| |id|Repository identifier| |name|The name of the repository| |url|URL indicating the location of the repository|
$ mvn deploy
--Delete the subordinate of target
$ mvn clean
Recommended Posts