Problem scenario
You need to use this following command on a CentOS/RedHat/Fedora Linux server in a /home/hadoop/ directory:
mvn package -Pdist,native -DskipTests -Dtar
The Maven build is failing. When you run the command with the "-e" flag for verbosity you see this:
[INFO] BUILD FAILURE
...
[WARNING] The requested profile "dist" could not be activated because it does not exist.
[WARNING] The requested profile "native" could not be activated because it does not exist.
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/home/hadoop).
Please verify you invoked Maven from the correct directory. -> [Help 1]
...
org.apache.maven.lifecycle.MissingProjectException: The goal you specified requires a project to execute but there is no POM in this directory (/home/hadoop). Please verify you invoked Maven from the correct directory.
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:84)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
What do you do to create a pom.xml file in the correct directory so you can run the original mvn command?
Solution
Run these commands:
cd /home/hadoop/
# In the commands below, replace "contint" with the name of your company or some other term you desire.
mvn archetype:generate -DgroupId=com.contint.app -DartifactId=contint -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
cp ./contint/pom.xml pom.xml
mvn package -Pdist,native -DskipTests -Dtar