debug gradle-built project with jdb

故事扮演 提交于 2019-12-11 05:25:47

问题


I'd like to use jdb with a gradle-built project. The project's build instructions require running a ./gradlew run, which eventually launches a command like:

/abs/path/to/java -Dorg.gradle.appname=gradlew -classpath /abs/path/to/uaa/gradle/wrapper/gradle-wrapper.jar org.gradle.wrapper.GradleWrapperMain run

I replaced java with jdb,

jdb -Dorg.gradle.appname=gradlew -classpath /abs/path/to/uaa/gradle/wrapper/gradle-wrapper.jar org.gradle.wrapper.GradleWrapperMain run

then issue run, this runs the program correctly.

But when trying to set a breakpoint, I only see gradle-related wrapper classes and no classes defined by the project itself:

jdb$ classes 
Press Ctrl-C to stop the container...

** classes list **
TimingsListener
boolean[]
build_19g308g2k1ic6ss1rnhwvmogn
build_19g308g2k1ic6ss1rnhwvmogn
build_19g308g2k1ic6ss1rnhwvmogn$_run_closure1
build_19g308g2k1ic6ss1rnhwvmogn$_run_closure1
build_19g308g2k1ic6ss1rnhwvmogn$_run_closure1$_closure19
build_19g308g2k1ic6ss1rnhwvmogn$_run_closure1$_closure2
build_19g308g2k1ic6ss1rnhwvmogn$_run_closure1$_closure2$_closure4
build_19g308g2k1ic6ss1rnhwvmogn$_run_closure1$_closure2$_closure5
org.sonatype.maven.polyglot.groovy.builder.factory.PropertiesFactory
org.sonatype.maven.polyglot.groovy.builder.factory.ReportingFactory
org.sonatype.maven.polyglot.groovy.builder.factory.StringFactory
org.springframework.build.gradle.propdep.PropDepsEclipsePlugin
org.springframework.build.gradle.propdep.PropDepsEclipsePlugin$_apply_closure1
org.springframework.build.gradle.propdep.PropDepsEclipsePlugin$_apply_closure1_closure2
org.springframework.build.gradle.propdep.PropDepsIdeaPlugin
org.springframework.build.gradle.propdep.PropDepsIdeaPlugin$_apply_closure1
org.springframework.build.gradle.propdep.PropDepsMavenPlugin
org.springframework.build.gradle.propdep.PropDepsMavenPlugin$_applyToPom_closure3
org.springframework.build.gradle.propdep.PropDepsMavenPlugin$_applyToUploadTask_closure2
org.springframework.build.gradle.propdep.PropDepsMavenPlugin$_apply_closure1
org.springframework.build.gradle.propdep.PropDepsPlugin
org.springframework.build.gradle.propdep.PropDepsPlugin$_addConfiguration_closure1

org.w3c.dom.Attr
org.w3c.dom.CharacterData
org.w3c.dom.Comment
org.w3c.dom.Document
org.w3c.dom.Element
org.w3c.dom.NamedNodeMap
org.w3c.dom.Node
org.w3c.dom.NodeList
org.w3c.dom.Text
org.w3c.dom.TypeInfo
org.w3c.dom.events.DocumentEvent
org.w3c.dom.events.EventTarget
org.w3c.dom.ranges.DocumentRange
org.w3c.dom.traversal.DocumentTraversal
org.w3c.dom.traversal.NodeIterator
org.xml.sax.AttributeList
org.xml.sax.Attributes
org.xml.sax.ContentHandler
org.xml.sax.DTDHandler
org.xml.sax.EntityResolver
org.xml.sax.ErrorHandler
org.xml.sax.InputSource
org.xml.sax.Locator
org.xml.sax.Parser
org.xml.sax.SAXException
org.xml.sax.SAXNotRecognizedException
org.xml.sax.XMLFilter
org.xml.sax.XMLReader
org.xml.sax.ext.Attributes2
org.xml.sax.ext.DeclHandler
org.xml.sax.ext.LexicalHandler
org.xml.sax.ext.Locator2
org.xml.sax.helpers.AttributesImpl
org.xml.sax.helpers.DefaultHandler
org.xml.sax.helpers.LocatorImpl
org.xml.sax.helpers.XMLFilterImpl
settings_d5weln3odba3qfna9oixzlnz9
shared_versions_5sle70vx5n7nodqq2a6r35ma9
shared_versions_5sle70vx5n7nodqq2a6r35ma9$_run_closure1
short[]
sun.invoke.util.BytecodeDescriptor
sun.invoke.util.VerifyAccess
sun.invoke.util.VerifyType
sun.invoke.util.Wrapper
sun.invoke.util.Wrapper$Format
sun.launcher.LauncherHelper
sun.launcher.LauncherHelper$FXHelper
sun.management.ManagementFactoryHelper
sun.management.ManagementFactoryHelper$4
sun.management.RuntimeImpl
sun.management.Util
sun.management.VMManagement
sun.management.VMManagementImpl
sun.misc.ASCIICaseInsensitiveComparator
sun.misc.Cleaner
sun.misc.CompoundEnumeration
sun.misc.ExtensionDependency
sun.misc.FDBigInteger
sun.misc.FileURLMapper
sun.misc.FloatingDecimal
sun.misc.FloatingDecimal$1
sun.misc.FloatingDecimal$ASCIIToBinaryConverter
sun.misc.FloatingDecimal$BinaryToASCIIBuffer
sun.misc.FloatingDecimal$BinaryToASCIIConverter
sun.misc.FloatingDecimal$ExceptionalBinaryToASCIIBuffer
sun.misc.FloatingDecimal$HexFloatPattern
sun.misc.FloatingDecimal$PreparedASCIIToBinaryBuffer
sun.misc.IOUtils
sun.misc.JarIndex
sun.misc.JavaIOAccess
sun.misc.JavaIOFileDescriptorAccess
sun.misc.JavaLangAccess
sun.misc.JavaNetAccess
sun.misc.JavaNioAccess
sun.misc.JavaSecurityAccess
sun.misc.JavaSecurityProtectionDomainAccess
sun.misc.JavaUtilJarAccess
sun.misc.JavaUtilZipFileAccess
sun.misc.Launcher
sun.misc.Launcher$AppClassLoader
sun.misc.Launcher$AppClassLoader$1
sun.misc.Launcher$BootClassPathHolder
sun.misc.Launcher$BootClassPathHolder$1
sun.misc.Launcher$ExtClassLoader
sun.misc.Launcher$ExtClassLoader$1
sun.misc.Launcher$Factory
sun.misc.MetaIndex
sun.misc.NativeSignalHandler
sun.misc.OSEnvironment
sun.misc.Perf
sun.misc.Perf$GetPerfAction
sun.misc.PerfCounter
sun.misc.PerfCounter$CoreCounters
sun.misc.PostVMInitHook
sun.misc.ProxyGenerator
sun.misc.ProxyGenerator$ConstantPool
sun.misc.ProxyGenerator$ConstantPool$Entry
sun.misc.ProxyGenerator$ConstantPool$IndirectEntry
sun.misc.ProxyGenerator$ConstantPool$ValueEntry
sun.misc.ProxyGenerator$ExceptionTableEntry
sun.misc.ProxyGenerator$FieldInfo
sun.misc.ProxyGenerator$MethodInfo
sun.misc.ProxyGenerator$PrimitiveTypeInfo
sun.misc.ProxyGenerator$ProxyMethod
sun.misc.Resource
sun.misc.SharedSecrets
sun.misc.Signal
sun.misc.SignalHandler
sun.misc.URLClassPath
sun.misc.URLClassPath$1
sun.misc.URLClassPath$2
sun.misc.URLClassPath$3
sun.misc.URLClassPath$FileLoader
sun.misc.URLClassPath$FileLoader$1
sun.misc.URLClassPath$JarLoader
sun.misc.URLClassPath$JarLoader$1
sun.misc.URLClassPath$JarLoader$2
sun.misc.URLClassPath$Loader
sun.misc.Unsafe
sun.misc.VM
sun.misc.VMSupport
sun.misc.Version
sun.net.DefaultProgressMeteringPolicy
sun.net.InetAddressCachePolicy
sun.net.InetAddressCachePolicy$1
sun.net.InetAddressCachePolicy$2
sun.net.NetHooks
sun.net.NetHooks$Provider
sun.net.NetProperties
sun.net.NetProperties$1
sun.util.spi.CalendarProvider

full list

So I'm not able to set any useful breakpoints.

What is the best way to work around this, to be able to set a breakpoint in then class in which I'm interested (for example: org.cloudfoundry.identity.uaa.oauth.SomeClass.someMethod)?

I've tried

stop in org.cloudfoundry.identity.uaa.oauth.SomeClass.someMethod
stop in SomeClass.someMethod

and other combinations without luck

来源:https://stackoverflow.com/questions/38887959/debug-gradle-built-project-with-jdb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!