tsantalis / JDeodorant

JDeodorant
https://marketplace.eclipse.org/content/jdeodorant
MIT License
139 stars 59 forks source link

Help wanted. Run JDeodorant without having eclipse installed #60

Closed IqNone closed 7 years ago

IqNone commented 7 years ago

Hello,

I followed this article and i managed to run JDeodorant from command line. However it would be better for me to run this without using eclipse at all. Is this possible?

It wouldn't be an issue if it needs to create some extra files if it can do this automatically, the only concern is to not have eclipse installed.

dmazinanian commented 7 years ago

Hi,

It is possible to make an Eclipse product for your target platform (Windows, Mac, Linux) that runs JDeodorant in the command line.

The application that you are downloading from here only prints the refactoring opportunities, as detected by JDeodorant. We have another application here that also applies refactorings (for now only for duplicated code, Dr. Tsantalis has been working on the God Class instances as well, though it is still experimental). For this application, we have provided the necessary configuration so that you can export an Eclipse product that runs from the command line. You won't need to install anything on your target machine (Except Java): you'll export the application from Eclipse once, and then move the entire generated package to your target machine, and run the executable in the command line. You can find the necessary steps here.

Unfortunately, we don't have the product configuration files for the application that you are downloading. On the other hand, the other application for which we have the product configuration does not print the opportunities. There are different options:

  1. You try and take the necessary steps for exporting an Eclipse product from the application that you are downloading (this could be a starting point).

  2. You make some changes to the code of the application that has eclipse configuration so that it prints the opportunities (compare Application.java files in the source code of the two applications). Then export the Eclipse application.

  3. You bear with us for some time, we will either try to add the product configurations to the first application, or we will add the code for printing all opportunities to the second one (hopefully soon).

Hope this helps for now.

dmazinanian commented 7 years ago

OK, I added the support for printing the identified refactoring opportunities to console to jdeodorant-commandline project. This is experimental though, I tested it and it seems to be working on Mac. You will need to follow the steps mentioned here. However, in step 1, instead of cloning (or downloading) jdeodorant-commandline project, get the project from this branch. The code is not yet in the master branch, we will do some more tests and then we might merge it with the master branch later. The rest of the steps are the same, and it should normally work.

After exporting the product, you will need to run it like this:

./eclipse -m print_opportunities -pd path/to/.project

Note that, the path/to/.project is the path to the .project file (normally in the project folder that you need to analyze).

As you can see here, I'm running it with no problem:

image

Hope this helps. Please let us know should you encounter any problem.

IqNone commented 7 years ago

Ok, thanks for the help.

I will need to get some time to spend on this, but thank you for the support