Java LOC counting by comparing two project
-
20-06-2021 - |
Question
I have two Java
projects in eclipse. Same project but different versions.
Now I want to compare these projects and find out the Inserted, Modified, Deleted LOC
s of each java
project.
Is there any plugins are available for this same purpose? Or is there any such tools are available? Please advise me.
La solution
You can click to projects/folders/packages in Eclipse, right click and select Compare With
> Each Other
. That will give you an overview of the differences between them. It does not give it on a line basis however, nor does it recurse into subdirectories.
On Linux, you could use diff
and diffstat
together like follows.
diff -rN old-dir new-dir | diffstat
Argument -r
will make the diff recursive (i.e. look in subdirectories), and -N
will treat missing files as empty (to report lines as added, rather than the file as added).
This will produce a list like:
directory/some-file | 5 +++++
directory/other-file | 18 +++++++++-------
2 files changed, 14 insertions(+), 7 deletions(-)
It doesn't report number of modified files, but inserted and deleted.
Autres conseils
On Windows, WinMerge can compare a whole hierarchy of files and tell you which exists on one side only, and what are the difference between the left and right versions if a file exists in both hierarchies. Not sure if it counts the number of lines which differ, though.