Running Jason applications in Eclipse - eclipse

When I want to run my .mas2j file in Eclipse, I always have to right click the file and then select "Run as Jason application". Is there a way to add a shortcut to do this?

Jason's "Run" button should be added to eclipse toolbar ("Step 14" of jason eclipse-plugin installation guide) and it is supposed to work. Anyway, you can save some time using shell, following instructions in jason's github page:
git clone https://github.com/jason-lang/jason.git
cd jason
gradle config
And run a project using a command like bellow:
jason examples/gold-miners-II/miners.mas2j
Another way, and actually my recommendation is moving to JaCaMo (which has Jason embedded). JaCaMo offers a gradle script for your projects. You can easily download JaCaMo from the repository and create a project from zero in one shot (first, go to your project root folder and then type):
curl -s -O http://jacamo.sourceforge.net/nps/np07.gradle
gradle -b np07.gradle --console=plain
After downloading JaCaMo, the script will ask you to type a name for your project, for instance, "test". So, go to "test" folder and type:
gradle run
The just created JaCaMo project should launch after this command. Besides good compiling performance, another advantage is that gradle will manage package dependencies.

This is usually the issue with uncategorized commands in Eclipse. I had the same issue with the Run JaCaMo Application option. In order to see all your plugin commands:
Go to Preferences -> General -> Keys. Click on Filters... and de-select Filter uncategorized commands then Ok.
Then you should be able to find the desired command in the Command list and add a preferred Binding.
Note: If Eclipse offers a command, it should be listed in the pop-up window that appears when hitting the Show a table of all available commands button of the Oomph toolbar. The table shows all the available commands, where you can find them, and all the defined shortcut keys.

Related

Run "mvn clean install" in Eclipse

Title says it all.
I want to run the console command mvn clean install on my project in question directly in Eclipse, not from the command line.
It would just be more convenient for me to do this, as I already have the project open in Eclipse. It would save me time if I would not have to navigate to the folder in Windows Explorer.
Not a big deal if I can't do this... but can I? And if so, how?
It would be great if I could just right click my project, then click "mvn clean install" from the context menu.
I use eclipse STS, so the maven plugin comes pre-installed. However, if you aren't using STS (Springsource Tool Suite), you can still install the m2Eclipse plugin. Here is the link:
http://www.eclipse.org/m2e/
Once you have this installed, you should be able to run all the maven commands. To do so, from the package explorer, you would right click on either the maven project or the pom.xml in the maven project, highlight Run As, then click Maven Install.
Hope this helped.
Run a custom maven command in Eclipse as follows:
Right-click the maven project or pom.xml
Expand Run As
Select Maven Build...
Set Goals to the command, such as: clean install -X
Note: Eclipse prefixes the command with mvn automatically.
You can create external command Run -> External Tools -> External Tools Configuration...
It will be available under Run -> External Tools and can be run using shortcuts.
Right click on pom.xml, Run As, you should see the list of m2 options if you have Maven installed, you can select Maven Clean from there
If you want to open command prompt inside your eclipse, this can be a useful approach to link cmd with eclipse.
You can follow this link to get the steps in detail with screenshots.
How to use cmd prompt inside Eclipse ?
I'm quoting the steps here:
Step 1: Setup a new External Configuration Tool
In the Eclipse tool go to Run -> External Tools -> External Tools Configurations option.
Step 2: Click New Launch Configuration option in Create, manage and run configuration screen
Step 3: New Configuration screen for configuring the command prompt
Step 4: Provide configuration details of the Command Prompt in the Main tab
Name: Give any name to your configuration (Here it is Command_Prompt)
Location: Location of the CMD.exe in your Windows
Working Directory: Any directory where you want to point the Command prompt
Step 5: Tick the check box Allocate console
This will ensure the eclipse console is being used as the command prompt for any input or output.
Step 6: Click Run and you are there!! You will land up in the C: directory as a working directory
Just found a convenient workaround:
Package Explorer > Context Menu (for specific project) > StartExplorer > Start Shell Here
This opens the cmd line for my project.
Unless someone can provide me a better answer, I will accept my own for now.

eclipse: plugin to call Maven - Update Project

I'm trying to write a plugin to call the command that is executed when you Right click on a Maven Project and select "Maven" > "Update Project".
(This is part of a bigger plugin)
I can get command Service and from that I understand I can call ...
commandService.getCommand("org.eclipse.m2e.core.ui.command.updateProject")
To get the command, but how do I control what project it is executed on?
Can someone point me in the right direction please.
Thanks
Jeff Porter
You want to create a parameterized command from your existing command. See the Eclipse wiki for Executing a command with parameters.

Pydev; How Do I Config *all* .py To NOT Run In Ant?

Beginner config question here, guys.
So I am in eclipse, in pydev. Some of my src will run in the python compiler just fine, but others try and run in ant. When I click the 'Run' dropdown in the ones that work, and select 'Run As' I get two options. 'Python Run' and 'Python Unit-test'. When I try and run the ones that try and use Ant, I goto the same menu and it only displays '(none applicable)'
How do I fix this?
I was having the same problem. If you were,like me, trying to run code that you had written in IDLE and saved somewhere. You have to create blank project and import that code into the "src" folder of your project. then you should be able to run the code as python in eclipse.
For example. I had a bit of code I was trying out in IDLE saved in a folder in "My Docs". I moved it to my project "src" folder in "Mydocs/eclipse/projects/" and was able to run it in eclipse. Your paths will depend on where you opted to save your eclipse projects.
You should then be able to select your "Python: run option.
This was the link that helped me with this.
http://www.vogella.com/articles/Python/article.html#installation_python
Read the whole thing and it should help.

Launching run configuration outside Eclipse IDE

I have a run configuration defined for my Eclipse RCP application which is saved to a .launch file. Is there a way to use this launch configuration outside the Eclipse IDE? i.e, it would be nice to be able to launch the application from the command line for continuous integration purposes.
You can get the command line Eclipse uses:
Run your program in Eclipse
Go to the "Debug" view
Right-click on the process (probably the second item in the tree) and select "Properties"
Copy shell command and delete the agentlib flag to run in bash. Unfortunately, you need to do this whenever you change the configuration.
Yes, you could create and export a product configuration based on your launch-configuration:
Create new Product Configuration (File -> New -> Other)
Name the file (e.g. myrcp.product)
Select "Use a launch configuration" on the first page of the wizard
The product editor should open automatically. In the Exporting section you should be able to export your product using the "Eclipse Product export wizard".
Resource: Eclipse FAQ - How can I deploy my RCP app
Have a look at this PDE Build tutorial. It explains how to build and test (or run) your product using Ant.
It is possible to do that with a little workaround. You can find your configuration at workspace\.metadata\.plugins\org.eclipse.debug.core\.launches. So, open it in text editor and find an attribute containing goals, e.g. clean install -DskipTests=true.Then, go to the root of your project and execute that by the CMD:
mvn clean install -DskipTests=true
This should be similar for other goals.

Ant build consoles get clobbered by dependent projects in Eclipse

I have a set of dependent projects in Eclipse, each with its own Ant build script. If I make a change in multiple projects, then select "Build All" (Ctrl+B), each Ant build is invoked in the correct order. But if there is an error in one project, Eclipse still tries to build the other projects also, and in the process clobbers the Ant console so that the build errors are no longer visible. This wouldn't be quite so annoying if I could open up the offending project and select "Build Project", but Eclipse out-smarts me: it won't rebuild until I open some file in the project, edit it, and save (typically I add and remove a space character wherever my cursor happens to be). An answer to any of the following questions would be welcome.
How can I configure Eclipse to (in preference order):
terminate a "Build All" as soon as any project's Ant build fails?
save all console output for "Build All" instead of resetting the console for each project?
spawn a separate console for each new instance of Ant?
allow me to force a "Build Project" even if it doesn't think anything has changed?
[UPDATE] Bonus Question:
How can I configure Eclipse so that fixing any build errors in a depended-on project counts as a "change" for the purposes of "Build Project"?
Have you tried redirecting standard out to file via a run configuration? A few screen shots to help if not... (you may try 'append' this is not in my screen shot :) )
One alternative is to have each Ant build log itself, e.g., using the following in build.xml
<record name="build.log"
loglevel="verbose"
append="false" />
Oddly, Eclipse seems to disable this logging somehow when running an Ant build.
I am not too big on ant, but can't you make the builds dependent on one another?