Using path variable in intellij maven run configuration - intellij-idea

I'm trying to set up and share maven run configurations in my team and I have this problem. Every team member has different project path. I would like to use path variable in order to define working directory for maven run config. Looks like IntelliJ doesn't evaluate this path variable. Any ideas how to solve this problem?
Error:"the working directory '$MODULE_DIR$' does not exist". "$MODULE_DIR$" is default IntelliJ path variable.

You do not need to do anything. Just use the default value which is a real path to the module inside your project. IDE will automatically use the Path Variable for the Run Configuration xml file.
Note that path variables can not be used in the UI for specifying paths. IDE automatically substitutes them when you use real paths.

Related

In IntelliJ, using xquery, how do I set up my references?

IntelliJ IDEA 2021.2.1 Ultimate
Plugin XQuery and XSLT v1.9.1.212
I can't seem to work out how to get IntelliJ to find the module declarations I've set up in my .xqy modules. The MarkLogic server can find the location, but not IntelliJ. How do I adjust the options of IntelliJ to properly find the references to my modules?
In the "modules" database, the module is at "/code/test/testRecord.xqy"
The modules declaration is thus:
import module namespace testRecord = "testRecord.xqy" at "/code/test/testRecord.xqy"
Locally, the file is located at c:/project/src/main/xquery/testRecord.xqy
Again, the import module works fine in QConsole and when running the module doing the import, but IntelliJ just says "cannot find declaration to go to"
The plugin is using the at path hint to locate the file. That is, it is looking for a path that ends in /code/test/testRecord.xqy. Therefore, you need to ensure that the filesystem path matches, e.g. c:/project/src/main/xquery/code/test/testRecord.xqy.
If the file importing testRecord.xqy is located anywhere under /xquery, you shouldn't need to do anything else -- the plugin should be able to locate the file.
If you are using ml-gradle or roxy to manage the project, the plugin should automatically look in the specified module source root path for those files.
Note: If you want to get the plugin to recognize /MarkLogic paths, you can go to the "Languages & Frameworks > XQuery and XSLT > Modules and Paths" Settings page and set the "Database installation path:" to the root MarkLogic path, e.g. "C:\Program Files\MarkLogic".
If you want to customize this you can specify IntelliJ modules as described in https://rhdunn.github.io/xquery-intellij-plugin/tutorials/module-paths.html.

WebStorm run configuration - package.json path relative to project directory

Question: In WebStorm's npm run configuration: How to make the package.json path relative to project directory?
Goal: To be able to share the run configuration in VCS, it must not depend on where the project is on my machine.
Screenshot: I.e., I want to change ~\WebStormProjects\x-nest\ to PROJECT_DIR\.
package.json field doesn't support variables; but you do not need to use macros or do anything at all to make configurations shareable, this case is handled automatically: if you look inside the .idea/workspace.xml (or .idea\runConfigurations\<config name>.xml if Share through VCS is enabled for it) file you'll notice that IDE stores this path as $PROJECT_DIR$/path/to/package.json, like:
<package-json value="$PROJECT_DIR$/package.json" />
So you can safely keep this .xml file under Version Control and your colleagues will have the correct path to the file even if local path to project is different.

IntelliJ environment variable pointing to IDE config directory

In IntelliJ there are pre-defined env variables one can use like:
$MODULE_DIR$ - current module directory
$PROJECT_DIR$ - project root directory (where .idea folder sits)
$APPLICATION_HOME_DIR$ - installation directory
Is there a variable I can use that points to the configuration folder of IntelliJ - e.g:
C:\Users\<username>\.IdeaIC<version>\config
For anyone looking for this, the variable is called: APPLICATION_CONFIG_DIR
It looks like there is not a document or web page where JetBrains would list all the IDE environmental variables used / declared or available. After a purely random and lucky search I found scratch files are saved under APPLICATION_CONFIG_DIR.

How to get environment information in Mule

I need to put some production specific behavior in mule-config.xml. Is there a way to get environment info in mule?
You can access all system properties via MEL. But I would rather suggest you modularize your configuration in several files (say: common-config.xml, test-config.xml, prod-config.xml) and load the right files at Mule startup based on the environment.
And also you can create properties file for each environment and access it inside mule config file.
You can create xml file with all the configurations and import/load the file into mule project
In your Mule configuration file (src/main/app/app-config-file.xml), you can add the following line:
<context:property-placeholder location="${environment.name}.properties" />
${environment.name} must be a system environment variable. You need to make sure the system where you are deploying your app contains that variable. I think you can also specify it in the Maven build, if you are using Maven (clean install -Denvironment.name=test). You can try.
To test locally, right click on your project, select run as, select run configurations, click on Environment tab, add your variable "environment.name" and the value "local" (without quotation marks) and make sure your local.properties file exists in a location added to the build path. It can be src/main/app for example or in the resources folder.
MEL has some context objects like server, mule ,application using these you can get the envinformation from #[server.env] for more info refer
https://docs.mulesoft.com/mule-user-guide/v/3.6/mule-expression-language-basic-syntax
You can use different mule properties file like Mule-dev.properties , mule-test.properties.
In global elements add a property placeholder :
In mule-app.properties define env= test or dev depending on the env value which you want to use.
Clean the project and deploy. Sometimes it is not able to read the env specific properties. Cleaning the project solves this issue.
You can add a properties file in you project and refer it from property place holder. it is better to add environment value in mule-app.properties file ehich is in /src/main/app
you can have one variable like mule.env in this mule-app.properties and send value to this Property as DEV,QA,UAT,PROD from cloudhub properties and create different properties file in mule/src/app main resources then use Properties placeholder to configure this property file and send the value of mule-env dynamically from cloudhub
Typically the way this is done is to delcare a property bean in which you set the environment specific value like PROD,QA,DEV or local. This environment specific value is set in mule-app.properties like mule.env=local, This needs to be set to the environment we are trying to deploy it and the API picks up the right properties file.

Bamboo artifacts

I am very new to Bamboo. I have got a html file generated using log4j. I wish to put it in user-defined artifacts but don't know how.
It is in surefire-reports folder so I tried giving Source directory as "**/target/surefire-reports/" and Artifact Copy Pattern as "**/*.html" but it doesn't seems to work.
Any idea how to configure it?
Try to change copy pattern to
*.html
and verify your complete path.
I wanted to get all surefire reports from each module, so I created a new Artifact definition with:
Name = Surefire Reports
Location =
Copy Pattern = /target/surefire-reports/.*
This was using Bamboo 3.2.2.
The Location field does not provide the Ant file copy pattern feature, only a fixed path is accepted relative to the working directory.
Set the Location as target/surefire-reports
and the Copy pattern as **/*.html
Also make sure that the Shared checkbox is set, otherwise other jobs will not be able to download the artifact.