• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Running help:describe command in Maven

 
Thapliyal Akshat
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,

I am learning Maven but whenever I tries to run help:describe command. It gives me the following error:

NoSuchMethodException: org.apache.maven.plugins.help.HelpMojo.toLines(java.lang.String, int, int, int)

My Versions are :

Maven version: 2.0.9
Java version: 1.5.0_14


The Way I am using the command is as follows:


or

or


It never works for me.

I have executed this command from all the locations that is, where my parent POM and sub POM resided and and as well as from a non maven directory but the output remains the same.

Can Anyone suggest what I am doing wrong.

The Maven Installation is perfectly fine because all my projects are working fine using maven but this command never works.


Thanks in Advance,
Akshat
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, it works for me, but hen I ma running Maven 2.1.0. It could be that your of your artifacts is corrputed. Try removing the m2_repo/org/apache/maven/plugins/maven-help-plugin directory and then run it again - Maven will download the help plugin artifact again.

If that does not fix it, then it is the fault of another artifact that is calling the help plugin artifact and you will have to figure out what that is. The best way to do that is to run with the -e or -X options and get the full stack trace of the error and examine the classes involved.
 
Thapliyal Akshat
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Peter for your reply.

I deleted the maven-help-directory but still it gives me the same error. I executed the command using -e option and below is the stacktrace.

[WARNING] Attempting to build MavenProject instance for Artifact (org.apache.maven.plugins:maven-help-plugin:2.2-20080829.090236-6) of type:
maven-plugin; constructing POM artifact instead.
[INFO] [help:describe]
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] NoSuchMethodException: org.apache.maven.plugins.help.HelpMojo.toLines(java.lang.String, int, int, int)
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException: NoSuchMethodException: org.apache.maven.plugins.help.HelpMojo.toLines(java.lang.String, int, int, in
t)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:579)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:512)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:482)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:227)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
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:585)
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.MojoFailureException: NoSuchMethodException: org.apache.maven.plugins.help.HelpMojo.toLines(java.lang.Str
ing, int, int, int)
at org.apache.maven.plugins.help.DescribeMojo.toLines(DescribeMojo.java:930)
at org.apache.maven.plugins.help.DescribeMojo.append(DescribeMojo.java:969)
at org.apache.maven.plugins.help.DescribeMojo.describePlugin(DescribeMojo.java:515)
at org.apache.maven.plugins.help.DescribeMojo.execute(DescribeMojo.java:268)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
... 16 more


THanks
Akshat
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The org.apache.maven.plugins.help.DescribeMojo class is in the the same directory, so it is not the fault of that JAR file. Let's explore other possibilities.

Do have a CLASSPATH set? if so, unset it.

If that does not fix the problem, or if it was not "set MAVEN_OPTS=-verbose:class" and run mvn again. You might want to redirect stdout to a file. The -vebose:class option causes the JVM to output each class loaded and the JAR it was loaded from. Look for the loading of org.apache.maven.plugins.help.DescribeMojo and org.apache.maven.plugins.help.HelpMojo. They should both come from the same JAR file. If they don't the one not in the Maven repository directory is the wrong one.
 
Thapliyal Akshat
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Thanks Peter for you reponse.

I executed my mvn help:describe command with verbose enabled.


[Loaded org.apache.maven.plugins.help.AbstractHelpMojo from file:/D:/Documents and Settings/Akshat/.m2/repository/org/apache/maven/plugin
s/maven-help-plugin/2.2-SNAPSHOT/maven-help-plugin-2.2-SNAPSHOT.jar]

[Loaded org.apache.maven.plugins.help.DescribeMojo from file:/D:/Documents and Settings/Akshat/.m2/repository/org/apache/maven/plugins/ma
ven-help-plugin/2.2-SNAPSHOT/maven-help-plugin-2.2-SNAPSHOT.jar]

...

[Loaded org.apache.maven.plugins.help.DescribeMojo$PluginInfo from file:/D:/Documents and Settings/Akshat/.m2/repository/org/apache/maven
/plugins/maven-help-plugin/2.2-SNAPSHOT/maven-help-plugin-2.2-SNAPSHOT.jar]

...

[Loaded org.apache.maven.plugins.help.HelpMojo from file:/D:/Documents and Settings/501283008/.m2/repository/org/apache/maven/plugins/maven-
help-plugin/2.2-SNAPSHOT/maven-help-plugin-2.2-SNAPSHOT.jar]

I searched the whole file for the string "org.apache.maven.plugins.help" and there were only 4 instances that I have mentioned above.
And all the 4 instances are using the same "maven-help-plugin-2.2-SNAPSHOT.jar".

Out of curiosity I decompiled this Jar file and what I found that there is no such method org.apache.maven.plugins.help.HelpMojo.toLines(java.lang.String, int, int, int). [ I know it's obvious that's why JVM/MVN is throwing me the error.].

private List toLines(String text, int indent)
private void toLines(List lines, String line)

I don't know but I think I should update my Maven version. Updating the maven version won't affect anything as it used for project building only so Its better to keep the updated stuff.

Thanks
Akshat
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand why you are getting a snapshot for the help plugin, mine is maven-help-plugin-2.1.jar. What are your remote repository settings? The 2.2 snapshot is not in the main Maven repository at http://repo1.maven.org/maven2/.
 
Thapliyal Akshat
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Peter,

The reason behind for picking the 2.2 snapshot jar file is because the maven is picking the jars from our Organization's internal repository. I have just checked my Org. internal repository using archiva and I found that It has this version only.

Furthermore, When I delete all the maven-help-plugin related jars from my local machine repo. it downloads from the same Internal repo which has been configured in settings.xml file by me.

So I think I should communicate it to the team who manages our Maven repository that I am facing such and such problem.

One thing more.. All the help:describe commands works fine at my home PC but at office PC no help:describe command works. So now i know how to fetch the details of plugin using help:describe command.


Thank a ton dear for telling me how to enable verbose for mvn on this forum. But now I got stuck with another issue of Mvn. Will be posting in a new thread if I am not able solve it own my own.

Akshat
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic