Maven goal types

Introduction

Maven builds based on pom.xml, a build tool for Java. Describes the command.

Convert to eclipse

Generate eclipse related files

mvn eclipse:eclipse

Erase eclipse related files

mvn eclipse:clean

To IntelliJ

Generate IntelliJ related files

mvn idea:idea

Delete intellij related files

mvn idea:clean

Creating a Maven project

Creating a Maven project

mvn archetype:generate

Archetype specification

mvn archetype:generate -DarchetypeGroupId=${groupId} -DarchetypeArtifactId=${ArtifactId}

Specify the property with -D. It can also be used to specify other properties.

Build related

This area is used in the actual project.

compile

mvn compile

Unit test

mvn test

Mainly tested with Junit.

Creating a Jar or War

mvn package

Specify jar or war in pom.xml.

Install plugins and libraries in your local repository

mvn install

By default, the library (Jar) is installed in the local repository from the maven central repository. The local repository is in the path set in ~ / .m2 / repository or $ {Maven home} /conf/settings.xml.

Erase artifacts

Delete under the target directory.

mvn clean

Summary

The CICD environment for Java may be set up. Internally, I just hit the Maven command, so I summarized it this time.

References

https://qiita.com/KevinFQ/items/e8363ad6123713815e68

Recommended Posts

Maven goal types
maven
Maven learning
[Maven] About Maven