Maven Iterator/Invoker fails on Windows - maven

I have a Windows 10 System where I don't have administrative rights. However, most Maven builds are working on that machine. For some reason I run into a problem with the Iterator Plugin. Even the example from https://github.com/khmarbaise/iterator-maven-plugin/blob/master/src/it/invokerBasicTest/pom.xml fails with this error:
[INFO] [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:<my home director>). Please verify you invoked Maven from the correct directory. -> [Help 1]
[INFO] [ERROR]
[INFO] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[INFO] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
[INFO] [ERROR]
[INFO] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[INFO] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
[ERROR] ------ Maven call was NOT Ok. for iteration one ( return code: 1 )
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.567 s
[INFO] Finished at: 2020-05-08T10:04:40+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.soebes.maven.plugins:iterator-maven-plugin:0.5.0:invoker (default) on project invoker-basic-test: Maven call failed with return code 1 for iteration: one -> [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
So in other words, on that particular Windows system (I see that build working on Macs and other Windows machines), the invoker tries to find the pom.xml in my user home directory. And of course, I started the build in the right directory. The only significant thing what I have noticed on that Windows, the Environment variable MP_FORCE_USE_SANDBOX=1 is set.
-e and -X don't really help. Perhaps someone could help me out with some further hints in order to tackle down the problem.

Finally, I found out what the problem was. It's not really a maven or Iterator Problem, more of a misconfigured Windows problem. However, in case someone comes over something like this, it may be worth to check.
In my case it was a Registry Key. In Windows there is a Registry Key Autorun under
\HKEY_CURRENT_USER\Software\Microsoft\Command Processor
This Registry Key can control, in which directory a new cmd.exe will be started. In my case, there was cd /d C:\<myHomeDirectory>as a value. Which made the cmd.exe always start in my Home Directory. This caused my build to fail, because each iteration of the iterator supposably starts a new process in my Home Directory, which finally lets Maven search the desired pom.xml in my Home Directory.
For me the resolution for my problem is, change the Registry Key Autorun to the value cd.

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?

mvn clean command on my Mac OS throws me error

I am trying to delete documents which are created by doorstop and getting error as "Multiple Root documents" Please refer to below link for more information
https://github.com/doorstop-dev/doorstop/issues/293
Solution for that is to run "mvn clean" command but I am getting below error for "mvn clean" command. Any possible solutions regarding this.
(base) MANOJs-MacBook-Air:~ manojdeshpande$ mvn clean
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.090 s
[INFO] Finished at: 2019-11-21T23:01:40+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/Users/manojdeshpande). 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
The error message is pretty clear:
The goal you specified requires a project to execute but there is no
POM in this directory (/Users/manojdeshpande). Please verify you
invoked Maven from the correct directory
The problem is that Maven can't find a pom file (pom.xml is the maven project configuration file) where you are running the maven clean command, so it's impossible for Maven to know what to do, even if you specified the clean goal.
Maybe your pom file is somewhere else than /Users/manojdeshpande?

IzPack - Execute shell script file to launch mvn command

First, I have db_migration.sh with content like this
#!/bin/sh
eval "mvn compile flyway:migrate"
So, simple. Just to ease users from executing this command in the terminal by themselves. Due to 'mvn', Of course, this command need to be executed with pom file, which I already place them together in the same directory.
Second, I have this code segment in install.xml file. To mark as executable file after the installation, fix permission denied issue in Unix system
<executable targetfile="$INSTALL_PATH/Database/orchestra-db/db_migration.sh" os="unix" stage="never" failure="warn" keep="true" />
Then, in the ProcessPanel I have this; To run my db_migration.sh
<job name="do xyz">
<executeForPack name="Orchestra Runtime"/>
<os family="unix" />
<executefile name="$INSTALL_PATH/Database/orchestra-db/db_migration.sh">
<arg>doit</arg>
</executefile>
</job>
However, when I test my installer, I got this error message in the ProcessPanel
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.300 s
[INFO] Finished at: 2018-07-19T15:51:52+02:00
[INFO] Final Memory: 5M/121M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/home/tanyagorn/Documents/OrchestraInstaller/installer/target). 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
Seem like IzPack is looking for pom file and try to execute .sh file in 'target' directory. But, I need this script to be executed at the user's install path. Can anyone tell me what did I do wrong?
Thank you in advance.
The continued discussion and right place to discuss IzPack issues is the user forum:
https://groups.google.com/d/msg/izpack-user/eN8wdvE-UIc/Verjnuh0BAAJ

Makefile for springboot application

I have a spring boot application.I am running it inside a vagrant box(centos).I use intelliJ IDEA.
I have created a Makefile and I am trying to run this application.
I have never worked with Makefile hence I am not confident about it.
Hence the question might seem easy for some of you.I tried to do a bit of research but I could not achieve any success in it.
My Makefile contains:-
install-mvn:
mvn :install
I opened a terminal and went to the location where my Makefile is located and then issue the 'make' command to run the application.
I get the error as below:-
[vagrant#localhost src]$ make
mvn :install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
[INFO] Total time: 0.578s
[INFO] Finished at: Fri Jul 14 17:24:31 IST 2017
[INFO] Final Memory: 4M/22M
[INFO] ------------------------------------------------------------------------
[ERROR] Could not find goal '' in plugin org.apache.maven.plugins:maven- install-plugin:2.3.1 among available goals install, install-file, help -> [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/MojoNotFoundException
make: *** [install-mvn] Error 1
I did not understand the error.Can any of you guide me with this?I would like to know what is being expected and what should the Makefile contain.
Thanks in advance

Build failure when running “mvn clean” for the first time while installing

I'm new to Maven and trying to use this for the first time in my project.
I've set the system variables;
JAVA_HOME System Variable
M2_HOME System Variable
%JAVA_HOME%\bin;%M2_HOME%\bin; to System Path
In cmd prompt using "mvn -version" i can see all relevant details.
But when I run "mvn clean”, I get the following error
C:\Users\Naina Mantry>mvn clean
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.105 s
[INFO] Finished at: 2016-02-15T08:00:48+05:30
[INFO] Final Memory: 5M/86M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\Naina
Mantry). 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
I'm not able to understand, how to fix it. kindly help me please...
Thanks in advance :)
when you run Maven, you need to run it from your proyect directory, where you have your workspace. You need to have a pom.xml file on that Directory.
For example:
C:\Users\Naina Mantry\workspace\proyect
and on that directory you run mvn clean
You seem to be executing mvn clean from a wrong directory. Make sure there is a relevant pom.xml. Maven by default refers to the current working directory. Alternately, you can use -f option to specify a pom.xml located in a different directory.

Resources