Grails x86/x64? - grails

I was planning to use Eclipse Juno instead of GGTS/STS provided by SpringSource. I have installed on my Eclipse the plug-in for the GGTS support. I also have downloaded the newest version of Grails that is version 2.3.3. All is well, but when I create a Grails project on my Eclipse IDE this error always occurs on the Console View.
General error during semantic analysis: unable to locate the java compiler com.sun.tools.javac.Main, please change your classloader settings
java.lang.ClassNotFoundException: unable to locate the java compiler com.sun.tools.javac.Main, please change your classloader settings
I don't see any problems when I type java on my command prompt. I am currently using Windows 7 x64 with a JavaSE 6/7 both on x64. Is it possible the cause of this problem is that Grails needs to have a jre6+ under x86 platform?

Related

unable to locate the java compiler com.sun.tools.javac.Main, please change your classloader settings

The following error is occurring while compiling my grails application. I'm using jdk-7u79-windows-x64, I already added the location 'C:\Program Files\Java\jdk1.7.0_79\bin' to my path in Environment Variables. But still the probem exist. My OS is windows 10 (64 bit) and I'm using ggts-3.6.4 (64 bit)
Could anyone tell me why this is happening?
.Error
|
Compilation error: startup failed:
General error during semantic analysis: unable to locate the java compiler com.sun.tools.javac.Main, please change your classloader settings
java.lang.ClassNotFoundException: unable to locate the java compiler com.sun.tools.javac.Main, please change your classloader settings
at org.codehaus.groovy.tools.javac.JavacJavaCompiler.findJavac(JavacJavaCompiler.java:190)
at org.codehaus.groovy.tools.javac.JavacJavaCompiler.compile(JavacJavaCompiler.java:49)
at org.codehaus.groovy.tools.javac.JavaAwareCompilationUnit.gotoPhase(JavaAwareCompilationUnit.java:102)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:548)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:517)
at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:59)
at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:215)
at org.codehaus.groovy.ant.Groovyc.runCompiler(Groovyc.java:1161)
at org.codehaus.groovy.ant.Groovyc.compile(Groovyc.java:1212)
The Groovy-Grails Tool Suite is no longer supported software. I recommend using IntelliJ IDEA instead. See my answer to this question for more details: https://stackoverflow.com/a/38938933/2970843.
First make sure that you have set the path correctly(I had some problems with that).
Also use the java -version command in cmd to see if you are using the same jdk you've set or not
I had set the JAVA_HOME correctly but I had 2 other versions of jdk and the newest was shown as java version,so I deleted them and my problem was solved,hope this workes for you

IntelliJ 15 and Grails 3: unable to find grails packages

I'm converting a grails 2 plugin to grails 3, using IntelliJ 15.0 Community Edition. For Java files only, IntelliJ gives me many errors about missing packages and symbols from Grails. For example:
Error:(20, 19) java: package grails.core does not exist
and
Error:(23, 41) java: cannot find symbol
symbol: class AbstractGrailsClass
I have tried adding dependencies in Project Structure so as to point to the grails sources, but that didn't seem to have any effect. I admit I am a novice when it comes to IntelliJ, so this may be a simple config setting.
In IntelliJ's preferences set up a Grails SDK Home. Open Preferences then type Grails to bring up the page. Then set it to point to your Grails installation e.g.
/Users/whoever/.sdkman/candidates/grails/current
One thing to consider is that Grails 3 requires moving .java files from src/main/java to src/main/groovy
This may be related to why you are experiencing problems.

Grails Project not shown in NetBeans project window

I create a new Grails project from NetBeans but when I complete the project complition wizard, nothing to show in my NetBeans project window. My details configuration is:
NetBeans 8.0.2, JDK 8 64bit, Grails 3.0.1
I check my environment veriable setting for Java & Grails also. Everything seems ok, and one important thing is in command line when I type grails -version, it shows the version name and so on. I uninstall NetBeans, JDK, & Grails several times but same problem, I also try it for JDK 1.7 32 bit, no result. I'm used to with NetBeans, so I don't try to other IDE.
Maybe look where the project is defined on disk and open it into NetBeans.
I dont know how this case was solved, but to me it looks like the problem is still valid:
The New Project wizard (Groovy -> Grails Application) calls "grails create-app" but does not generate the nbproject directory.
My environment is:
NetBeans: 8.0.2; Grails Version: 3.0.4; Groovy Version: 2.4.4; JVM Version: 1.7.0_79
Netbeans 8.0.* does not have support for Grails 3.* projects. It can create project but cannot recognize and open the project since the project structure has been dramatically changed from Grails 2.* to 3.*. There was a task created to resolve this problem. Now it reads VERIFIED FIXED for version 8.1. So please upgrade to Netbeans 8.1.* in order to be able to handle Grails 3.* projects in Netbeans.

Grails GGTS "Task 'assemble' not found in root project" error when running "grails war" in Command Prompt

I have been learning Groovy/Grails Tool Suite (GGTS) 3.6.4, with Grails 2.4.4 using some video tutorials. When I attempt to package the project into an application using the grails war command on the Windows command prompt, I get the following error:
"Error Gradle build terminated with error: Task 'assemble' not found in root project ..."
Any references to this error that I have found online have only involved Android Studio (for instance), so I am at a loss here as to how to fix it for GGTS.
I have Android Studio 1.0.1 installed, and in case it was affecting the Grails packaging, I tried the solution of removing the <component name="FacetManager"> from the general Android Studio "MyApplication.iml" file, but that had no effect. I couldn't find any analogous file for the GGTS.
In case the issue lies elsewhere in my overall installation, I have Java JRE 7_79 (64-bit) installed, as well as the the JDK 1.7.0_79 (64-bit)
OK. I found out what the cause of the error was, and how to avoid it in the future.
The Problem
Grails 3.0.1 requires the following files for grails war to work:
build.gradle
gradle.properties
gradlew
gradlew.bat
\gradle (directory)
Grails 2.4.4 does not require any of the above files for making a WAR file.
GGTS 3.6.4 does not work with Grails 3.0.1, but it comes with and works fine with Grails 2.4.4.
The Solution
Copying the stated Gradle files & directory to a GGTS project folder fixed the problem. However, I wasn't satisfied with needing to do this manually or with a custom batch file for every project.
Looking deeper, it turns out that when working out compatibility issues between the Java 32-bit JRE existing on my system and the Java 64-bit JRE & SDK, Grails, and GGTS versions (there was a lot of fiddling to get things working), at one point I had set up my global variable to Grails to be directed at 3.0.1, and I failed to update it to Grails 2.4.4. Making this change has fixed the issue.
Explaining the Cause
When following this video series on installing a compatible set of Java, Grails, and GGTS, the instructor manually downloaded the latest version of Grails from the Grails site and then downloaded GGTS separately from its own site. Both of these were older versions than what I was working with.
In my case it turns out that, after setting up the Java SDK & Grails, the latest version of GGTS (3.6.4) did not work properly with the latest version of Grails (3.0.1). Fortunately the GGTS bundle came with an older version of Grails (2.4.4), and by referencing that, GGTS would work correctly. However, although I changed the IDE reference to Grails, I forgot to reset my environment variable ...
So GGTS was setting up the project for using Grails 2.4.4. However, when calling grails war, the command was using Grails 3.0.1! Apparently these two versions of Grails use different files for creating a WAR file, so GGTS was not setting up the project directories with the correct local files, and the packaging was failing.
Avoiding Future Occurrences
So, when using GGTS 3.6.4, make sure that all references to Grails point to Grails 2.4.4.
In general, if any GGTS bundle contains a version of Grails, you should have everything set up to use that version, even if it is old.

Grails, GGTS Setup

I need to setup a Windows working environment for Grails. I'd like to use GGTS as an IDE but got several errors compiling a sample project. Currently I'm using jdk1.8.0_40 and Grails 2.5.0. which results in this error (but in the end the project is working):
Groovy:Unexpected problem with AST transform: The Spock compiler
plugin cannot execute because Spock 1.0.0-groovy-2.4 is not compatible
with Groovy 2.3.10. For more information, see http://versioninfo.spockframework.org
On top of that there are two Java Exception Breakpoints which are listed as "unknown". Only info regarding version support I could find is:
Java SDK 1.5+ for Grails 1.2 or greater
GGTS itself seems not to run with the latest grails (3.0.1) since I simply cannot add it (directory appears not to be a grails installation).
Should I use Java 7 instead?
This issue is not related to JDK 1.8 or 1.7, but its is related to the GGTS IDE 3.6.4 Groovy Compiler version. As the error clarifies that Spock 1.0.0 version needs Groovy 2.4 compiler.
GGTS 3.6.4.RELEASE-e4.4.2 IDE comes with Groovy 2.3.10 compiler by Default.
Install Groovy Compiler 2.4 Feature and "switch to 2.4" will resolve this issue.
Refer: http://docs.codehaus.org/display/GROOVY/Compiler+Switching+within+Groovy-Eclipse
If you cannot switch compilers from the IDE Groovy Compiler preference page, follow the instructions to perform the switch from outside of Eclipse:
(Grails 2.5.0 uses Spock 1.0.0 (and internally Groovy 2.4.3 and this is why your project is compiling & working fine as the Grails runtime environment is taking over)
As an additional experience report to the answer above, thus providing another solution variant: I had to use the http://dist.springsource.org/snapshot/GRECLIPSE/e4.4 update site (as opposed to the release version mentioned in the link above) to make the 2.4 compiler feature available in the update manager.
After installation, the compiler errors are gone.
I noticed that project-specific groovy compiler is set in the Groovy Compiler preference page in new grails projects. By selecting "I don't care" for "Groovy compiler" it will default to the workspace groovy compiler which is usually correct (for me it's version 2.4). This worked for me but experience may vary.

Resources