eclipse new gradle project hold on task init - eclipse

I am using gradle 5.2, eclipse 2018-12, buildship 3.0.
I specify the gradle local installation in eclipse config.
However when I try to create a new gradle project, it always hold on task:init,
there is no gradle project is created.
Like above screenshot shows, it always say " task:init ", what is my problem?

It would be good to try on creating this project from a command line, just to see if there is some output generated on console. I don't know what project you need specifically, but try for example:
gradle init --type java-application
Then we could see it problem occurs. If not, then it's an issue with your Eclipse setup.

After I update the buildship from 3.0.0 to 3.0.1, now I can create success!

I just had the same issue.
I happened to also have the Gradle console open in Eclipse and I can see that there is a prompt for Groovy/Kotlin being presented.
Eclipse: 18.12, Gradle: 5.4.1, Buildship: 3.0.0.v20181106-1441-m
Using Eclipse to update from the "Latest Eclipse Release" software site to Eclipse 19.3 with Buildship 3.1 and it worked perfectly.

Related

Which gradle plugin do I install on eclipse?

I'm trying to follow a simple tutorial with an API called Twilio (https://www.twilio.com/docs/quickstart/java/sms#overview) and to do that I need to start a gradle project in eclipse.
My eclipse isn't working on my linux partition so I am starting from scratch in a virtual machine.
I tried to install the gradle plugin in eclipse using the source URL http://dist.springsource.com/release/TOOLS/update/e4.4 but I'm not sure which modules to include and which not to.
I tried installing "Gradle IDE" and "Eclipse Platform" but it does not give the option to create a new gradle project, only "Gradle (STS) Project" which when selected does not look the same as in the tutorial.
Can someone explain what I need to do? My eclipse version is 3.8.1
edit: This is what it looks like right now
I am on Eclipse Mars version and the best way to install Gradle or any external plugin is from Eclipse Marketplace.
Navigation : Help -> Eclipse Marketplace... (the last sub-menu)
There you can search for 'gradle' and install Buildship gradle integration 2.0. After install eclipse will ask for restart and plugin gets installed successfully. You can import gradle project into eclipse afterwards.
Hope this helps.

Building a groovy project in eclipse

I have imported a groovy project in my eclipse and I have installed the groovy plugins in my eclipse too. now, I want to build my project(which is a groovy-gradle plugin) in eclipse and use it further. I have gone through a link http://www.selikoff.net/2013/01/11/creating-a-groovy-project-with-gradle-in-eclipse/ but I don't understand how to build my project. I don't get build option.
Install the gradle plugins.
Some tasks will be available in the tasks Window.
Right click on build task and run it.

Is there a Gradle plugin for Eclipse Luna?

I'm trying to integrate Eclipse Luna with Gradle.
Eclipse Integration Gradle GitHub page includes instructions for Installing Gradle Tooling from update site.
I followed the instructions for the release (stable) version.
After I selected all the components (as shown below) I proceeded with installation.
It didn't go as expected and brought me to the Install Remediation Page (below) that showed that only Gradle IDE component could be installed. ( Click here for larger image).
At this point I'm not sure what caused the problem and what to do about.
The plugin you are using is wrong. There is an update for Luna here.
You can alternatively install the plugin directly within eclipse with this integration link.
Gradleware now offers direct support for the Eclipse IDE. See http://www.vogella.com/tutorials/EclipseGradle/article.html for an introduction.
In addition to plugin memtioned by #Campiador. You must have supported project nature in your eclipse's .project file in order for your project to show up in "Gradle Tasks" view.
See following example:
Add one or more natures in build.gradle file:
eclipse.project {
natures 'org.springsource.ide.eclipse.gradle.core.nature', 'org.eclipse.jdt.core.javanature'
}
After this change, just run gradle eclipse command from your shell/command prompt. Newly generated .project will have proper natures in it. Just refresh your project in eclipse and now you will see your project in Gradle Tasks view.

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.

Any way to control the version of Java Spring STS Gradle plug-in uses?

I am using the STS Gradle plugin in Eclipse (Indigo). I am running on MacOSX. Eclipse is running Java 1.6, but I have Java 1.7 installed as the default JRE and all my eclipse projects use it without error.
I am trying to get "gradle jettyRun" to work within Eclipse. It runs perfectly from the command line. However, when I right click on my web project and say "Run As"->Gradle Build... then select jettyRun from the dialog box, I get this error message:
invalid source release: 1.7
Does anyone know if there is anyway to fix this?
[Don't think it matters, but I am running Gradle 1.1]
As this issue suggests, provided you're using above version 3.0.0.M1 of the STS plugin, there should be a Gradle preference page where you can select the JVM installation to use.
Not sure for earlier versions of STS plugin. You can try setting the JAVA_HOME variable before launching your Eclipse. Might help.