-------------------------------
Some Important Maven commands:
------------------------------
mvn test
mvn clean
mvn compile
--------------
mvn test - cmd - can be used to run maven tests/classes
steps: Open Maven Project in cmd prompt window
Go to ur Maven Project folder >
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>mvn test
o/p:
----
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>mvn test
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.birla:MavenProjectThroughCommand >----------------
[INFO] Building MavenProjectThroughCommand 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ MavenProjectThroughCommand ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ MavenProjectThroughCommand ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ MavenProjectThroughCommand ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.birla.AndroidTest
Calling Android Test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.12 s - in com.birla.AndroidTest
[INFO] Running com.birla.AppTest
running maven test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 s - in com.birla.AppTest
[INFO] Running com.birla.MobileTest
Calling Mobile Test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.011 s - in com.birla.MobileTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.214 s
[INFO] Finished at: 2024-06-19T08:43:18+05:30
[INFO] ------------------------------------------------------------------------
-----------------------
Note:
----
if we execute mvn test cmd from other/ invalid folder where pom.xml file is not available, it throws "Build failure " error
-----------------------------------
Microsoft Windows [Version 10.0.19045.3570]
(c) Microsoft Corporation. All rights reserved.
C:\Users\Lenovo>mvn test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.193 s
[INFO] Finished at: 2023-10-23T08:55:04+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\Lenovo). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
C:\Users\Lenovo>
---------------------------------------------------
When we run maven test > goes to src\test\java > it compiles all "java" files and creates ".class" files in 'target' folder > i.e C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\target\test-classes\com\birla
or also creates some temp files in'target' folder
---------------------------------------------------
mvn clean cmd :
-------------
- can be used to delete/ clean all temporary folder i.e in target folder and files what ever maven created
o/p:
----
Microsoft Windows [Version 10.0.19045.4529]
(c) Microsoft Corporation. All rights reserved.
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>mvn clean
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.birla:MavenProjectThroughCommand >----------------
[INFO] Building MavenProjectThroughCommand 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ MavenProjectThroughCommand ---
[INFO] Deleting C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.966 s
[INFO] Finished at: 2024-06-19T08:55:19+05:30
[INFO] ------------------------------------------------------------------------
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>
*******************************************
clean through Eclipse:
----------------
Rt click on Project > Run as 'Maven clean' option >
o/p:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/brahma/seleniumSoftwares/eclipse-jee-2021-03-M2-win32-x86_64/eclipse/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/C:/brahma/seleniumSoftwares/eclipse-jee-2021-03-M2-win32-x86_64/eclipse/configuration/org.eclipse.osgi/6/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/brahma/seleniumSoftwares/eclipse-jee-2021-03-M2-win32-x86_64/eclipse/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/C:/brahma/seleniumSoftwares/eclipse-jee-2021-03-M2-win32-x86_64/eclipse/configuration/org.eclipse.osgi/6/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.birla:MavenProjectThroughCommand >----------------
[INFO] Building MavenProjectThroughCommand 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ MavenProjectThroughCommand ---
[INFO] Deleting C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.781 s
[INFO] Finished at: 2024-06-19T08:58:21+05:30
[INFO] ------------------------------------------------------------------------
HW : run maven clean cmd from cmd prompt window :
mvn test --> to run maven test/classes where class name ends with 'Test'
mvn clean --> clean/ delete temp folders in "target" folder what ever Maven created inside "target" folder
compile :
------------
mvn compile - cmd - can be used to "compile" all java files from 'src\test\java' folder
it takes java classes > compile - converting java file to .class files
o/p:
----
Microsoft Windows [Version 10.0.19045.4529]
(c) Microsoft Corporation. All rights reserved.
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.birla:MavenProjectThroughCommand >----------------
[INFO] Building MavenProjectThroughCommand 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ MavenProjectThroughCommand ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.420 s
[INFO] Finished at: 2024-06-19T09:01:53+05:30
[INFO] ------------------------------------------------------------------------
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>
------------------------------
Note:
-----
we can see all compiled files here
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>\target\classes
(or)
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>\target\test-classes\com\birla
--------------------------------------------
Note:
-----
if class name does not end with 'Test' - Maven will run that class (or) not ?
No.it does not run class as tge class name does not end with "Test"
Class IOS
{
}
Maven will not run classes where class name does not end with 'Test'
Run 'single' Maven test from cmd:
-------------------------------
syntax:
--------
mvn test --> run all maven classes where class name ends with 'Test'
mvn test -Dtest=className
ex:
I want to run class = MobileTest
cmd --> mvn test -Dtest=MobileTest
o/p:
----
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>mvn test -Dtest=MobileTest
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.birla:MavenProjectThroughCommand >----------------
[INFO] Building MavenProjectThroughCommand 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ MavenProjectThroughCommand ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ MavenProjectThroughCommand ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ MavenProjectThroughCommand ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.birla.MobileTest
Calling Mobile Test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.095 s - in com.birla.MobileTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.467 s
[INFO] Finished at: 2024-06-19T09:07:02+05:30
[INFO] ------------------------------------------------------------------------
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>
ex2:
----
I want to run class = AndroidTest
cmd --> mvn test -Dtest=AndroidTest
o/p:
----
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>mvn test -Dtest=AndroidTest
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.birla:MavenProjectThroughCommand >----------------
[INFO] Building MavenProjectThroughCommand 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ MavenProjectThroughCommand ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ MavenProjectThroughCommand ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ MavenProjectThroughCommand ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.birla.AndroidTest
Calling Android Test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.113 s - in com.birla.AndroidTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.217 s
[INFO] Finished at: 2024-06-19T09:08:05+05:30
[INFO] ------------------------------------------------------------------------
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>
----------------------------------------
HW write a command to Run "AppTest" class only ?
HW write a command to Run "iosTest" class only?
Note: if we give invalid class name, throws BUILD FAILURE
>mvn test -Dtest=Android
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>mvn test -Dtest=Android
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.birla:MavenProjectThroughCommand >----------------
[INFO] Building MavenProjectThroughCommand 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ MavenProjectThroughCommand ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ MavenProjectThroughCommand ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ MavenProjectThroughCommand ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.040 s
[INFO] Finished at: 2024-06-19T09:09:33+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project MavenProjectThroughCommand: No tests were executed! (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>
---------------------------------------------
Run "Multiple" maven tests/classes from cmd:
-----------------------------------------
Run "single" class --> mvn test -Dtest=class1
syntax --> mvn test -Dtest=classname1,classname2....etc
ex: run only "MobileTest", "AndroidTest" classes
cmd --> mvn test -Dtest=MobileTest,AndroidTest
o/p:
----
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>mvn test -Dtest=MobileTest,AndroidTest
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.birla:MavenProjectThroughCommand >----------------
[INFO] Building MavenProjectThroughCommand 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ MavenProjectThroughCommand ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ MavenProjectThroughCommand ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ MavenProjectThroughCommand ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.birla.AndroidTest
Calling Android Test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.128 s - in com.birla.AndroidTest
[INFO] Running com.birla.MobileTest
Calling Mobile Test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.007 s - in com.birla.MobileTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.486 s
[INFO] Finished at: 2024-06-19T09:11:33+05:30
[INFO] ------------------------------------------------------------------------
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>
Note:
-------
it runs maven Test classes in "alphabetical" order..i.e AndroidTest,MobileTest
---------------------------------------------------------------
FAQ Can you tell me cmd to execute "single" maven test class ?
mvn test -Dtest= classname
mvn test -Dtest= classname1,Classname2
mvn test --> runs single classes/ all classes --> runs all maven classes
FAQ what is the use of clean ?
deletes all files / folders which are created in Target folder
FAQ what is the use mvn test cmd?
run all Maven test classes where class name ends with Test only.
--------------------------------------------------
package cmd:
--------------------
mvn package --> can be used to "compile" classes and run all maven classes and also creates .jar (or) .war
.Jar file --> Java Archive file ( combine all classes and interfaces-- as one package)
.war file --> Web Archive File
o/p:
----
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.birla:MavenProjectThroughCommand >----------------
[INFO] Building MavenProjectThroughCommand 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ MavenProjectThroughCommand ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ MavenProjectThroughCommand ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ MavenProjectThroughCommand ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.birla.AndroidTest
Calling Android Test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.127 s - in com.birla.AndroidTest
[INFO] Running com.birla.AppTest
running maven test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 s - in com.birla.AppTest
[INFO] Running com.birla.MobileTest
Calling Mobile Test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 s - in com.birla.MobileTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ MavenProjectThroughCommand ---
[INFO] Building jar: C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\target\MavenProjectThroughCommand-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.938 s
[INFO] Finished at: 2024-06-19T09:17:08+05:30
[INFO] ------------------------------------------------------------------------
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>
----------------------------------------------
******************************************************************
20-Jun-2024
******************************************************************
mvn install cmd:
-----------------
can be used to install .jar file into "local" maven repository (.m2/repository)
o/p:
----
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.birla:MavenProjectThroughCommand >----------------
[INFO] Building MavenProjectThroughCommand 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ MavenProjectThroughCommand ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ MavenProjectThroughCommand ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ MavenProjectThroughCommand ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.birla.AndroidTest
Calling Android Test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.108 s - in com.birla.AndroidTest
[INFO] Running com.birla.AppTest
running maven test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.029 s - in com.birla.AppTest
[INFO] Running com.birla.MobileTest
Calling Mobile Test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.011 s - in com.birla.MobileTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ MavenProjectThroughCommand ---
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ MavenProjectThroughCommand ---
[INFO] Installing C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\target\MavenProjectThroughCommand-1.0-SNAPSHOT.jar to C:\Users\Lenovo\.m2\repository\com\birla\MavenProjectThroughCommand\1.0-SNAPSHOT\MavenProjectThroughCommand-1.0-SNAPSHOT.jar
[INFO] Installing C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\pom.xml to C:\Users\Lenovo\.m2\repository\com\birla\MavenProjectThroughCommand\1.0-SNAPSHOT\MavenProjectThroughCommand-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.943 s
[INFO] Finished at: 2024-06-20T08:09:12+05:30
[INFO] ------------------------------------------------------------------------
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>
Note:
-----
check the .jar file is created /installed in local maven repo.
Installing C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>\target\MavenProjectThroughCommand-1.0-SNAPSHOT.jar
to
C:\Users\Lenovo\.m2\repository\com\accenture\MavenProjectThroughCommand\1.0-SNAPSHOT\MavenProjectThroughCommand-1.0-SNAPSHOT.jar
------------------------------------
run From Eclipse : Run as maven install :
------------------------------------------
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/brahma/seleniumSoftwares/eclipse-jee-2021-03-M2-win32-x86_64/eclipse/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/C:/brahma/seleniumSoftwares/eclipse-jee-2021-03-M2-win32-x86_64/eclipse/configuration/org.eclipse.osgi/6/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/brahma/seleniumSoftwares/eclipse-jee-2021-03-M2-win32-x86_64/eclipse/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/C:/brahma/seleniumSoftwares/eclipse-jee-2021-03-M2-win32-x86_64/eclipse/configuration/org.eclipse.osgi/6/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.birla:MavenProjectThroughCommand >----------------
[INFO] Building MavenProjectThroughCommand 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ MavenProjectThroughCommand ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ MavenProjectThroughCommand ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ MavenProjectThroughCommand ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.birla.AndroidTest
Calling Android Test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.178 s - in com.birla.AndroidTest
[INFO] Running com.birla.AppTest
running maven test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.04 s - in com.birla.AppTest
[INFO] Running com.birla.MobileTest
Calling Mobile Test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 s - in com.birla.MobileTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ MavenProjectThroughCommand ---
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ MavenProjectThroughCommand ---
[INFO] Installing C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\target\MavenProjectThroughCommand-1.0-SNAPSHOT.jar to C:\Users\Lenovo\.m2\repository\com\birla\MavenProjectThroughCommand\1.0-SNAPSHOT\MavenProjectThroughCommand-1.0-SNAPSHOT.jar
[INFO] Installing C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\pom.xml to C:\Users\Lenovo\.m2\repository\com\birla\MavenProjectThroughCommand\1.0-SNAPSHOT\MavenProjectThroughCommand-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.688 s
[INFO] Finished at: 2024-06-20T08:12:50+05:30
[INFO] ------------------------------------------------------------------------
*************************************
*************************************
Maven goal:
-------------
== maven cmd
each cmd - performs specific task
mvn clean
mvn compile
mvn test
mvn package -- create .jar file from compiled classes
mvn install -- install created .jar file into local repository (.m2\repository)
Note:
-----
mvn test --> mvn compile cmd also and run
mvn package --> it executes mvn compile and mvn test + create .jar (or) .war
mvn install --> it executes mvn compile and mvn test , mvn package + install .jar into Local repo
***************************************************
mvn deploy: install .jar file ( deploy the code) in remote repository
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project MavenProjMrngCmd: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
--------------------------------------
Note: even if we close eclipse, we can run maven tests from cmd.
--------------------------------------------------------------
C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand>mvn test
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.birla:MavenProjectThroughCommand >----------------
[INFO] Building MavenProjectThroughCommand 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ MavenProjectThroughCommand ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ MavenProjectThroughCommand ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\brahma\Practise\SelniumPractiseNew\March52024MyWorkspace\MavenProjectThroughCommand\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ MavenProjectThroughCommand ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ MavenProjectThroughCommand ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.birla.AndroidTest
Calling Android Test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.169 s - in com.birla.AndroidTest
[INFO] Running com.birla.AppTest
running maven test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 s - in com.birla.AppTest
[INFO] Running com.birla.MobileTest
Calling Mobile Test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s - in com.birla.MobileTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.224 s
[INFO] Finished at: 2024-06-20T08:24:17+05:30
[INFO] ------------------------------------------------------------------------
No comments:
Post a Comment