MAVEN : A BUILD MANAGEMENT TOOL

Maven as a build automation tool and dependency management system for your Java projects.


Maven provides many commands that are useful in the SDET workflow. Here are some commonly used Maven commands and their purposes:

𝐦𝐯𝐧 𝐜𝐥𝐞𝐚𝐧: Cleans the project by deleting the target directory, which contains the compiled classes and build artifacts. This command is often used before starting a fresh build.

𝐦𝐯𝐧 𝐜𝐨𝐦𝐩𝐢𝐥𝐞: Compiles the source code of the project. It compiles the Java source files in the src/main/java directory and places the compiled class files in the target/classes directory.

𝐦𝐯𝐧 𝐭𝐞𝐬𝐭: Runs the tests for the project. I𝘵 𝘦𝘹𝘦𝘤𝘶𝘵𝘦𝘴 𝘵𝘩𝘦 𝘵𝘦𝘴𝘵𝘴 𝘪𝘯 𝘵𝘩𝘦 𝘴𝘳𝘤/𝘵𝘦𝘴𝘵/𝘫𝘢𝘷𝘢 𝘥𝘪𝘳𝘦𝘤𝘵𝘰𝘳𝘺. Maven looks for test classes with names matching the pattern *𝐓𝐞𝐬𝐭 𝐨𝐫 *𝐈𝐓 (𝐈𝐧𝐭𝐞𝐠𝐫𝐚𝐭𝐢𝐨𝐧 𝐓𝐞𝐬𝐭) 𝐛𝐲 𝐝𝐞𝐟𝐚𝐮𝐥𝐭. Test reports and results are generated in the 𝐭𝐚𝐫𝐠𝐞𝐭/𝐬𝐮𝐫𝐞𝐟𝐢𝐫𝐞-𝐫𝐞𝐩𝐨𝐫𝐭𝐬 𝐝𝐢𝐫𝐞𝐜𝐭𝐨𝐫𝐲.

𝐦𝐯𝐧 𝐩𝐚𝐜𝐤𝐚𝐠𝐞: 𝘗𝘢𝘤𝘬𝘢𝘨𝘦𝘴 𝘵𝘩𝘦 𝘤𝘰𝘮𝘱𝘪𝘭𝘦𝘥 𝘤𝘰𝘥𝘦 𝘢𝘯𝘥 𝘳𝘦𝘴𝘰𝘶𝘳𝘤𝘦𝘴 𝘪𝘯𝘵𝘰 𝘢𝘯 𝘰𝘶𝘵𝘱𝘶𝘵 𝘧𝘰𝘳𝘮𝘢𝘵 𝘴𝘶𝘤𝘩 𝘢𝘴 𝘢 𝘑𝘈𝘙 (𝘑𝘢𝘷𝘢 𝘈𝘳𝘤𝘩𝘪𝘷𝘦) 𝘰𝘳 𝘞𝘈𝘙 (𝘞𝘦𝘣 𝘈𝘳𝘤𝘩𝘪𝘷𝘦). The packaged artifact is placed in the target directory.

𝐦𝐯𝐧 𝐢𝐧𝐬𝐭𝐚𝐥𝐥: Installs the built artifact into the local Maven repository, making it available for other projects to use as a dependency. 𝐓𝐡𝐞 𝐚𝐫𝐭𝐢𝐟𝐚𝐜𝐭 𝐢𝐬 𝐭𝐲𝐩𝐢𝐜𝐚𝐥𝐥𝐲 𝐬𝐭𝐨𝐫𝐞𝐝 𝐢𝐧 𝐭𝐡𝐞 ~/.𝐦2/𝐫𝐞𝐩𝐨𝐬𝐢𝐭𝐨𝐫𝐲 𝐝𝐢𝐫𝐞𝐜𝐭𝐨𝐫𝐲.

𝐦𝐯𝐧 𝐝𝐞𝐩𝐞𝐧𝐝𝐞𝐧𝐜𝐲: tree: Displays the dependency tree of the project, showing all the dependencies and their transitive dependencies. 𝐓𝐡𝐢𝐬 𝐜𝐨𝐦𝐦𝐚𝐧𝐝 𝐡𝐞𝐥𝐩𝐬 𝐢𝐧 𝐮𝐧𝐝𝐞𝐫𝐬𝐭𝐚𝐧𝐝𝐢𝐧𝐠 𝐭𝐡𝐞 𝐩𝐫𝐨𝐣𝐞𝐜𝐭'𝐬 𝐝𝐞𝐩𝐞𝐧𝐝𝐞𝐧𝐜𝐲 𝐡𝐢𝐞𝐫𝐚𝐫𝐜𝐡𝐲.

𝐦𝐯𝐧 𝐜𝐥𝐞𝐚𝐧 𝐭𝐞𝐬𝐭: Combines the clean and test phases, cleaning the project and then executing the tests.

𝐦𝐯𝐧 𝐜𝐥𝐞𝐚𝐧 𝐢𝐧𝐬𝐭𝐚𝐥𝐥: Combines the clean and install phases, cleaning the project and then installing the artifact into the local Maven repository.

THANKS!

Comments

Popular posts from this blog

Python namespaces & LEGB rule in Python