Command-line properties file reference overriding mule-app.xml - mule

I have placed variables in a few .properties files and have successfully created a mule.env variable in mule's mule-app.properties file to reference which of those files to use. I am trying to allow a command-line argument override the mule.env variable so that a specified properties file can be used. I also like having the mule.env variable exist in mule-app.properties file as a default value in case nothing is set via the command-line. But it seems that the existing mule-app.properties file overrides the command-line argument.
The mule-app.parameters file contains a variable like this:
mule.env=dev
While a command-line argument looks like this:
-Dmule.env=prod
A property placeholder looks for the properties file like so:
<context:property-placeholder location="classpath:${mule.env}.properties" />
The result that I prefer is that the property placeholder finds the prod.properties file rather than the dev.properties file when the mule app starts with the command line argument; however, it still uses the dev.properties file.
If I remove the variable from the mule-app.properties file, the command-line argument works fine.
I prefer that the command-line overrides the what is in the mule-app.properties file. Is that possible? What have I done incorrectly?

For this purpose You have to set the property in the Mule wrapper.conf:
Navigate to [Mule standalone]/conf folder.
Open wrapper.conf in a any text editor.
Add the following script under # GC settings: wrapper.java.additional.15=-­Denv=prod
Notes: make sure the number is correct. In this example the last number in that file is: wrapper.java.additional.14

Related

Can we pass a command line argument to property file reader in jmeter

I have a config.property file that contains all the property values to be used in jmeter, so i am using property file reader plugin to read the property file, here the problem is i don't want to hard code the path to config.properties file in property file reader so i want it to pass as command line argument but it is not working
command i am executing is
.\jmeter -JPROPERTY_FILE=<file_location> -n -t <path_to_jmx> -l <path_to_jtl> -j <path_to_log>
In the File Path of Property File Reader, replace:
${PROPERTY_FILE}
By using __P function:
${__P(PROPERTY_FILE)}
Your mistake is that you’re using Variable syntax for a property.
See:
http://jmeter.apache.org/usermanual/functions.html#__P
http://jmeter.apache.org/usermanual/functions.html#functions
You should be using __P() function like ${__P(PROPERTY_FILE)} or even __property() function like ${__property(PROPERTY_FILE,PROPERTY_FILE)}. The latter one automatically stores the retrieved value into a JMeter Variable so you won't have to additionally declare it under User Defined Variables of the Test Plan
Instead of using custom plugins I would suggest going for built-in JMeter functionality, there is -q command-line argument which allows loading and arbitrary .properties file so you will not have to install the plugin, care about order of Configuration Elements, etc.

IntelliJ - File watchers: wrong output of macros

I am trying to setup a file watcher for scss files which is working on files with a filename not starting with _.
But if I have a file named _file_name.scss the output of any macros that include the filename will be file.name.scss.
The first _ is removed and following ones are replaced by ..
Even though in the insert macros selection tool I can see that the output when you select a macro is correct.
Like $FilePathRelativeToProjectRoot$ will display mypath/_file_name.scss in the selection tool but then my command from this file watcher will output mypath/file.name.scss.
Am I missing a parameter here ?
Full configuration:
For me, existing file names are not changed when using similar file watcher. But files with names starting the _ are not prettified, the main .scss that includes them is processed instead.
To avoid this, try adding COMPILE_PARTIAL=true variable to your file watcher settings:
Also, make sure that Track only root files is off.
See the comments in https://youtrack.jetbrains.com/issue/WEB-13459

Current file path in Live Template

Is it possible to get the full path of the current file within a live template in IntelliJ? I've tried using groovyScript("new File('.').absolutePath") function, but that returns /Applications/IntelliJ IDEA.app/Contents/bin/. and not the file path as I was hoping for.
Thanks!
According to the docs (emphasis mine):
You can use groovyScript macro with multiple arguments. The first argument is a script text that is executed or a path to the file that contains a script. The next arguments are bound to _1, _2, _3, ..._n variables that are available inside your script. Also, _editor variable is available inside the script. This variable is bound to the current editor.
The _editor is an instance of EditorImpl which holds a reference to the VirtualFile that represents the currently opened file.
Therefore, the following script gets the full path of currently opened file.
groovyScript("_editor.getVirtualFile().getPath()")
Or if you want to get the path relative to the project's root:
groovyScript("_editor.getVirtualFile().getPath().replace(_editor.getProject().getBaseDir().getPath(), \"\")")
Since IntelliJ IDEA 2019.3 the Live Template macros filePath() and fileRelativePath() are available. A complicated Groovy script macro is no longer required.

Using a variable in a batch script for SQLLDR

Hi i am trying to set a variable in my .bat file and i want to use the variable in sqlldr code to state the file (infile)
This is what i have in my bat file for the variable:
set directroy_name= D:\Folder\Folder\Folder\File.csv
Then in my command file i have
load data
infile '%directory_name%'
When ever i try to run the .bat file from the command prompt i just receive the SQL_Loader_500: unable to ope file (%directory_name%.dat
I know the files in the correct location?
any ideas why its doing this?
No, you can't do that - you're expecting the Oracle executable to understand Windows environment variable syntax. If it did that it would have to deal with $ variables in Unix, etc.
You can just pass the file name on the command line instead. In your control file omit the INFILE altogether, then when you call SQL*Loader add a a DATA command-line argument:
sqlldr user/password CONTROL=your.ctl DATA=%directory_name% ...
Assuming your variable is just oddly named and does have a full file path as you've shown.
If it's present, the INFILE argument will be overridden by the command-line argument, so you could include a default fixed value if you wanted to, I suppose.
You also appear to have a typo; you set directroy_name, but then use directory_name, which will have no value. You need to change that to:
set directory_name= D:\Folder\Folder\Folder\File.csv

msbuild -p:outputdir=c:\mydir being ignored

I'm running msbuild from the command line with the following:
msbuild mysolution.sln -p:outputdir=c:\mydir
When I run this, the outputdir is being ignored and the default specified in the csproj file is being used.
The MSDN doc for this tool says that I should be able to override the build directory using this parameter. What am I doing wrong?
You should use OutputPath and more important you should use the right syntax :
msbuild mysolution.sln /p:OutputPath=c:\mydir
Note that OutputPath is preferred over OutDir. The documentation used to be wrong about this, but I see that they've finally fixed it.
Beyond that, it's difficult to say exactly what the problem is, since you didn't show the exact path that you're passing as a parameter. There are two possible problems that I can imagine:
The OutputPath option specifies the path to the output directory relative to the project directory. That means you can't set it to a global path like C:\mydir. I assume it is unable to find the path you specified, and so it defaults to the one specified in your project file.
If the path that you're actually specifying as a parameter contains spaces, the command is likely to fail. I believe you need to wrap the path in quotes and append an extra backslash to the end of the path string.
I believe you should be using OutputPath.