Reputation: 6207
I have two projects, A and B, both maven projects. Project A has a dependency on project B in it's pom.xml.
They are both local projects in my workspace, so when I run project A I want sometimes to place a breakpoint on project B and step through the code, but that doesn't work. Instead, the breakpoint hits and it stops but it says the source was not found, and shows that it is using the jar file installed in my local Maven repository.
I tried going into project A's build path configs and referencing project B there, but that didn't make a difference.
How can I step through the code on project B when running project A? Since they are both local I'm sure there's got to be a way... this is such a simple use case, I must be missing something.
Any help is appreciated! Thanks!
Upvotes: 0
Views: 6495
Reputation: 11
Add a Listener in Remote Java Application as below with the correct port number
( NOTICE : Port number may vary, check the console logs to know which port to listen to )
Eclipse -> Run-> Debug Configurations -> Remote java Applications -> add new ->
Name : “XXXRemote” | Host : “localhost” | Port : 5005
Eclipse -> Run -> Debug Configurations ->
Maven Build -> add new -> example -> Name : “XXXDebug” -> (select current project)
Set the Goal for example :
clean install -e -Dtags=@Test -DignoreTags=~@manual -DparallelScheme=SCENARIO -DjvmCount=1 -Ddomain=int -DrunEnv=Chrome -Dbamboo=false -Dmaven.failsafe.debug
Eclipse -> Run -> Debug Configuration -> Select “Debug” under Maven Build -> click on Debug
( NOTICE: In console you will see "Listening for transport dt_socket at address: 5005" )
Now again :
Eclipse -> Run -> Debug Configuration -> under Remote Java Application ->select “XXXRemote” click on Debug button
Click on Yes for Debug Perspective to start debug.
Sometimes Port need to be killed, follow below steps:
lsof -i:<port number>
kill -9 <PID>
Upvotes: 1
Reputation: 12885
Open the Properties of project A from the context menu, click on Maven and look for the checkbox Resolve dependencies from workspace project. If this is unset, this would explain the behaviour you're seeing.
In that case, activating the checkbox and running Maven | Update Project should solve your issue.
Upvotes: 0