Re: I am wandering how you do guys debug maven?
Thanks for the tip! Will count these in. On Sat, Oct 13, 2018 at 8:51 AM John Patrick wrote: > but if you configure surefire or failsafe, of any other plugin that > supports fork to fork, it will be a new jvm, so it can get confusing > to debug maven when it's running like that. > On Sat, 13 Oct 2018 at 12:41, Karl Heinz Marbaise > wrote: > > > > Hi, > > > > On 08/10/18 23:08, Simon Sheng wrote: > > > Hi, > > > > > > I am bringing this baby question since Maven load all it's classes by > > > ClassWorlds. Which means it doesn't have "main method". instead we > debug > > > everything by log, do we have other way like debug with any IDE: > Eclipse, > > > Intellij etc. put breakpoints and debug step by step ? > > > > Maven has a main method it looks like this: > > > > > > public static void main( String[] args ) > > { > > int result = main( args, null ); > > > > System.exit( result ); > > } > > > > > > and is located in package: org.apache.maven.cli.MavenCli in module > > maven-embedder. > > > > where you can set a breakpoint... > > > > Kind regards > > Karl Heinz Marbaise > > > > - > > To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org > > For additional commands, e-mail: dev-h...@maven.apache.org > > > -- Sent from Gmail Mobile
Re: I am wandering how you do guys debug maven?
John, I must call you master, it's pretty long since 2005! :-) I got you now, add the profile and run by it. Thanks a lot! man. Simon(ChengHong) Sheng On Fri, Oct 12, 2018 at 2:42 PM John Patrick wrote: > simon, > been using maven since 2005 so 1.x something, so might be better way > as often i discover features added several releases ago that i simply > missed to kept using the old approach as it works and isn't broken. > Something like; > > ... > > ... > > debug > > 5005 > > -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=${project.debug.port} > > > ... > > ... > > > ${project.debug.args} > > > > > then "mvn -Pdebug test" and surefire uses the argLine user property. > then if you want to change the port "mvn -Pdebug > -Dproject.debug.port=8000 test". the important part is suspend=y. > > Reading the latest > > https://maven.apache.org/surefire/maven-surefire-plugin/examples/debugging.html > , > then "mvn -Dmaven.surefire.debug test" should setup a debug port on > 5005 but i've only just seen that in the latest documentation but i've > probably not looked at surefire documentation for debugging for maybe > 6+ years. > > John > > On Fri, 12 Oct 2018 at 20:25, Simon Sheng wrote: > > > > Hi John, > > > > I am trying the profile, but no matter 5005 or 8000 port, I can't start > > debug. Would you please give me more detail of this profile. > > > > I global search maven source code, only classworld pom file has debug > > profile. > > > > I am looking into the wrapper you mentioned. > > > > Thank you! > > > > Simon(ChengHong) Sheng > > > > > > On Tue, Oct 9, 2018 at 5:24 AM John Patrick > wrote: > > > > > others have talked about mvnDebug, i prefer using a profile e.g. > > > debug, then all the surefire and failsafe and exec-maven-plugin, plus > > > other plugins are all configured to use ${DEBUG_ARGS}, then; > > > > > > $ mvn -Pdebug test > > > $ mvn -Pdebug exec:java > > > > > > Then in intellij/eclipse/netbeans I can just connect a remote debugger > > > to the code. For some situations you want it to pause the execute > > > until your debugger is connected otherwise you might miss breakpoints > > > if those test are executed 1st. > > > > > > I've also switched to maven wrapper so don't have mvnDebug anymore as > > > it means developers don't need to keep their local machines in sync > > > and just do mvnw and it will sort out the maven version that > > > project/branch requires. > > > > > > > > > On Tue, 9 Oct 2018 at 06:29, Tibor Digana > wrote: > > > > > > > > In IntelliJ IDEA it is "Remote", see Select Run/Debug Configurations > > > > > > Remote, change the port to 8000. > > > > Run command *mvnDebug test* and then start "Remote" in IDEA. > > > > > > > > On Tue, Oct 9, 2018 at 6:16 AM Romain Manni-Bucau < > rmannibu...@gmail.com > > > > > > > > wrote: > > > > > > > > > Hello > > > > > > > > > > Not sure the question was about test classes - you got answers for > > > that ;) > > > > > - or maven and plugins themselves. If the last one, just replace > "mvn" > > > by > > > > > "mvnDebug" in any command and remote debug on port 8000 in your > IDE. > > > > > > > > > > Side note: if you check mvn script you will see maven has a main > class > > > so > > > > > can be remote debugged as any java software ;) > > > > > > > > > > Le mar. 9 oct. 2018 05:44, Olivier Lamy a > écrit : > > > > > > > > > > > an other option is to use command line and the surefire option: > > > > > > -Dmaven.surefire.debug=true > > > > > > then you can have debug on port 5005 (look at your ide to start a > > > remote > > > > > > debug) > > > > > > > > > > > > On Tue, 9 Oct 2018 at 08:45, Enrico Olivelli < > eolive...@gmail.com> > > > > > wrote: > > > > > > > > > > > > > Il lun 8 ott 2018, 23:23 Jeff MAURY ha > > > scritto: > > > > > > > > > > > > > > > M2e takes care of everything > > > > > > > > > > > >
Re: I am wandering how you do guys debug maven?
Hi John, I am trying the profile, but no matter 5005 or 8000 port, I can't start debug. Would you please give me more detail of this profile. I global search maven source code, only classworld pom file has debug profile. I am looking into the wrapper you mentioned. Thank you! Simon(ChengHong) Sheng On Tue, Oct 9, 2018 at 5:24 AM John Patrick wrote: > others have talked about mvnDebug, i prefer using a profile e.g. > debug, then all the surefire and failsafe and exec-maven-plugin, plus > other plugins are all configured to use ${DEBUG_ARGS}, then; > > $ mvn -Pdebug test > $ mvn -Pdebug exec:java > > Then in intellij/eclipse/netbeans I can just connect a remote debugger > to the code. For some situations you want it to pause the execute > until your debugger is connected otherwise you might miss breakpoints > if those test are executed 1st. > > I've also switched to maven wrapper so don't have mvnDebug anymore as > it means developers don't need to keep their local machines in sync > and just do mvnw and it will sort out the maven version that > project/branch requires. > > > On Tue, 9 Oct 2018 at 06:29, Tibor Digana wrote: > > > > In IntelliJ IDEA it is "Remote", see Select Run/Debug Configurations > > > Remote, change the port to 8000. > > Run command *mvnDebug test* and then start "Remote" in IDEA. > > > > On Tue, Oct 9, 2018 at 6:16 AM Romain Manni-Bucau > > > wrote: > > > > > Hello > > > > > > Not sure the question was about test classes - you got answers for > that ;) > > > - or maven and plugins themselves. If the last one, just replace "mvn" > by > > > "mvnDebug" in any command and remote debug on port 8000 in your IDE. > > > > > > Side note: if you check mvn script you will see maven has a main class > so > > > can be remote debugged as any java software ;) > > > > > > Le mar. 9 oct. 2018 05:44, Olivier Lamy a écrit : > > > > > > > an other option is to use command line and the surefire option: > > > > -Dmaven.surefire.debug=true > > > > then you can have debug on port 5005 (look at your ide to start a > remote > > > > debug) > > > > > > > > On Tue, 9 Oct 2018 at 08:45, Enrico Olivelli > > > wrote: > > > > > > > > > Il lun 8 ott 2018, 23:23 Jeff MAURY ha > scritto: > > > > > > > > > > > M2e takes care of everything > > > > > > > > > > > > > > > > Same for Apache Netbeans :) > > > > > > > > > > Enrico > > > > > > > > > > > > > > > > Jeff > > > > > > > > > > > > Le lun. 8 oct. 2018 à 23:09, Simon Sheng > a > > > > > écrit : > > > > > > > > > > > > > Hi, > > > > > > > > > > > > > > I am bringing this baby question since Maven load all it's > classes > > > by > > > > > > > ClassWorlds. Which means it doesn't have "main method". > instead we > > > > > debug > > > > > > > everything by log, do we have other way like debug with any > IDE: > > > > > Eclipse, > > > > > > > Intellij etc. put breakpoints and debug step by step ? > > > > > > > > > > > > > > Thanks > > > > > > > > > > > > > > Simon(ChengHong) Sheng > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > > -- Enrico Olivelli > > > > > > > > > > > > > > > > > -- > > > > Olivier Lamy > > > > http://twitter.com/olamy | http://linkedin.com/in/olamy > > > > > > > > > - > To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org > For additional commands, e-mail: dev-h...@maven.apache.org > >
Re: I am wandering how you do guys debug maven?
Hi Romain, "mvnDebug" works for me. but when I read the script of mvn, I don't see main method but this: exec "$JAVACMD" \ 17 $MAVEN_OPTS \ 18 $MAVEN_DEBUG_OPTS \ 19 -classpath "${M2_HOME}"/boot/plexus-classworlds-*.jar \ 20 "-Dclassworlds.conf=${M2_HOME}/bin/m2.conf" \ 21 "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 22 ${CLASSWORLDS_LAUNCHER} "$@" and the "CLASSWORLDS_LAUNCHER" is "org.codehaus.plexus.classworlds.launcher.Launcher" but not maven main. Thanks a lot Simon(ChengHong) Sheng On Mon, Oct 8, 2018 at 11:16 PM Romain Manni-Bucau wrote: > Hello > > Not sure the question was about test classes - you got answers for that ;) > - or maven and plugins themselves. If the last one, just replace "mvn" by > "mvnDebug" in any command and remote debug on port 8000 in your IDE. > > Side note: if you check mvn script you will see maven has a main class so > can be remote debugged as any java software ;) > > Le mar. 9 oct. 2018 05:44, Olivier Lamy a écrit : > > > an other option is to use command line and the surefire option: > > -Dmaven.surefire.debug=true > > then you can have debug on port 5005 (look at your ide to start a remote > > debug) > > > > On Tue, 9 Oct 2018 at 08:45, Enrico Olivelli > wrote: > > > > > Il lun 8 ott 2018, 23:23 Jeff MAURY ha scritto: > > > > > > > M2e takes care of everything > > > > > > > > > > Same for Apache Netbeans :) > > > > > > Enrico > > > > > > > > > > Jeff > > > > > > > > Le lun. 8 oct. 2018 à 23:09, Simon Sheng a > > > écrit : > > > > > > > > > Hi, > > > > > > > > > > I am bringing this baby question since Maven load all it's classes > by > > > > > ClassWorlds. Which means it doesn't have "main method". instead we > > > debug > > > > > everything by log, do we have other way like debug with any IDE: > > > Eclipse, > > > > > Intellij etc. put breakpoints and debug step by step ? > > > > > > > > > > Thanks > > > > > > > > > > Simon(ChengHong) Sheng > > > > > > > > > > > > -- > > > > > > > > > -- Enrico Olivelli > > > > > > > > > -- > > Olivier Lamy > > http://twitter.com/olamy | http://linkedin.com/in/olamy > > >
Re: I am wandering how you do guys debug maven?
Hi Olivier, -Dmaven.surefier.debug=true works for me. I can remote from eclipse and intellij Another baby question: - What is the relationship between maven itself and surefire. My understanding of this is surefire is the original maven in house plugin. But maybe I am wrong. - Is the same thing to debug surefire and debug maven? this question focuses on the relationship of maven itself and surefire too since I know surefire can lead me to maven itself for sure. Thanks a lot for you help. Simon(ChengHong) Sheng On Mon, Oct 8, 2018 at 9:44 PM Olivier Lamy wrote: > an other option is to use command line and the surefire option: > -Dmaven.surefire.debug=true > then you can have debug on port 5005 (look at your ide to start a remote > debug) > > On Tue, 9 Oct 2018 at 08:45, Enrico Olivelli wrote: > > > Il lun 8 ott 2018, 23:23 Jeff MAURY ha scritto: > > > > > M2e takes care of everything > > > > > > > Same for Apache Netbeans :) > > > > Enrico > > > > > > > Jeff > > > > > > Le lun. 8 oct. 2018 à 23:09, Simon Sheng a > > écrit : > > > > > > > Hi, > > > > > > > > I am bringing this baby question since Maven load all it's classes by > > > > ClassWorlds. Which means it doesn't have "main method". instead we > > debug > > > > everything by log, do we have other way like debug with any IDE: > > Eclipse, > > > > Intellij etc. put breakpoints and debug step by step ? > > > > > > > > Thanks > > > > > > > > Simon(ChengHong) Sheng > > > > > > > > > -- > > > > > > -- Enrico Olivelli > > > > > -- > Olivier Lamy > http://twitter.com/olamy | http://linkedin.com/in/olamy >
I am wandering how you do guys debug maven?
Hi, I am bringing this baby question since Maven load all it's classes by ClassWorlds. Which means it doesn't have "main method". instead we debug everything by log, do we have other way like debug with any IDE: Eclipse, Intellij etc. put breakpoints and debug step by step ? Thanks Simon(ChengHong) Sheng