maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Pennebaker <apenneba...@42six.com>
Subject Re: Is there a Maven plugin for the Java debugger (jdb)?
Date Mon, 14 Oct 2013 13:56:28 GMT
So close! I added the snippet inside my
<build><plugins>...</plugins></build> in pom.xml. Thanks for supplying
the
exact code, by the way!

But jdb is showing an error:

$ mvn exec:exec -Djdb.mainClass=HelloMaven
Initializing jdb ...
> run
run HelloMaven
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started:
Exception occurred: java.lang.ClassNotFoundException
(uncaught)"thread=main", java.net.URLClassLoader$1.run(), line=202 bci=73

main[1]

This happens for any class I hand exec:exec.

This is the same error I see if I try to jdb <Class> manually.

Are we sure the <argument>-classpath</argument><classpath /> bit is the
correct way to hand jdb the CLASSPATH?


On Fri, Oct 11, 2013 at 4:20 PM, Curtis Rueden <ctrueden@wisc.edu> wrote:

> Hi Andrew,
>
> > Could you elaborate on the exact <plugin>...</plugin> snippet I would
> > need to drop into my pom.xml in order to achieve this?
>
> <plugin>
>   <groupId>org.codehaus.mojo</groupId>
>   <artifactId>exec-maven-plugin</artifactId>
>   <version>1.2.1</version>
>   <configuration>
>     <executable>jdb</executable>
>     <arguments>
>       <argument>-classpath</argument>
>       <classpath />
>       <argument>${jdb.mainClass}</argument>
>     </arguments>
>   </configuration>
>   <executions>
>     <execution>
>       <goals>
>         <goal>exec</goal>
>       </goals>
>     </execution>
>   </executions>
> </plugin>
>
> > If I could just `mvn exec:exec <Class>`, starting a jdb session on
> > <Class>.main(), that would be *perfect*.
>
> We can get close. If you use the block above, you would launch with:
>
>     mvn -Djdb.mainClass=<Class> exec:exec
>
> Where "jdb.mainClass" is the property used in the XML above. And if that is
> not concise enough for your taste you can choose a property with a shorter
> name.
>
> Working example inside a profile with a specific main class is here:
>
>
> https://github.com/imagej/imagej/commit/8cfe0fde7d89c71e083c992f5c7432b29f09c483
>
> Regards,
> Curtis
>
>
> On Fri, Oct 11, 2013 at 1:47 PM, Andrew Pennebaker <apennebaker@42six.com
> >wrote:
>
> > Thank you, Curtis, that looks like an excellent suggestion!
> >
> > Could you elaborate on the exact <plugin>...</plugin> snippet I would
> need
> > to drop into my pom.xml in order to achieve this?
> >
> > If I could just `mvn exec:exec <Class>`, starting a jdb session on
> > <Class>.main(), that would be *perfect*.
> >
> >
> > On Fri, Oct 11, 2013 at 1:20 PM, Curtis Rueden <ctrueden@wisc.edu>
> wrote:
> >
> > > Hi all,
> > >
> > > Rather than getting into an eclipse vs. vim vs. emacs flamewar, I'd
> > rather
> > > just ask: Andrew, did you try attaching your jdb to a running java
> > instance
> > > launched via exec-maven-plugin as I suggested yet?
> > >
> > > You can configure exec-maven-plugin in your pom so that launching the
> > > compatible java process is as easy as "mvn exec:exec". You could even
> > > specify jdb as the executable directly if that's what you want and then
> > you
> > > wouldn't even need the attachment step. Using profiles (yes, this is
> one
> > of
> > > their benign uses!) you can even set up multiple different behaviors of
> > > exec:exec for different common situations. Really I don't think there
> is
> > > any need whatsoever for a dedicated "mvn exec:jdb" here.
> > >
> > > -Curtis
> > > On Oct 11, 2013 10:53 AM, "Andrew Pennebaker" <apennebaker@42six.com>
> > > wrote:
> > >
> > > > Why would anyone want to do this? So we don't have to debug Maven
> > > projects
> > > > with Eclipse/IntelliJ, but the text editor of our choice. This is
> best
> > > > accomplished by Maven tasks which interact with the command line jdb
> > > tool.
> > > >
> > > >
> > > > On Thu, Oct 10, 2013 at 5:27 PM, Russell Gold <russ@gold-family.us>
> > > wrote:
> > > >
> > > > > Why do you want to do that? I suspect we are not getting at your
> > actual
> > > > > requirement.
> > > > >
> > > > > On Oct 10, 2013, at 2:25 PM, Andrew Pennebaker <
> > apennebaker@42six.com>
> > > > > wrote:
> > > > >
> > > > > > Yes, various Java IDEs can debug Java code, including Java code
> > > > organized
> > > > > > in Maven projects. What I'm interested in is debugging Java
code
> > in a
> > > > > Maven
> > > > > > project with an arbitrary text editor, not necessarily Eclipse
or
> > > > > Intellij,
> > > > > > for example Emacs, or even Notepad, by invoking Maven tasks
that
> > > point
> > > > to
> > > > > > Maven plugins that interact with jdb.
> > > > > >
> > > > > >
> > > > > > On Thu, Oct 10, 2013 at 2:09 PM, Sankaran, Nambi <
> > nsankaran@ebay.com
> > > >
> > > > > wrote:
> > > > > >
> > > > > >> It very is easy to debug maven from eclipse, I have documented
> > how I
> > > > > debug
> > > > > >> maven-jetty-plugin using eclipse
> > > > > >>
> > > > > >>
> > > > >
> > > >
> > >
> >
> http://nambisankaran.wordpress.com/2012/06/30/running-jetty-server-with-maven/
> > > > > >>
> > > > > >> -----Original Message-----
> > > > > >> From: Andrew Pennebaker [mailto:apennebaker@42six.com]
> > > > > >> Sent: Thursday, October 10, 2013 11:04 AM
> > > > > >> To: Maven Users List
> > > > > >> Subject: Re: Is there a Maven plugin for the Java debugger
> (jdb)?
> > > > > >>
> > > > > >> I could also use an IDE for package management, but I'd
rather
> use
> > > > plain
> > > > > >> Maven and an arbitrary text editor instead.
> > > > > >>
> > > > > >>
> > > > > >> On Thu, Oct 10, 2013 at 11:21 AM, Russell Gold <
> > russ@gold-family.us
> > > >
> > > > > >> wrote:
> > > > > >>
> > > > > >>> The simplest way to do this is actually to run it in
your IDE
> > > > directly.
> > > > > >>> IntellijIDEA community edition can import your maven
project
> and
> > > thus
> > > > > >>> get all of the dependencies. Then you just run the program
in
> the
> > > > > >>> debugger. I presume Eclipse can do something similar.
> > > > > >>>
> > > > > >>> On Oct 10, 2013, at 10:52 AM, Andrew Pennebaker
> > > > > >>> <apennebaker@42six.com>
> > > > > >>> wrote:
> > > > > >>>
> > > > > >>>> Yes. I'm looking for a task like `mvn jdb:debug
<Class>` that
> > > starts
> > > > > >>>> a
> > > > > >>> jdb
> > > > > >>>> session on <Class>.main().
> > > > > >>>>
> > > > > >>>> I can run jdb on individual Java code outside of
a Maven
> > > structure,
> > > > > >>>> but
> > > > > >>> I'm
> > > > > >>>> not sure how to inform jdb of Java code in a Maven
project,
> > > Maven's
> > > > > >>>> CLASSPATH handling, etc. etc.
> > > > > >>>>
> > > > > >>>>
> > > > > >>>> On Thu, Oct 10, 2013 at 10:46 AM, Benson Margulies
<
> > > > > >>> bimargulies@gmail.com>wrote:
> > > > > >>>>
> > > > > >>>>> What would that mean? Do you want to execute
the program in
> the
> > > > > >>> debugger?
> > > > > >>>>>
> > > > > >>>>> On Thu, Oct 10, 2013 at 10:38 AM, Andrew Pennebaker
> > > > > >>>>> <apennebaker@42six.com> wrote:
> > > > > >>>>>> I'd like to run jdb over some of my classes
in a Maven
> > project.
> > > Is
> > > > > >>> there
> > > > > >>>>> a
> > > > > >>>>>> plugin I can drop into my pom.xml?
> > > > > >>>>>
> > > > > >>>>>
> > > -------------------------------------------------------------------
> > > > > >>>>> -- To unsubscribe, e-mail:
> users-unsubscribe@maven.apache.org
> > > > > >>>>> For additional commands, e-mail: users-help@maven.apache.org
> > > > > >>>>>
> > > > > >>>>>
> > > > > >>>
> > > > > >>> -----------------
> > > > > >>> Author, Getting Started with Apache Maven <
> > > > > >>>
> http://www.packtpub.com/getting-started-with-apache-maven/video>
> > > > > >>>
> > > > > >>> Come read my webnovel, Take a Lemon <http://www.takealemon.com
> >,
> > > and
> > > > > >>> listen to the Misfile radio play <
> > > > > >>> http://www.fuzzyfacetheater.com/misfile/>!
> > > > > >>>
> > > > > >>>
> > > > > >>>
> > > > > >>>
> > > > > >>>
> > > > > >>>
> > > > > >>>
> > > > > >>>
> > > > > >>
> > > > > >>
> > > ---------------------------------------------------------------------
> > > > > >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > > >> For additional commands, e-mail: users-help@maven.apache.org
> > > > > >>
> > > > > >>
> > > > >
> > > > > -----------------
> > > > > Author, Getting Started with Apache Maven <
> > > > > http://www.packtpub.com/getting-started-with-apache-maven/video>
> > > > >
> > > > > Come read my webnovel, Take a Lemon <http://www.takealemon.com>,
> > > > > and listen to the Misfile radio play <
> > > > > http://www.fuzzyfacetheater.com/misfile/>!
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message