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
Related
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
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 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
how can we convert eclipse project to maven project
slf4j repositories is present in .m2
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.449s
[INFO] Finished at: Sun Aug 25 13:42:43 IST 2013
[INFO] Final Memory: 1M/15M
[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