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
You can use this command instead.
mvn clean install -DskipTests
Reference Doc - Maven CheatSheet
It's because of PowerShell that interprets "-" as PowerShell params. ( your terminal shows "PS" in the first line )
so you should escape PowerShell params with --%, like
mvn clean install --% -Dmaven.test.skip=true
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.
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
You can use -DskipTests which will compile but not run your tests meaning anything that relies on test artefacts will be able to proceed
You can use the configuration property declared above (skipTests), which can be set in your pom properties
Related
I am trying to run build of tests from jenkins
After all the 16 tests success's and I got the message BUILD SUCCESS I got this lines
[INFO] Tests run: 16, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 06:15 min
[INFO] Finished at: 2022-03-20T12:36:01+02:00
[INFO] ------------------------------------------------------------------------
[BE UAT] $ cmd.exe /C '""C:\Program Files\Selenium\apache-maven-3.8.1\bin\mvn.cmd"' mvn compile && exit %%ERRORLEVEL%%"
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------------< Maven:miron >-----------------------------
[INFO] Building miron 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.073 s
[INFO] Finished at: 2022-03-20T12:36:02+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "mvn". 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
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE
Jenkins config
Picture
Why is that ?
This is the command that's executed:
[BE UAT] $ cmd.exe /C '""C:\Program Files\Selenium\apache-maven-3.8.1\bin\mvn.cmd"' mvn compile && exit %%ERRORLEVEL%%"
As you can see, the cmd.exe is running mvn.cmd with mvn compile as arguments. In other words, you're running mvn mvn compile.
Edit: if you are using a "classic" freestyle job with an "Invoke top-level Maven targets" step, the Maven goals should not contain mvn. The Maven command is built from the goals (clean, package, etc.) and options (-DsomeOption=someValue). In freestyle jobs, you can add options either as part of the goals (in which case they should include the -D prefix), or separately as part of the options under "Advanced" (in which case you should omit the -D prefix).
I ran through this demo (using PowerShell). Everything was fine until I ran the line:
mvn exec:java -Dexec.mainClass="com.blobs.quickstart.App" -Dexec.cleanupDaemonThreads=false
then I got the below exception:
[INFO]
[INFO] --------------< com.blobs.quickstart:blob-quickstart-v12 >--------------
[INFO] Building blob-quickstart-v12 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.497 s
[INFO] Finished at: 2019-11-27T18:49:01-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase ".mainClass=com.blobs.quickstart.App". 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
This is the link from where I followed the steps https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-java?tabs=powershell#get-the-connection-string
Even with the plugin I got that error message. I fixed it by changing the double quotes (I am also using Powershell):
mvn exec:java -D"exec.mainClass=my.main.Clazz" [other args with same quote pattern]
As ManojReddy-MSFT suggested:
In most cases, this error occurs because of the missing plugin http://www.mojohaus.org/exec-maven-plugin/index.html
Can you verify if you have this plugin? if not, can you try with this plugin?
You can also refer to “Unknown lifecycle phase ”mvn“. You must specify a valid lifecycle phase or a goal” While Deploying the application using Azure
I have downloaded Maven in my system and provided the path setting.
when I run mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\apache-maven-3.6.3\bin\..
Java version: 1.8.0_251, vendor: Oracle Corporation, runtime: **C:\Program Files\Java\jre1.8.0_251**
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
The runtime should have the JDk but It is showing jre.
In the environment path -
USER Variable -
JAVA_HOME - C:\Program Files\Java\jdk1.8.0_251
MAVEN_HOME - C:\apache-maven-3.6.3
System Variable -
path - C:\apache-maven-3.6.3\bin
When I run - mvn
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.132 s
[INFO] Finished at: 2020-07-13T15:45:37+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. 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/NoGoalSpecifiedException
running mvn package also gives me below error -
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.146 s
[INFO] Finished at: 2020-07-13T22:44:10+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\A7704913). 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
How Can I do the runtime to be a JDK not JRE.
I am trying to package sample-appium-test code from AWS Github.
https://github.com/awslabs/aws-device-farm-appium-tests-for-sample-app
According to the document of Amazon,
I have to package it with this command:
mvn clean package –-DskipTests=true
After that, I'm got this error
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.214 s
[INFO] Finished at: 2016-08-30T09:02:33+08:00
[INFO] Final Memory: 7M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "–-DskipTests=true". You must specify a valid lifecycle phase or a goal in the format : or :[:]:. 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.
What should I do to fix this problem? Thanks you
Try mvn clean package –DskipTests=true, with a single '-'.
I believe it's a single '-' on OS X and '--' on Linux.
I had a similar issue. It works when we use install instead of pkg
mvn clean install -DskipTests
here is the link for your reference.
http://maven.apache.org/plugins-archives/maven-surefire-plugin-2.12.4/examples/skipping-test.html
In my Maven build, I have a small block of Ant code that needs to run right before the Surefire kicks in to perform a few configurations.
The code is executed with antrun, but I can't get antrun to be executed right before Surefire.
Here is the relevant section of the output of my build:
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # com...tests ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to C:\...\com...tests\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.16:test (default-test) # com...tests ---
[INFO] Surefire report directory: C:\...\com...tests\target\surefire-reports
Basically I need antrun to execute between maven-compiler-plugin:3.1:testCompile and maven-surefire-plugin:2.16:test .
I tried binding the antrun to the test phase and place it before the surefire plugin in the POM file, but it always executes after the Surefire plugin. I also tried to configure it to run in the testCompile phase, and place it after the maven-compiler-plugin plugin, but no success either.. it executes after surefire.
Does anyone know how to get it to execute in between these two??
Thank you!
Eduardo
You can execute the antrun plugin in process-test-classes life-cycle phase which is just between test-compile and test
If you take a look to the build life-cycle you can see there are several steps between compile/testCompile and test...
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
So i would suggest to use process-test-classes in your case which is exactly the point you need.