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?
Related
We provided an application installed with install4j, with bundled JRE, to one of our customers. This customer needs some proxy settings configured manually for this application.
I tried to put deployment.config file in the JRE's lib directory but it didn't seem to change anything. I couldn't find a relevant vmoptions either.
Is there a way to pass these settings to the app/jre?
Is there also a way to instruct the JRE to open the Java console when it runs?
Thanks!
/Shmulik.
You can configure the proxy by setting the VM parameters
proxySet=true
proxyHost=...
proxyPort=...
and for authentication
proxyAuth=true
proxyAuthUser=...
proxyAuthPassword=...
You can set them either in a "Run script" in the startup node of the installer action by calling System.setProperty() for the properties or by passing them on the command line like this:
-DproxySet=true -DproxyHost=... etc
As for your second question (better to ask a separate question on stackoverflow)
Is there also a way to instruct the JRE to open the Java console when it runs?
I assume you mean a terminal window, which can be done by selecting the "Windows console executable" property of the installer. You cannot change this property on the command line because this sets a static flag in the binary format of the Windows executable furing compilation.
I created an installer for WINDOWS as well as for MAC. The
application is using an embedded JRE. While the application runs, it's not
able to detect the proxy settings of the network even the option in
the browser is set to be "Auto Detect". But when the proxy settings provided explicitly in the browser, it's able to detect the proxy settings.
Even the proxy settings are not detected when "LAN Settings->Use automatic configuration script" option is selected and points to the .pac file.
Any suggestion, how to provide the proxy settings with BUNDLED JRE and java program can detect those settings without make any further changes in each machine.
Using PyDev with Eclipse Juno, I need to set some environment variables to debug every single of the many scripts in my project. I have found how to set them for a given script but it would be totally impractical to do it for all of them. The only solution I have found consists in adding those variable to the Python interpreter configuration in the Preferences. But then it will be used by all projects, which I don't want.
I thought of creating a script setting those environment variables and then launching Python, and then add it as a new Python interpreter but PyDev does not accept two interpreters with the same actual exe (I guess it checks sys.executable).
The recommended approach is really setting it at the Python interpreter level.
You can use virtualenv ( http://pypi.python.org/pypi/virtualenv ) to create a copy of your interpreter in a different path.
Just to elaborate that #FabioZadrozny's answer meets the need of the OP...
In case it hasn't occurred to you, do this:
From the menu "Window->Preference"
Navigate to "PyDev->Interpreters->Python Interpreter"
Create a new interpreter instance with "New..." button
Name it something like "python-MyProj", but use the same executable you are already using
Now in the "Environment" tab for that interpreter, set up the needed environment variable
Now, see the PyDev project to use THAT interpreter:
Right-click the project to get "Properties..."
Navigate to "PyDev-Interpreter/Grammar"
Select the newly created interpreter instance by name
Now run any python file within the project, and it should "see" the configured environment variable.
By this mechanism, you do have a "project specific setting"... which, again, for the reasons #FabioZadrozny pointed out, need to be set at the interpreter level.
Setting up environment variables for hundreds of tests get old very quick. Is there a way to declare an environmental variable globally in Eclipse?
Can this be done in Eclipse? Can this be done outside of Eclipse?
It seems that the only way to do it is to enable "Run all tests in the selected project .." and set Environment variables once there.
If you want to run a single test, and that test requires an environment variable set, it looks like you need to set that environment variable as part of that tests's settings.
In windows use the "start" command to spawn eclipse from command line with defined variables (linux has similar functionality)
Make file starteclipse.cmd
================================
SET VAR1=SOMEVALUE
SET VAR2=SOMEVALUE
start d:\eclipse\eclipse.exe
================================
From command line go to the dir with starteclipse.cmd file and run it.
This will spawn eclipse with proper environment settings.
I also find it frustrating having to set env vars one by one.
If you own the code and have a chance to change it, you'd be better off using a System property instead, which can be passed as VMArgs -Dprop=val.
You can set VM args in a global level - Preferences | Java | Installed JREs, and Plugin Development | Target platform.
Even if you can't change the code, most well civilised java libs support properties as well if not more than env vars- so it's worth double checking.
(of course it's not an option for external processes).
I am trying to create an eclipse runtime tool to diff 2 files. For my specific instance the files have the same name but are comparing versions.
I created a runtime external tool configuration using p4merge using these arguments:
gen\${string_prompt:File Name} gen2\${string_prompt:File Name}
What I really want is 1 dialog box where I can use the variable 2ce.
Anyone know if this is possible directly in eclipse other than writing a batch or shell script?
In the "External Tools Configurations" window, on the "Environment" tab, create a new environment variable. Set it's name to tmp_StrInput or something similar and it's value to "${string_prompt:Hint:DefaultText}".
Then, in your arguments (or anywhere else) on the "Main" tab, use ${env_var:tmp_StrInput} every time you want to insert the result from the string_prompt dialog.
The prompt appears and sets the environmental variable before the tool is run, the only negative side-effect is that you have created an extra environment variable. It does seem a bit like a work around but it works well!
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