Maven проект потерпел неудачу в затмении и командной строке - PullRequest
0 голосов
/ 18 апреля 2020

Я пытаюсь запустить простой проект maven в eclipse. Когда я запускаю «Maven Clean», выдает мне сообщение «BUILD SUCCESS», но когда я запускаю свой тест как «Maven Test», он снова говорит «BUILD SUCCESS», но не печатать "привет мир" от Systemprintln. Ниже мой класс.

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

1 Ответ

1 голос
/ 18 апреля 2020

Maven говорит Unknown lifecycle phase "lean", что означает, что вы не запускали mvn test (как вы указали в своем вопросе), но что-то вроде mvn lean или mvn lean test.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...