ScalaTest option not available under "Run As" Menu in Scala IDE - eclipse

I have recently switched computers and am trying to get ScalaTest to run in my ScalaIDE again.
When I right click on the file in the project explorer, or when I right click on the code in the editor, I can see the "Run As" option in the drop down menu, but the only option available is "Run Configurations."
I can create my own run configuration manually, and run the test just fine, and then have a run configuration that I can run from the Run icon in the toolbar, but I don't what to have to create one of these for each tests.
Here is what I have so far, and would be grateful if anybody could provide any additional ideas:
Verified that ScalaTest library is being added to the project via SBT.
Verified that the Plugin is indeed installed (and re-installed multiple times)
Verified that I can run the tests from command line, in addition to my manually configuration in Eclipse.
Ran eclipse with -clean command
Tried running eclipse as root, and re-installing plugin while running as root.
Tried giving all access to all directories in Eclipse.app directory
Compared my setup to a co-worker who also recently set up his computer with the same image, and should have very similar versions of Scala, ScalaIDE, and ScalaTest plugin.
Created a new workspace and reimported my projects into that workspace.
cleared ivy cache and rebuild eclipse project.
My system:
OSX: Yosemite 10.10.5
Scala: 2.11.6
JRE: 1.8.0
ScalaIDE: 4.1.1-vfinal-20150727-1320-Typesafe
ScalaTest Plugin: 2.9.3.v-4-2_11-201509031342-a29ebef

This morning there was an updated ScalaTest Plugin:
2.9.3.v-4-2_11-201509221346-a29ebef
After updating, everything works fine!
I'll leave this here, as I'm thinking that the steps I took in my question seem to encompass most of the recommended steps that I have seen from various other StackOverflow errors.

Related

Eclipse 2019-03 failing to run certain JUnit 4 tests from the Window but not Test suites or run configuration

I have installed Eclipse 2019-03 from both the installer and tar ball. Certain JUnit test will run from a "run as" selection in the window and others will not. The ones that will not run will run:
Test suite that includes the test class
Run -> run configurations
You can also run it from the JUnit view either from a test suite or run it again.
I have tried deleting then adding the code back in then which seems to work but then fails again in future.
I have tried re-installing eclipse and then adding the src and pom to the maven project and the issue is still there.
Any suggestions?
2019-06-28:
It seems there are also issues with this version of eclipse finding the main method in my Main class. Although removing or changing the code did resolve the issue there were a number of other issues croping up. I tried again to resolve this using both a new "run configuration" and run "Java Application". Both fail to find the class. This is a very simple Java 11 maven projet and I do not see why it is having these issues.
At this point I am going to roll back to a previous version of eclipse to see if it is having similar issues with this code.
2019-06-28 NEW:
Rolling back to photon resolved the issues with both running the code and the junit issues.
Version: Photon Release (4.8.0)
Build id: 20180619-1200

How to use SBT with Intellij Idea

I am using Scala version 2.10 and SBT version 0.13.8. To build a project I am currently executing the sbt commands through the Intellij terminal but I would like to know the use of SBT Tasks window on the right hand side of intellij idea window. Kindly have a look at the screenshot uploaded
How can I run SBT tasks (compile, run, package) in Intellij from SBT Tasks? Is my intellij configuration correct?
It looks like you're using an older version of IntelliJ IDEA. That the window displays "tasks" is probably a bug, because running tasks from this window is currently not supported by the Scala Plugin. I still recommend upgrading IDEA to version 2016.3, which also supports a newer version of the plugin.
Instead, you can run them from the terminal as you do now, or create a run configuration clicking on Run -> Edit Configurations. Then click the + button to add a new configuration and choose SBT Task from the list, and entering the tasks you would like to run.
Side note: When using sbt for your projects, the Scala version installed on the system doesn't matter. In fact, it doesn't even need to be installed.

Maven run/debug configurations in Intellij

I have been using eclipse for some long time. I have previously decided to switch to intellij. There is however a feature in eclipse that I miss. When using maven, I used to have a maven clean install run config saved under my run configs. And have the base directory as ${project_loc}.
Thus when i select the project from the project explorer, I can run the maven config on it. I have found in intellij the create/run configuration dialog which has the working directory field.
My question is how can i configure this field to get the same effect as eclipse's ${project_loc} variable?
That is something Maven Helper plugin solves. It runs goals for the selected module.

Grails / Groovy / GGTS: Conflicting module versions on run-app

After upgrading a Grails application from 2.2.0 to 2.2.1 I keep getting the following error when attempting to debug a Grails application from GGTS via Debug as... -> Grails Command (run-app):
Error starting Grails: nulljava.lang.ExceptionInInitializerError
at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:62)
at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:32)
at groovy.lang.Closure.<init>(Closure.java:221)
at groovy.lang.Closure.<init>(Closure.java:238)
at groovy.lang.Closure$1.<init>(Closure.java:205)
at groovy.lang.Closure.<clinit>(Closure.java:205)
at org.codehaus.groovy.grails.cli.GrailsScriptRunner.<clinit>(GrailsScriptRunner.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1243)
at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
Caused by: groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-all is loaded in version 2.0.5 and you are trying to load version 2.0.7
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerExtensionModuleFromProperties(MetaClassRegistryImpl.java:186)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerExtensionModuleFromMetaInf(MetaClassRegistryImpl.java:174)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerClasspathModules(MetaClassRegistryImpl.java:156)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:111)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:73)
at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:33)
... 14 more
I'm running GGTS 3.1.0.RELEASE with the Groovy Compiler 2.0 Feature 2.7.1.xx-20120921-2000-e42RELEASE and Groovy/Grails Tool Suite 3.1.0.201210061306-RELEASE-e42. The project has configured Groovy Compiler level 2.0. Eclipse Preferences say "You are currently using Groovy Compiler version 2.0.4.xx-20120921-2000-e42RELEASE".
Any hints?
i had this problem on Grails 2.2.0 on Ubuntu machine , i fixed it with the below steps :
open eclipse go to "Run as" the "Run Configurations"
choose "Environment" tab , then choose "replace native environment with specified environment "
that solved the problem for me .. hope this help
I had the same problem, I was picking up groovy-all 2.0.7 from GGTS and 2.0.8 from my grails project. To resolve the problem I removed the "Groovy Dependencies" library from the eclipse project.
Right click on project -> Properties -> Java Build Path -> Libraries (tab) -> Groovy Dependencies -> Remove
Manually delete the run-app Run Configuration so it gets recreated. This was reported as a bug on Aug. 1st, 2013. Bug report: https://issuetracker.springsource.com/browse/STS-3501
I deleted .metadata in GGTS workspace and reimport project. It works, I can run-app again.
I had the same exception, when I was trying to run JUnit tests on my Spring boot project in Eclipse only, mvn executes them fine. I'm not using Gradle or Groovy. Indeed checking the test's class path upon debug, showed two versions of groovy.jar. The work version of the groovy.jar was picked from other projects in the Eclipse workspace. I was able to fix it by removing Resolve dependencies from Workspace projects in project properties -> Maven
I had the same problem and i solved it by:
For your project: Open Run As->Run Configurations
Go to the Refresh tab
Check the Refresh resources upon completion
Press Run
That did the trick for me.
I solved it by removing the option to manually load the classpath in Run Configuration. It was using the wrong Grails version (2.5.0 instead of 2.5.1).
Basically the wrong classpath was used.
Maybe this brings someone on the correct path :)
I have no explanation why it didn't work, but I found a workaround.
I had another run target configured for the same app, but with a -Dgrails.env=... setting, which I could launch without problems. I simply copied this config and removed the parameter. That way, I basically recreated the simple launch config which previously kept failing.
Problem gone.
For me a compile from the grails command window did the trick
I had the same problem when running it through eclipse and what worked for me is to make the below changes
Go to Project properties -> Groovy Compiler ->configure workspace settings . Uncheck the checkbox "Enable checking for mismatch between project and workspace groovy compiler levels"
Another solution worked for me when Eclipse stopped being able to run my project with the "groovy-all is loaded in version ... and you are trying to load version" error.
Manually removing a groovy-all line from the .classpath fixed it.
<classpathentry kind="lib" path="Libraries/groovy-all-2.1.2.jar"/>
I found the solution in this blog post.
I had the same problem, I went to Project properties -> Groovy Compiler ->configure workspace settings and I clicked on the "Switch to" button that corresponded to one of the two versions in the error message.
I hope this will help
I know this is a GGTS question, but Google led me here and this seems to be a common issue even after several years so I'm posting this answer here. Hopefully it can help other STS users who also land here.
I had this problem with Spring Tool Suite, using Spring Boot Version 1.3.3.RELEASE and gradle version 2.14. There is some internal dependency on groovy 2.4.6 and groovy-all 2.4.6, but my Eclipse workspace Groovy Libraries are version 2.4.7. Removing the Groovy Libraries from the Spring/Gradle project properties(s) works for running those projects, but for other Groovy projects in the workspace you are stuck between a rock and a hard place. They will either run if you click yes when "Errors exist in project. Run anyway?" if you remove the Groovy libs from the properties build path, or they will not have project errors if you put the Groovy libs in the properties build path.
Resolved by adding explicit dependencies in build.gradle on groovy 2.4.7 and groovy-all 2.4.7 for Gradle projects in the workspace
compile('org.codehaus.groovy:groovy:2.4.7')
compile('org.codehaus.groovy:groovy-all:2.4.7')
and (close Eclipse STS) then removing the 2.4.6 folder(s) from the .gradle cache
<path to>\.gradle\caches\modules-2\files-2.1\org.codehaus.groovy\groovy\2.4.6
<path to>\.gradle\caches\modules-2\files-2.1\org.codehaus.groovy\groovy-all\2.4.6
and (Open STS) then right-click gradle project(s)>gradle>refresh gradle project
Now other Groovy projects in the workspace run without the 2.4.6 vs 2.4.7 conflict.
use mvn denpendency:tree to check your dependencies, maybe there exist version conflicts.
When I change the grails project's name it works correctly.
Currently (using Eclipse 2020-06, 4.16.0) none of the above solutions work any more.
Open the Run Configuration of your groovy script
Remove all User Entries from the Classpath tab
Press "Restore Default Entries"
This should add the default classpath containing your specified Groovy version as User Entry.

Eclipse running lift project (project configuration issues)

Trying to get a lift project to run on windows, I've installed maven on my computer, then tried to use
mvn archetype:generate from cmd, then chose the lift basic one , but it always failed on the jetty:run part. Before that, I had to change a lot of the pom.xml file to even get a successful build (since the tutorial I was using was obsolete and it couldn't find the dependencies).
So I've decided to try with the eclipse plugin, thinking it should be easier.
I've installed the maven plugin for eclipse and created a project with the lift archetype.
The project was succesfully created, but I have all kinds of errors in the editor for missing ; and so on (I have scala ide installed on eclipse also and creating a normal scala project works and compiles/runs fine). I have also tried to include the scala-library.jar in the buildpath, with no change.
The odd part is that I can run the cmd and go to the project folder, then run mvn jetty:run and it will actually work (?!) Trying to run in eclipse with jetty:run as goal will give me ClassNotFoundException on the HelloWorld snippet.
So what might be wrong with my settings?
UPDATE: no luck whatsoever, after trying 3 different eclipse versions, installing the maven for scala plugin and following every tutorial I could find. It just simply feels all is outdated on the instructions:
this is how it looks after I include the scala libraries for eclipse on every project (after I create it from an archetype):
is this "mvn archetype:generate" up to date? I don't know if anybody guarantees it will work at all..
Anyway, the default way to at least try Lift and see it working is the following: https://github.com/lift/lift_25_sbt
It uses "Simple Build Tool" instead of maven, but maven should work, too. Also, you can easily read "build.sbt" to get all the dependencies.
Plugins for creating eclipse/intellij project definitions are included. (See the README of the demo project.)
The target to create eclipse project is "eclipse" or "eclipse with-sources=true".
The target to launch the app is "container:start".