maven install external jar is not functioning properly - maven

I am new to maven, I want to add commons-codec jar to maven local repository , Actually I want to use this jar in the project but I get compile error which shows the jar could not find at compile-time the project pom file contains
<dependency>
<groupId>commons</groupId>
<artifactId>commons-codec</artifactId>
<version>1.8</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/commons-codec-1.8.jar</systemPath>
</dependency>
and the jar file is in the lib folder in the project root , after some googling I found the I should install the jar by mvn So I execute this
C:\Program Files (x86)\apache-maven-2.2.1-bin\apache-maven-2.2.1\bin>mvn install:commons-codec-1.8.jar -Dfile="c:\mapsforge\mapsforge-map\lib\commons-codec-1.8.jar" -DartifactId=commons-codec -Dversion=1.8 -Dpackaging=jar -e
and then I get this error
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'install'.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Required goal not found: install:commons-codec-1.8.jar in org.apache.maven.plugins:maven-install-plugin:2.2
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException: Required goal not found: install:commons-codec-1.8.jar in org.apache.maven.plugins:maven-install-plu
gin:2.2 at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1867)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListByAggregationNeeds(DefaultLifecycleExecutor.java:462)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:175)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
what's wrong here ... ?

The given goal is wrong.
mvn install:commons-codec-1.8.jar -Dfile="c:\mapsforge\mapsforge-map\lib\commons-codec-1.8.jar" -DartifactId=commons-codec -Dversion=1.8 -Dpackaging=jar -e
it must be:
mvn install:install-file -Dfile="c:\mapsforge\mapsforge-map\lib\commons-codec-1.8.jar" -DartifactId=commons-codec -Dversion=1.8 -Dpackaging=jar -e
Apart from that i would suggest to use Maven 3.X instead of Maven 2.2.1.

Related

Maven: Could not find goal 'create' in plugin org.apache.maven.plugins:maven-archetype-plugin

I'm trying to create a Web Application Project with Maven as described here but I keep getting the following error
mvn archetype:create
-DgroupId=ru.jofsey
-DartifactId=example
-DarchetypeArtifactId=maven-archetype-webapp
-DinteractiveMode=false
-e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.373 s
[INFO] Finished at: 2017-02-18T14:31:49+03:00
[INFO] Final Memory: 7M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Could not find goal 'create' in plugin org.apache.maven.plugins:maven-archetype-plugin:3.0.0 among available goals crawl, create-from-project, generate, help, integration-test, jar, update-local-catalog -> [Help 1]
org.apache.maven.plugin.MojoNotFoundException: Could not find goal 'create' in plugin org.apache.maven.plugins:maven-archetype-plugin:3.0.0 among available goals crawl, create-from-project, generate, help, integration-test, jar, update-local-catalog
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:290)
at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:241)
at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.getMojoDescriptor(MojoDescriptorCreator.java:238)
at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:103)
at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:83)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:89)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
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)
[ERROR]
[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
As per the following release note, the plugin has removed support for the archetype-create goal. It was already marked as deprecated in recent versions of the plugin, and instead you should use the archetype:generate goal. The Jira issue (https://issues.apache.org/jira/browse/ARCHETYPE-437) mentions the following:
It's time to finally remove the support for the old create goal. For users still using it, it should fail the build with a message about using the generate goal instead.
The plugin documentation also removed any mentioning of archetype:create.
Using mvn archetype:generate instance of mvn archetype:create
mvn archetype:generate

HBase Indexer to work with Apache HBase

I am getting the below error when building with Apache Hbase.
I am running the below mail
mvn -e clean install -DskipTests -Dhbase.api=0.98
``` [ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: null:akuma:jar:1.9
Reason: Cannot find parent: org.kohsuke:pom for project: null:akuma:jar:1.9 for project null:akuma:jar:1.9
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Unable to get dependency information: Unable to read the metadata file for artifact 'org.kohsuke:akuma:jar': Cannot find parent: org.kohsuke:pom for project: null:akuma:jar:1.9 for project null:akuma:jar:1.9
org.kohsuke:akuma:jar:1.9
from the specified remote repositories:
default (http://repo1.maven.org/maven2),
central (http://repo1.maven.org/maven2),
cdh.repo.snapshots (https://repository.cloudera.com/artifactory/cloudera-repos/),
ngdata.oss-releases (http://mvnrepo.ngdata.com/content/repositories/oss-releases)
Path to dependency:
1) com.ngdata:hbase-indexer-server:jar:1.6-SNAPSHOT
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:711)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.artifact.resolver.ArtifactResolutionException: Unable to get dependency information: Unable to read the metadata file for artifact 'org.kohsuke:akuma:jar': Cannot find parent: org.kohsuke:pom for project: null:akuma:jar:1.9 for project null:akuma:jar:1.9
org.kohsuke:akuma:jar:1.9
```
Thanks in advance
In the hbase indexer, for the hbase-indexer-server module, in pom, you will have
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>akuma</artifactId>
</dependency>
Looks like, while fetching the dependencies, that jar is not being fetched and not present in repository. Try to get correct version with dependencies built. Normally this is the jar needed for the indexer-server module ".m2\repository\org\kohsuke\akuma\1.9\akuma-1.9.jar"

Jenkins/Maven build dying with "Could not find the selected project in the reactor" error

I’m using Jenkins on the Cloudbees build service and nave a multi-module Maven project. Recently, we removed a project from our parent pom, however, when we run the build in Jenkins with the following options …
clean install -e -P qa -P cloudbees -DskipITs
The artifacts are automatically stored into a Cloudbees snapshot repository attached to our account. However, the build ultimately fails with the below “Could not find the selected project in the reactor: org.mainco.subco:oldmodule” error. Is there a way to force the build to
[subco] $ mvn initialize -N
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building subco 76.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.841s
[INFO] Finished at: Fri Feb 27 21:59:22 UTC 2015
[INFO] Final Memory: 5M/115M
[INFO] ------------------------------------------------------------------------
Parsing POMs
Modules changed, recalculating dependency graph
maven31-agent.jar already up to date
maven31-interceptor.jar already up to date
maven3-interceptor-commons.jar already up to date
[subco] $ /opt/jdk/jdk1.7.0/bin/java -Dmaven.test.failure.ignore=false -cp /scratch/jenkins/maven31-agent.jar:/opt/maven/apache-maven-3.1.1/boot/plexus-classworlds-2.5.1.jar:/opt/maven/apache-maven-3.1.1/conf/logging jenkins.maven3.agent.Maven31Main /opt/maven/apache- maven-3.1.1 /scratch/jenkins/slave.jar /scratch/jenkins/maven31-interceptor.jar /scratch/jenkins/maven3-interceptor-commons.jar 52053
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /scratch/jenkins/workspace/subco/subco/pom.xml -amd -pl org.mainco.subco:oldmodule,org.mainco.subco:subco,org.mainco.subco:moduleB,org.mainco.subco:database,org.mainco.subco:moduleF,org.mainco.subco:moduleA,org.mainco.subco:moduleH,org.mainco.subco:newmodule,org.mainco.subco:session,org.mainco.subco:moduleA,org.mainco.subco:newmodule,org.mainco.subco:moduleB clean install -e -P qa -P cloudbees -DskipITs
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.mainco.subco:moduleA:jar:76.0.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.apache.maven.plugins:maven-antrun-plugin # line 508, column 12
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.mainco.subco:newmodule:jar:76.0.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:aspectj-maven-plugin is missing. # line 200, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[ERROR] Could not find the selected project in the reactor: org.mainco.subco:oldmodule -> [Help 1]
org.apache.maven.MavenExecutionException: Could not find the selected project in the reactor: org.mainco.subco:oldmodule
at org.apache.maven.DefaultMaven.trimSelectedProjects(DefaultMaven.java:750)
at org.apache.maven.DefaultMaven.createDependencyGraph(DefaultMaven.java:704)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:287)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:136)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
at hudson.remoting.UserRequest.perform(UserRequest.java:121)
at hudson.remoting.UserRequest.perform(UserRequest.java:49)
at hudson.remoting.Request$2.run(Request.java:324)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Take a look at what Maven is executing:
Executing Maven: -B -f /scratch/jenkins/workspace/subco/subco/pom.xml -amd -pl org.mainco.subco:oldmodule,org.mainco.subco:subco,org.mainco.subco:moduleB,org.mainco.subco:database,org.mainco.subco:moduleF,org.mainco.subco:moduleA,org.mainco.subco:moduleH,org.mainco.subco:newmodule,org.mainco.subco:session,org.mainco.subco:moduleA,org.mainco.subco:newmodule,org.mainco.subco:moduleB clean install -e -P qa -P cloudbees -DskipITs
In the -pl part is your old module. As you tell maven to use the parent project to build a module that's no longer part of that project, it fails.
Where is that command generated? Is suspect the old module be in one of your maven profiles or the Jenkins configuration.

Jenkins-Sonar-Maven Integration Issue

I have been trying to integrate Sonar with our Jenkins continous Integration system. I have installed the Sonar-plugin for Jenkins and configured it(specified the DB, DB Username and password etc). I have also specified the sonar-maven-plugin version as 1.0-beta-2.
Along with this plugin configuration, I have added a build post-action to run Sonar on my maven projects. But everytime Jenkins tries to execute sonar:sonar goal it fails with the below error.
Please help me guys in resolving this problem.
Thanks
[INFO] Building prof
[INFO] task-segment: [org.codehaus.mojo:sonar-maven-plugin:1.0-beta-2:sonar] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [sonar:sonar {execution: default-cli}]
[INFO] Sonar host: http://inmqbs:9000
[INFO] Sonar version: 3.3.2
[INFO] Execute: org.codehaus.sonar:sonar-maven-plugin:3.3.2:sonar
Downloading: http://troop:8081/nexus/content/groups/platform//org/codehaus/sonar/sonar-maven- plugin/3.3.2/sonar-maven-plugin-3.3.2.pom
[INFO] Unable to find resource 'org.codehaus.sonar:sonar-maven-plugin:pom:3.3.2' in repository troop-maven-releases (http://troop:8081/nexus/content/groups/platform/)
Downloading: http://troop:8081/nexus/content/groups/platform//org/codehaus/sonar/sonar-maven-plugin/3.3.2/sonar-maven-plugin-3.3.2.pom
[INFO] Unable to find resource 'org.codehaus.sonar:sonar-maven-plugin:pom:3.3.2' in repository central (http://repo1.maven.org/maven2)
Downloading: http://troop:8081/nexus/content/groups/platform//org/codehaus/sonar/sonar-maven-plugin/3.3.2/sonar-maven-plugin-3.3.2.pom
[INFO] Unable to find resource 'org.codehaus.sonar:sonar-maven-plugin:pom:3.3.2' in repository troop-maven-releases (http://troop:8081/nexus/content/groups/platform/)
Downloading: http://troop:8081/nexus/content/groups/platform//org/codehaus/sonar/sonar-maven-plugin/3.3.2/sonar-maven-plugin-3.3.2.pom
[INFO] Unable to find resource 'org.codehaus.sonar:sonar-maven-plugin:pom:3.3.2' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Can not execute Sonar
Embedded error: Unable to build project for plugin 'org.codehaus.sonar:sonar-maven-plugin': POM 'org.codehaus.sonar:sonar-maven-plugin' not found in repository: Unable to download the artifact from any repository
org.codehaus.sonar:sonar-maven-plugin:pom:3.3.2
from the specified remote repositories:
internal-repository (http://troop:8081/nexus/content/groups/platform/)
for project org.codehaus.sonar:sonar-maven-plugin
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute Sonar
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals (DefaultLifecycleExecutor.java:719)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal (DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal (DefaultLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:103)
at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:79)
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:88)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals (DefaultLifecycleExecutor.java:694)
... 17 more
The problem clearly comes from your Nexus repository or from some specific configuration that you've made in your POM / settings.xml file / Jenkins settings. You should contact the guys who handle this "http://troop:8081" Nexus instance to know how to deal with your issue.
BTW, there's no need to force the version of the sonar-maven-plugin plugin: this will cause you only troubles.
what database are you using?, if it defaults to derby database then only connections from the localhost are allowed and thus sonar and jenkins should run in the same machine. If this is the problem i can give further guidance but in a nutshell either change the database, or change the derby connection properties or provide a ssh tunnel between sonar and jenkins machines.
Use in the your configuration sonar-maven-plugin 2.0-beta-1
instead sonar-maven-plugin:1.0-beta-2

Trying to compile mahout but getting error - Cannot execute mojo: resources. Build is not using pom.xml

I have completed the following steps:
Installed Java 1.6
I am using Ubuntu 11.10. Added the $JAVA_HOME path in /etc/bash.bachrc
Installed maven. mvn --version is showing the installed maven correctly.
Downloaded Mahout from http://svn.apache.org/repos/asf/mahout/trunk
Now, I go inside mahout/trunk and try to do mvn clean install or mvn clean install -X -e, then it gives the follwoing error -
Cannot execute mojo: resources. It requires a project with an existing
pom.xml, but the build is not using one.
I just want to try the examples in the mahout/examples. How to fix this error?
There is a pom.xml in the directory.
Full terminal output is here:
+ Error stacktraces are turned on.
Apache Maven 2.2.1 (rdebian-6)
Java version: 1.6.0_23
Java home: /usr/lib/jvm/java-6-openjdk/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux" version: "3.0.0-16-generic" arch: "i386" Family: "unix"
[DEBUG] Building Maven user-level plugin registry from: '/home/kartikeya/.m2/plugin-registry.xml'
[DEBUG] Building Maven global-level plugin registry from: '/usr/share/maven2/conf/plugin-registry.xml'
[INFO] Scanning for projects...
[DEBUG] Wagons could not be registered as the extension container was never created
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[DEBUG] Retrieving parent-POM: org.apache.maven.plugins:maven-plugins:pom:12 for project: null:maven-clean-plugin:maven-plugin:2.3 from the repository.
[DEBUG] Retrieving parent-POM: org.apache.maven:maven-parent:pom:9 for project: org.apache.maven.plugins:maven-plugins:pom:12 from the repository.
[DEBUG] Retrieving parent-POM: org.apache:apache:pom:4 for project: org.apache.maven:maven-parent:pom:9 from the repository.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot execute mojo: clean. It requires a project with an existing pom.xml, but the build is not using one.
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Cannot execute mojo: clean. It requires a project with an existing pom.xml, but the build is not using one.
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot execute mojo: clean. It requires a project with an existing pom.xml, but the build is not using one.
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:414)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
... 17 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Wed Mar 21 11:32:36 IST 2012
[INFO] Final Memory: 2M/55M
[INFO] ------------------------------------------------------------------------
Thank you ajozwik and Owen.
I installed maven2 from the aptitude. I took the following steps to fix this issue:
Removed Maven2 sudo apt-get remove maven2
Installed Maven 3.0.4 for ubuntu as directed in - Installing maven2 without openjdk
Even after doing this, I got the error -
Unable to locate the javac Compiler in:[ERROR] /usr/lib/jvm/java-6-openjdk/jre/../lib/tools.jar
To fix this, JDK needs to be reinstalled. It worked for me!. For those even, if this solution doesn't work, please have a look at - Why maven ignores my JAVA_HOME?
Regards.
"Cannot execute mojo: resources. It requires a project with an existing pom.xml"
This error means there is not pom.xml in the working directory

Resources