generate
If you execute the above command at the terminal command prompt, the Maven project will start to be created. (* Maven must be installed. In my case, I installed it with homebrew.)
Then you will be asked the following, so I will answer as follows.
```choose a number or apply filter```
The above message comes out. This is the group ID specification.
Enter if you don't need to set the filter.
#### **`Choose org.apache.maven.archetypes:maven-archetype-quickstart version:`**
Select the version you want to use from the list. Enter if there is nothing in particular.
Define value for property ‘groupId’::
This is the project group ID.
Basically specify the package to place the program to be created.
Enter the package name appropriately
(Example: jp.tuyano.spring.sample1)
#### **`Define value for property ‘artifactId’::`**
Enter the Artifact ID. Enter the name of the project. (Example: MySampleApp1)
Define value for property ‘version’: 1.0-SNAPSHOT::
Version name. 1.0-SNAPSHOT is specified by default.
Enter if you don't need to change it.
#### **`python`**
```define value for property ‘package’
The one you entered with the group ID earlier is set by default, so press Enter.
Next, check the contents. You will be asked in Y / N, so if you are not wrong, Y
---
## Build by Maven
```$cd project name (mysampleapp1)
$mvn install```
An instruction to package a program and install it in a local repository.
It downloads the required libraries and organizes the project into a specified package file.
If you want to compile the program, mvn compile,
If you want to create a package, mvn package
There are commands such as.
I think you should check this area as appropriate.
---
## Run by Maven
```$cd target```
#### **`$java -classpath ./MySampleApp1-1.0-SNAPSHOT.jar jp.tuyano.spring.sample1.App`**
"/" Is used, but the "/" part needs to be changed depending on the OS. https://stackoverflow.com/questions/4528438/classpath-does-not-work-under-linux
Recommended Posts