Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view shell commands used by eclipse "run configurations"

Given a "run configuration" in Eclipse, I want to print out the associated shell command that would be used to run it.

For example: Right now, in Eclipse, if I click "play" it will run:

mvn assembly:directory -Dmaven.test.skip=true

I don't see that command, I just know that's what the IDE must run, at some point. However, some of the other run configurations are far more complex with long classpaths and virtual machine options and, frankly, sometimes I have no idea what the equivalent shell command would be (particularly when it comes to Flex).

There must be some way to access the shell command that would be associated with a "Run Configuration" in Eclipse/Flex Builder. This information must be available, which leads me to believe someone has written a plugin to display it. Or maybe there's already an option built into Eclipse for accessing this.

So is there a way to, essentially, convert an Eclipse run configuration into a shell command?

(for context only: I'm asking because I'm writing a bash script that automates everything I do, during development--from populating the Database all the way to opening Firefox and clearing the cache before running the web app. So every command I run from the IDE needs to exist in the script. Some are tricky to figure out.)

like image 740
gMale Avatar asked Jun 04 '10 17:06

gMale


People also ask

How do I get to the run configuration in Eclipse?

Creating and Using a Run Configuration The Run Configuration dialog can be invoked by selecting the Run Configurations menu item from the Run menu. A name for the run configuration.

Where is Eclipse Runtime config?

In Eclipse look at Project -> Properties for the project you want a runtime configuration. Choose Run/Debug settings and choose new or edit one you already have. When creating a New run/debug config make sure to choose Java Project. When the dialog box opens you will see a tab for classpath directives.

How do I get the command prompt in Eclipse?

To open the command prompt (shell or terminal) using the path of a project directory inside Eclipse, you just need to select the folder, and press Ctrl+Alt+T, or right-click and select Show In Local Terminal > Terminal. Then, the terminal will open in a new view inside Eclipse.


2 Answers

This should work for Java and Maven processes. You can get the command line from the Process properties.

  • run the process in debug mode
  • right click on the process item in the "Debug" view and choose "Properties"
  • the command line is displayed
like image 153
splash Avatar answered Sep 22 '22 15:09

splash


Another trick if you're running on a Unix OS (although you have to be snappy about this...) is to initiate your Run.. within Eclipse and then switch over to a command prompt and run this command (Mac syntax):

ps -ef | grep java 

This will print out the command line Java process invocations that are currently running. Look for the one that corresponds to your Eclipse process (check the main class, which is the last parameter on the command line) and voila!

like image 33
Alex Avatar answered Sep 21 '22 15:09

Alex