mvn clean package does not work, missing project - maven

I'm going through this tutorial: http://www.adeveloperdiary.com/java/spring-boot/create-spring-boot-application-step-step/
And I have maven installed, and I went to run mvn clean package
in the directory \SpringBoot\src\main\java\com\adeveloperdiary but it keeps saying
[INFO] Scanning for projects...
[INFO] --------------------------------------------------------------------- ---
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.059 s
[INFO] Finished at: 2016-12-07T11:45:06-05:00
[INFO] Final Memory: 6M/310M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\kbultman\Downloads\SpringBoot\src\main\java\com\adeveloperdiary). 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
This is my mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T11:41:47-05:00)
Maven home: C:\Users\kbultman\Downloads\apache-maven-3.3.9\apache-maven-3.3.9
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_79\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "windows

You want to run the maven command in the top level directory of the project. To do that you need to use the "cd" command like so:
cd \path\to\directory
In your case the directory would probably be
C:\Users\kbultman\Downloads\SpringBoot
instead of
C:\Users\kbultman\Downloads\SpringBoot\src\main\java\com\adeveloperdiary

Related

Maven Returning 0 Even on Success in Cygwin

We use Apache maven for building our java code. We use a Windows Desktop, but I'm running it under Cygwin (I use Cygwin as my main command line - and we have some scripting to make life easier which is done in Bash since then they work in our Linux environments too).
Anyway, the mvn command (the Linux shell script variant) seems to always return 0 whether it succeeds or not under Cygwin! The file itself contains code designed to support Cygwin, so I assume it should work.
I spotted it first when it couldn't clean (as the app was running) but easiest way to reproduce is just to run a mvn command in a folder that doesn't contain a .pom file
On Cygwin:
$ mvn clean compile; RC=$?; echo "Exit value: $RC"
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.145 s
[INFO] Finished at: 2021-07-12T13:30:20+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\cygwin64\home\foo.bar). 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
Exit value: 0
If I run the same command on a CentOS machine it works as expected:
[adam#dev-adco-carc ~]$ mvn clean compile; RC=$?; echo "Exit value: $RC"
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.641 s
[INFO] Finished at: 2021-07-06T02:52:18+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/home/foo). 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
Exit value: 1
If I run the mvn.cmd (windows cmd file, not the linux sh file) then the return value works but the output is not good
$ mvn.cmd clean compile; RC=$?; echo "Exit value: $RC"
[←[1;34mINFO←[m] Scanning for projects...
[←[1;34mINFO←[m] ←[1m------------------------------------------------------------------------←[m
[←[1;34mINFO←[m] ←[1;31mBUILD FAILURE←[m
[←[1;34mINFO←[m] ←[1m------------------------------------------------------------------------←[m
[←[1;34mINFO←[m] Total time: 0.156 s
[←[1;34mINFO←[m] Finished at: 2021-07-12T18:20:43+03:00
[←[1;34mINFO←[m] ←[1m------------------------------------------------------------------------←[m
[←[1;31mERROR←[m] The goal you specified requires a project to execute but there is no POM in this directory (C:\cygwin64\home\foo.bar). Please verify you invoked M
aven from the correct directory. -> ←[1m[Help 1]←[m
[←[1;31mERROR←[m]
[←[1;31mERROR←[m] To see the full stack trace of the errors, re-run Maven with the ←[1m-e←[m switch.
[←[1;31mERROR←[m] Re-run Maven using the ←[1m-X←[m switch to enable full debug logging.
[←[1;31mERROR←[m]
[←[1;31mERROR←[m] For more information about the errors and possible solutions, please read the following articles:
[←[1;31mERROR←[m] ←[1m[Help 1]←[m http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
Exit value: 1
Using Apache Maven version 3.6.3 on both Windows and Linux
I found this question but it just explains how to test the return code - and in my case the return code is wrong. It refers to a bug fixed in 2.0.9 with the mvn.cmd but it seems Cygwin does something similar to this in 3.6.3.
Is anyone running in Cygwin and testing for success? Am I missing something obvious or have I found a bug?

How to "solve lambda expressions are not supported in -source 1.5 [ERROR]" when compiling within a jenkins docker

I'm trying to follow this jenkins tutorial:
https://www.youtube.com/watch?v=FonVQNqLWiE&list=PL6tu16kXT9PqIe2b0BGul-cXbmwGt7Ihw&index=7
but I'm trying to do that within a dockerized jenkins. To do so, instead of creating a windows virtual machine, I just run the official jenkins docker image:
$ docker pull jenkins/jenkins:lts
$ docker run -P jenkins/jenkins:lts
To follow it up to chapter #6, to make sure maven is available I enter into the container with this:
$ docker exec -it -u root amazing_bose bash
(amazing_bose is the random name that docker assigned to the machine) and then, inside it I do:
# apt-get update
# apt-get install maven
# which mvn
/usr/bin/mvn
# mvn --version
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_232, vendor: Oracle Corporation
Java home: /usr/local/openjdk-8/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "4.9.184-linuxkit", arch: "amd64", family: "unix"
Build success
Until chapter #6 everything has worked fine. The repository is https://github.com/executeautomation/cucumberbasic and the compilation result in the docker's jenkins' console ends with:
Downloaded: https://repo.maven.apache.org/maven2/com/google/collections/google-collections/1.0/google-collections-1.0.jar (625 KB at 884.7 KB/sec)
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to /var/jenkins_home/workspace/TestJenkinsXavi/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.532 s
[INFO] Finished at: 2019-11-15T12:40:01+00:00
[INFO] Final Memory: 17M/115M
[INFO] ------------------------------------------------------------------------
Finished: SUCCESS
Build failure
Instead, in chapter #7, it proposes to build the verify maven target for this other project: https://github.com/executeautomation/SeleniumWithCucucumber
In here, in the video tutorial it successfully compiles, but when I do it I get this console ending:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.197 s
[INFO] Finished at: 2019-11-18T08:15:03+00:00
[INFO] Final Memory: 17M/160M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project CucumberBasics: Compilation failure: Compilation failure:
[ERROR] /var/jenkins_home/workspace/TestJenkinsXavi/src/main/java/com/ea/Main.java:[73,61] lambda expressions are not supported in -source 1.5
[ERROR] (use -source 8 or higher to enable lambda expressions)
[ERROR] /var/jenkins_home/workspace/TestJenkinsXavi/src/main/java/com/ea/Main.java:[118,50] method references are not supported in -source 1.5
[ERROR] (use -source 8 or higher to enable method references)
[ERROR] -> [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/MojoFailureException
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE
Question
So the question is:
As it is a closed container (jenkins/jenkins:lts) and it's a source code that is not mine (it's from the tutorial's author) I wonder what do I have to do to make it compile the verify target.
The solution is to specify the source and target JDK levels on the Maven invocation:
-Dmaven.compiler.source=8 -Dmaven.compiler.target=8
In Jenkins, click the "Advanced" button for the Maven build and add these options to the line labelled "MAVEN_OPTS".
Your build fails with
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project CucumberBasics: Compilation failure: Compilation failure:
[ERROR] /var/jenkins_home/workspace/TestJenkinsXavi/src/main/java/com/ea/Main.java:[73,61] lambda expressions are not supported in -source 1.5
[ERROR] (use -source 8 or higher to enable lambda expressions)
I assume your code has lambda functions in there. Try to execute your build with the -source 8 flag as specified in the log. That should fix the issue or at least give you the next issue to work on.

Fresh Vaadin 8.1 app "multimodule" app fails to build

When creating a new Vaadin 8.1.0 app named bogus using the archetype vaadin-archetype-application-multimodule, the build fails in IntelliJ 2017.2 when running Maven Projects panel > bogus-ui > Plugins > jetty > jetty:run
I get these error messages on console.
/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java -Dmaven.multiModuleProjectDirectory=/Users/basilbourque/IdeaProjects/bogus/bogus-ui "-Dmaven.home=/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3" "-Dclassworlds.conf=/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin/m2.conf" "-javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=55637:/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/boot/plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version=2017.2 org.eclipse.jetty:jetty-maven-plugin:9.3.9.v20160517:run
objc[11304]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java (0x1060bd4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10712c4e0). One of the two will be used. Which one is undefined.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building bogus-ui 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> jetty-maven-plugin:9.3.9.v20160517:run (default-cli) > test-compile # bogus-ui >>>
Downloading: http://maven.vaadin.com/vaadin-addons/com/example/bogus-backend/1.0-SNAPSHOT/maven-metadata.xml
Downloading: http://maven.vaadin.com/vaadin-addons/com/example/bogus-backend/1.0-SNAPSHOT/bogus-backend-1.0-SNAPSHOT.pom
[WARNING] The POM for com.example:bogus-backend:jar:1.0-SNAPSHOT is missing, no dependency information available
Downloading: http://maven.vaadin.com/vaadin-addons/com/example/bogus-backend/1.0-SNAPSHOT/bogus-backend-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.334 s
[INFO] Finished at: 2017-07-30T22:58:18-07:00
[INFO] Final Memory: 11M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project bogus-ui: Could not resolve dependencies for project com.example:bogus-ui:war:1.0-SNAPSHOT: Could not find artifact com.example:bogus-backend:jar:1.0-SNAPSHOT in vaadin-addons (http://maven.vaadin.com/vaadin-addons) -> [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/DependencyResolutionException
Process finished with exit code 1
Using Java 8 Update 144 on macOS Sierra 10.12.5 with IntelliJ Ultimate edition 2017.2.
The linked Question, Maven: How to use jetty:run in a multi-module Maven project, without needing to install, is not a duplicate of this Question. That one asks about one module (the Web Module) picking up on changes made in other modules and causing a rebuild rather than retrieving built items from local repository. I am asking how to run the app in the first place, long before needing to trigger re-builds.
Lifecycle > install on root/parent module
Maven needs to find dependencies before running.
You need to run 'mvn install' on root (parent) project or on your backend module (and other project that backend depends on).
you need to run mvn clean install command on the the parent project from root directory>

Building gremlin-plugin for neo4j

I'm trying to install the gremlin-plugin so I can use neo4django in python. I tried to follow the steps laid out at https://github.com/neo4j-contrib/gremlin-plugin but I haven't had any success.
I have
downloaded gremlin-plugin-master.zip
unzip gremlin-plugin-master.zip
cd gremlin-plugin-master/
mvn clean package
At which point, I receive a message which contains the following snippit
...
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project neo4j-gremlin-plugin: Compilation failure
[ERROR] /home/mint/Downloads/gremlin-plugin-master/src/main/java/org/neo4j/server/plugin/gremlin/GremlinPlugin.java:[79,23] method autoStartTransaction in class com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Graph cannot be applied to given types;
[ERROR] required: boolean
[ERROR] found: no arguments
[ERROR] reason: actual and formal argument lists differ in length
[ERROR] -> [Help 1]
....
Does anybody know what this means? I couldn't find anything that seemed to match this kind of error in this context and I have no idea where to start debugging this.
$ mvn -v
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /usr/lib/jdk1.7.0_51/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.11.0-12-generic", arch: "amd64", family: "unix"
EDIT:
After cloning the repo, I was able to compile.
Fresh clone of the repo solved the issue.

Mahout in Action examples doesn't work

I'm new in Mahout and I have a week trying to run the book examples. The book recommends to use an IDE for this but Eclipse and Netbeans are having some troubles with the maven and slf4j installation thats why I tryed to use the ubuntu 13.04 terminal. Can anyone could help me with this?? I downloaded the source code from the 0.7 branch on the git repository and trying to make it work doing the following steps:
Install maven with the
$sudo apt-get install maven (it installs the 3.0.4 version)
Extract the zip with the files and run the command $ mvn package (I think I have to modify the pom file but I'm not sure)
When finishes the package command, it shows me a build success message
Then I want to run one of the examples with the $ mvn exec:java -Dexec.mainClass="mia.recommender.ch02.IREvaluatorIntro" -Dexec.args="src" command but when i run it it shows me this:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.424s
[INFO] Finished at: Wed Jul 10 10:43:36 PDT 2013
[INFO] Final Memory: 8M/19M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project mia: An exception occured while executing the Java class. null: InvocationTargetException: intro.csv -> [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/MojoExecutionException
Thanks in advance!
i think you have to build mahout jar files first! they created in a target folder in each of the mahout main folder such as math,examples and ...
then after extract zip file run this command to build jar files
sudo mvn -DskipTests install -e
after that you can run your example :)

Resources