Maven run/debug configurations in Intellij - eclipse

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.

Related

Regarding Maven

I am new to Maven and if you feel i am asking really basic question then please forgive me.
I am facing couple of problems with Maven mentioned below.
I am using Eclipse Luna 4.4.1 (Which comes with the Maven Plugin).Now i installed two plugins..out of which one is for subclipse(with SVNKit) and m2e-Subclipse which is used for integrating the maven with SVN.I downloaded the project in eclipse using svn plugin as "checkout as Maven project" and i could see the project being downloaded and now to remove all the errors related with the POM.XML i downloaded the Maven and given the local path of the Maven in the preferences > Maven > installations and changed the Global Settings and user settings files which are project specific.
1). Now even after doing all this circus i still can not see the Maven build options in my Eclipse.
2). I am not even able to clean the project from command prompt.
when i go to my project directory and type "mvn -version" which shows me the correct version of maven.
But when i try to clean it using mvn clean. it does not work.
Please help.
Regards.

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".

Is there a one step build for a GWT application or module in Intellij 11/12?

Intellij doesn't seem to have a one step way to build a war file from a GWT application. Or am I missing the option somewhere?
I would suggest to use maven for project description.
IntelliJ works very good with maven projects. You can use IntelliJ for development and maven for production-builds.
update
You can find the documentation here:
http://mojo.codehaus.org/gwt-maven-plugin/
Steps, to get the stuff running:
Install maven
Create a pom.xml
define you dependencies
call mvn install and verify you war-file (it will be created in the sub-directory "target"
call mvn idea:idea this will create a Intellj project
OR
Open Intellij, select "new project from external model -> from maven"

on save compile and deploy with maven eclipse and weblogic

I just started maven in general and m2eclipse in specific.
What I have been doing before is follow:
1)Deploy my application to tomcat.
2) make any changes to the java or jsp files.
3) save and run the application again ( no restart is neccessary unless I changed a config file).
now, everytime I make a minor change to my maven project in eclipse I have to do a "pre-clean install" to compile and deploy the application again and then restart weblogic 10 to view the changes.
Is there anyway ( or maybe I m not doing something right) that I when I modify a class or jsp file, the code will get compiled and deployed when I save the file like I was doing before with the eclipse default project builder and tomcat?
Also, When I checkout the maven project from SVN, Eclipes shows bunch of compiling errors due to some missing classes, but when I build the project using m2eclipse everything builds successfull. Why is eclipse not recognizing the classes??
I have looked at the following answer but I was not able to figure out the problem.
How do I start Maven "compile" goal on save in Eclipse?
now, everytime I make a minor change to my maven project in eclipse I have to do a "pre-clean install" to compile and deploy the application again and then restart weblogic 10 to view the changes.
You shouldn't have to do that. Are you using the Oracle Enterprise Pack for Eclipse (OEPE) (available from the market place or from an update site) and the WTP?
Is there anyway ( or maybe I m not doing something right) that I when I modify a class or jsp file, the code will get compiled and deployed when I save the file like I was doing before with the eclipse default project builder and tomcat?
See above.
Also, When I checkout the maven project from SVN, Eclipes shows bunch of compiling errors due to some missing classes, but when I build the project using m2eclipse everything builds successful. Why is eclipse not recognizing the classes??
Try the following: right-click on the project then Maven > Update Project Configuration.