Maven error "Unknown lifecycle phase ".test.skip=true"....."

Viewed 36

when i try to install maven, i get this error in intellij, itried all the solution proposed here "https://stackoverflow.com/questions/5074063/maven-error-failure-to-transfer" but it doesn't work

PS C:\Users\stagiaire1\Desktop\Vgc\vgc-backend>  mvn clean install -Dmaven.test.skip=true
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------< com.dzadvisory:bankapp >-----------------------
[INFO] Building bankapp 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.344 s
[INFO] Finished at: 2022-09-21T16:51:00+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase ".test.skip=true". 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 phas
es 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-com
pile, 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 Answers

Can't place this in a comment, not enough rep.

Few things here, the actions described below belong to the Maven Surefire Plugin which you will want to ensure is in the build entries inside your pom

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>x.x.x</version>
      <configuration>
        <skipTests>${skipTests}</skipTests>
      </configuration>
    </plugin>
  </plugins>
</build>

Now you'll have three options to skip tests.

  1. As you mentioned use -Dmaven.test.skip this will neither run, nor compile any of your tests meaning anything that relies on test artefacts being available will fail
  2. You can use -DskipTests which will compile but not run your tests meaning anything that relies on test artefacts will be able to proceed
  3. You can use the configuration property declared above (skipTests), which can be set in your pom properties
Related