Reputation: 91
I am trying to run a simple maven project in eclipse.When I run as "Maven Clean" is give me message " BUILD SUCCESS" but when I run my test as "Maven Test" it again says " BUILD SUCCESS" but not printing "hello world" from Systemprintln. Below is my class.
import org.testng.annotations.Test;
public class TestHellowWorld {
public void testHellowWorld(){
@Test
System.out.println("hello world");
}
}
I am getting following message:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building helloworld_raghav 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ helloworld_raghav ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ helloworld_raghav ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ helloworld_raghav ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ helloworld_raghav ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ helloworld_raghav ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.536 s
[INFO] Finished at: 2020-04-17T23:13:06-04:00
[INFO] Final Memory: 9M/245M
Now if I try to run this project through command line,build failed with the following message;
C:\Users\tarishah\workspace\helloworld_tarishah>mvn -clean
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< helloworld_raghav:helloworld_raghav >-----------------
[INFO] Building helloworld_raghav 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.164 s
[INFO] Finished at: 2020-04-17T23:08:11-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "lean". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [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/LifecyclePhaseNotFoundException
Upvotes: 0
Views: 2071
Reputation: 1
try with below C:\Users\tarishah\workspace\helloworld_tarishah>mvn clean
Upvotes: 0
Reputation: 35795
Maven says Unknown lifecycle phase "lean"
which means that you did not run mvn test
(as you indicated in your question) but something like mvn lean
or mvn lean test
.
Upvotes: 1