I have 2 maven project that the main one uses the second one's jar as dependency. once I add the jar file as dependency via the artifactory server everything is good but the main problem is that I want to debug the main project and while tracing I want to be able to move to the code of the second project. please help how to do that in eclipse?
You simply have to have both projects opened in Eclipse. The pom version number of the second project has to match what you specify in the version in the dependency in the first project.
Note that one comment on your post indicated to use a different version than would exist in artifactory. This will work, but it is not necessary. The versions DO have to match, but if your checked-out project in eclipse has the same version as what is in artifactory, it will use the local project instead of the artifact in artifactory.