Grails auto reload functionality in run-app on a custom environment - deployment

When running a custom environment with grails via grails -Dgrails.env=custom run-app it appears that the auto reload / hot deploy is turned off, does anyone know how to arbitrarily enable this for any given environment, not just dev, which appears to be the only env where it is actually on by default?

I resolved this by adding the following to my env(custom in this case) Config.groovy:
custom {
disable.auto.recompile=false
grails.gsp.enable.reload=true
}
You can also add the -reloading flag to your run config:
grails -reloading -Dgrails.env=custom run-app
Make sure it is the first arg!
Right-click your project -> Run as -> Run configurations
Blog post about auto refresh in a Grails custom env

The flag you want is "disable.auto.recompile", ex:
grails -Dgrails.env=custom -Ddisable.auto.recompile=false run-app

solve the problem with the name change of my folder containing the project ... this time a name that had spaces ... since quite the spaces everything started to work well

Related

How to disable cache-control for SAPUI5 Web IDE only?

I have set a cache-control in the neo-app.json and it's working fine on production but I want to disable on dev mode (SAP Web IDE) without opening Chrome DevTools and enabling "disable cache".
Can someone help ?
Thanks
I guess the default run configuration itself has this in URL parameter ...&sap-ui-appCacheBuster=..%2F..%2F&sap-ui-xx-componentPreload=off&sap-ui-xx-viewCache=false#Shell-home
Not sure if I understand what your problem is, but we usually define separate launch-html pages, like one index.html for production and one index-webIDE.html for launching the app from the webIDE.
You can set up the configs like this:
Right-click the project -> Run -> Run Configurations
Then define your alternate starting html page for bootstrapping the app.

Cannot disable CompactStrings Java 9 using Netbeans

I am trying to disable the CompactStrings feature of Java 9 using the VM option: -XX:-CompactStrings, but it does not work.
When I tried to debug my application, the COMPACT_STRINGS variable in String class is always true (with or without the VM option)
I have the latest version of Java 9: jdk-9+181
And the Netbeans IDE Build 201709070001
I tried various options to set the VM option and none of them works.
What I tried is:
setting the VM option in app.conf, setting it in project.properties, running netbeans by ./netbeans -XX:-CompactStrings, setting the JVM option in Project->Properties->Run->VM Options
Is this a bug in Netbeans? Or am I doing something wrong?
I tried to reproduce your problem using a trivial "Hello World" Java application. However, toggling the CompactStrings feature in the project properties settings worked fine for me, and caused COMPACT_STRINGS to be set appropriately, so this is not a bug in NetBeans.
Although I am using the same version of Java (181) as you, I have a more recent Dev Build of NetBeans (Build 201709220002), and there are several discrepancies between my project properties screen and yours. For example, mine shows the Runtime Platform field but yours does not:
Something else to check is that you really do have the environment you expect. I find it easy to mess things up when multiple versions of Java and Netbeans are installed.
This is what I see when I do Help -> About:
If your environment looks fine then I can only suggest that you download the latest DEV Build of NetBeans and try again.

WildFly 8.2, after every change in html file I need to perform full publish to see the changes, why?

After every change in HTML(XHTML) page of a web project, either it is JSF or a simple WAR I need to perform a Full Publish to see the changes. After some googling I found the solution to change in Management Console - Publishing settings to Automatically publishing when resources change and set publishing interval to 0, but it doesns't help. What can I do more to resolve this issue?
I'm using WildFly 8.2 on Mac Maverick.
Thank you in advance.
you can deploy exploded war file instead of war archive. Only make sure that folder name has .war in its name e.g myApp.war.
After that you can configure wildfly deployment-scanner to auto deploy exploded content. This can be done in your config file e.g. standalone.xml.
See https://docs.jboss.org/author/display/WFLY8/Deployment+Scanner+configuration
Config example:
<deployment-scanner scan-interval="5000" relative-to="jboss.server.base.dir" path="deployments" auto-deploy-zipped="true" auto-deploy-exploded="true"/>
Had the same problem. In standalone.xml i added the attribute
auto-deploy-exploded="true"
and the problem started. After removing the attribute it returned to the same behaviour as before.
There was a bug in JBoss 7 which was about processing this attribute not properly (or at all) but its status is resolved and it should work now. Obviously it doesn't or i am doing something wrong.
After setting auto-deploy-exploded="true" I was't able to deploy application. Deployment copies stuff in "deployment" and then scanner triggers and starts another deployment of the same app witch results in error

How to debug grails command

When I run dbm-generate-changelog exception is thrown. I would like to debug this script but I can't figure how to do it. I tried to put breakpoint to the script file _DatabaseMigrationCommon.groovy and then in eclipse created new "debug configuraion" command. When I run this none of breakpoints suspend the execution. I also tried with --debug argument.
setup:
Grails: 2.3.3
GGTS: 3.4
Eclipse: 4.3
Do the following:
launch grails with the -debug option
grails -debug run-app
create Remote Java Application debug configuration in Eclipse and set port to 5005
enjoy breakpoints and step-by-step debugging
Try to use dbm-generate-changelog -verbose -stacktrace, it could help you to find cause of fault.
I'm using GGTS tool. Open it.
Go to "Debug As" (bug icon).
Select "grails" in the list and select "new configuration" (blank paper icon).
In the next window, select your grail project in the "project field".
Write "run-app" in the grails commmand field.
click "Apply" and click "Debug".
That is.
In Grails 4, you have to use the debug-jvm argument, i.e. grails run-app -debug-jvm
Source: https://docs.grails.org/4.0.10/ref/Command%20Line/run-app.html
This doesn't answer your question as to "how to debug it", but the dbmInit target had a bug in it.
The dbmInit target depends on bootsrap and loadApp, then manually calls configureApp. This bootstraps the system twice, and some beans (quartz scheduler and grails_cache) get mad if they get recreated with the same name.
changing the top few lines to
target(dbmInit: 'General initialization, also creates a Liquibase instance') {
// depends(classpath, checkVersion, configureProxy, enableExpandoMetaClass, compile, bootstrap, loadApp)
depends(classpath, checkVersion, configureProxy, enableExpandoMetaClass, compile, bootstrapOnce)
// configureApp()
try {....
basically replacing bootstrap, ladApp, and configureApp() with a call to bootstrapOnce might clean (well, 9 years ago, so have cleaned) things up for you.

How to pass server.{host,port} to grails under Eclipse/STS

I need to set grails.server.host and grails.server.port differently on different dev machines, or in different configurations. I can set them in BuildConfig.groovy but that is source-controlled so I don't want to check in machine-specific info there. How can I pass these from the Run Configuration?
I have tried every combination of -Dserver.host and -Dgrails.server.host, with the values in quotes or not, in the Arguments tab Program Arguments and VM Arguments fields, and just server.host or grails.server.host in the Environment tab; I even tried changing the Grails tab's Grails Command field to "-Dserver.host=192.168.2.110 run-app" but grails keeps coming up "localhost:8080"
My fallback is to try and set them with an external property file, but then I have to get fancy about setting them differently for different environments and such, and I don't have easy UI visibility like I do with the Run As ... menu. So, can someone tell me how they are configuring Eclipse/STS to pass a grails parameter?
(Using Eclipse (STS 2.7.1) with grails 2.0.0M1)
-Dserver.host=192.168.2.110 -Dserver.port=8888 Should work if set in the VM arguments...
Have you tried grails -Dserver.host=192.168.2.110 -Dserver.port=8888 run-app from terminal or the command prompt?