build Grails 3 war with specific java compiler version - grails

I am using IDEA 15. I have a grails 3 project setup. The app server I need to deploy to has Java Version 7. My local JDK is Java 8. I have set some properties in my build.gradle to use the target version 1.7.
apply plugin: 'java'
compileJava {
targetCompatibility = '1.7'
}
When I rebuild my project, it generates class files for 1.7, but when I run a maven war build from the IDEA menu, the classes are rebuilt and end up being Java 8 versions. I have set Java version in my project to 1.7 as well, but this did not help. How can I get to where I am producing a war file from my grails app that contains 1.7 versioned class files?
Thanks!

What are you using to build war file? "grails war" or "gradle war". Try to use gradle.

Related

Ant sonar command not works

I am trying to insert sonarqube setup on build.xml, getting unsupported error.
My build Java version support 1.6
Ant.sonar.qube support 2.5
If I use have version 1.8 my ant sonar command is working.ant command is not working.if I use java 1.6 ant is working and ant sonar is not working.
You already know exactly what your problem is:
If I use have version 1.8 my ant sonar command is working
...
if I use java 1.6 ant is working and ant sonar is not working.
You're facing incompatibility with the version of Java you're trying to use. Since analysis will not work with 1.6, you're best off upgrading to Java 8 and working to make whatever your other Ant target is work with that.

After import of an existing project, the gradle version is less then when creating a Gradle project

When I create a new Gradle project, the Gradle version is 3.3. But when I import an existing Gradle project, the Gradle version is 2.4.11. How are the version determined, especially the last one, because as far as I can see, there is no Gradle version information in the existing Gradle project.
I don't know am I understand your issue correctly or not. But as I understood:
The version of gradle is determined in your build.gradle file.
There is a line there like below:
classpath 'com.android.tools.build:gradle: 2.2.2'
which 2.2.2 is the version.
the highest stable version till now is 2.2.3 (which it is not suitable for me) .
Note that versions above 2.2 need jdk 8 (not work with jdk 7)
I found out that you have to look at the file gradle/wrapper/gradle-wrapper.properties. The last line of this file gives the Gradle version:
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip
Before importing an existing Gradle project, maybe you want to edit this line.

Changes in inplace plugin code in grails3.x are not reloading automatically

I am upgrading a project from Grails 2.5.1 to Grails 3.1.4.
My Multi-Project Build structure in Grails 3.1.4 is as follows:
- Root
|--MainProject
|--Plugin1ForMain
|--Plugin2ForMain
|--settings.gradle
I run the MainProject using grails run-app command and whenever I change my codes in Plugin1ForMain or any other plugins, the changes are not automatically recompiled like it did in Grails2.x .
How can I make my project autocompile plugin's code in grails3.x ? I am using gradle version 2.3
I also got the same issue with grails 3.1.4 and when I changed the version of Gradle and profile web plugin it started working for me. Hope it solves your problem too.
a) Use Gradle version 2.13, change the Gradle version in gradle.properties
gradleWrapperVersion=2.13
b) And change the profile plugin version to 3.1.6 in build.gradle
profile "org.grails.profiles:web-plugin:3.1.6"

How to integrate grails 3.0.5 project in GGTS 3.6.4

I am using grails-3.0.5 cause of i want to use groovy 2.4.4.
I created project by command
>grails create-app Student
>grails clean
Fine its working and created project.
But when i executed below command then command is there.
>grails integrate-with --eclipse
Can anyone help me how to integrate with eclipse.
I don't use eclipse and don't know what kind of integration do you mean, but grails 3 is using gradle as a build tool and eclipse plugin is added automatically to the build.gradle file. You can execute ./gradlew eclipse (or on windows gradlew.bat eclipse) to generate all eclipse related files.
To clean eclipse files you can use: ./gradlew cleanEclipse.

Update Gradle in Grails project

I am using Grails 3.0.5
After I create a project... at root project has folder .gradle with 2.3 version...
How to update that Gradle version?
I tried to download Grails 3.0.9 and create a new project..but it still use Gradle 2.3 version..
I tried to download Gradle 2.6 from this link , because I am using windows... I tried to run gradlew.bat ... and recreate-app with Grails 3.0.9 version...and i still get a new project with Gradle 2.3
That's defined in gradle.properties. If you change the version there (I recommend using 2.8 for the new features and speed improvements) you can use the wrapper that's there from Gradle 2.3 to generate a new wrapper for whatever version you're updating to; just run
gradlew.bat wrapper
or
./gradlew wrapper
if you were using Linux or OSX, and it will update the gradlew and gradlew.bat scripts, and the wrapper files under gradle/wrapper.

Resources