Príkazy v Maven

Zo stránky Informatika
Verzia z 01:03, 10. február 2023, ktorú vytvoril Kubini (diskusia | príspevky) (Vytvorená stránka „== mvn --version == - Prints out the version of Maven you are running. == mvn clean == - Cleans the maven project by deleting the target directory. == mvn compiler:compile == - Compiles the java source classes of the maven project. == mvn compiler:testCompile == - This command compiles the test classes of the maven project. == mvn package == - Compiles all the Java files, run any tests, and package the deliverable code and resources into target/my-app-1.0.j…“)
(rozdiel) ← Staršia verzia | Aktuálna úprava (rozdiel) | Novšia verzia → (rozdiel)
Prejsť na navigáciu Prejsť na vyhľadávanie

mvn --version

- Prints out the version of Maven you are running.

mvn clean

- Cleans the maven project by deleting the target directory.

mvn compiler:compile

- Compiles the java source classes of the maven project.

mvn compiler:testCompile

- This command compiles the test classes of the maven project.

mvn package

- Compiles all the Java files, run any tests, and package the deliverable code and resources into target/my-app-1.0.jar (assuming the artifactId is my-app and the version is 1.0.) - Builds the maven project and packages them into a JAR, WAR, etc.

mvn install

- Builds the maven project and installs the project files (JAR, WAR, pom.xml, etc) to the local repository.

mvn deploy

- This command is used to deploy the artifact to the remote repository. The remote repository should be configured properly in the project pom.xml file distributionManagement tag. The server entries in the maven settings.xml file is used to provide authentication details.

mvn validate

- Validates the maven project that everything is correct and all the necessary information is available.

mvn dependency:tree

- Generates the dependency tree of the maven project.

mvn dependency:analyze

- Analyzes the maven project to identify the unused declared and used undeclared dependencies. - It’s useful in reducing the build size by identifying the unused dependencies and then remove it from the pom.xml file.

mvn archetype:generate

- Maven archetypes is a maven project templating toolkit. We can use this command to generate a skeleton maven project of different types, such as JAR, web application, maven site, etc. - Recommended Reading: Creating a Java Project using Maven Archetypes (https://maven.apache.org/archetypes/maven-archetype-quickstart/).

mvn site:site

- Generates a site for the project. - You will notice a “site” directory in the target after executing this command. There will be multiple HTML files inside the site directory that provides information related to the project.

mvn test

- Run the test cases of the project using the maven-surefire-plugin.

mvn compile

- It’s used to compile the source Java classes of the project.

mvn verify

- Build the project, runs all the test cases and run any checks on the results of the integration tests to ensure quality criteria are met.

mvn exec

Spustenie main triedy

mvn exec:java -Dexec.mainClass=com.mycompany.App [1]

Referencie

  1. run main class of Maven project- Stack Exchange [online]. Dostupné z: https://stackoverflow.com/questions/9846046/run-main-class-of-maven-project