How do I make IntellIJ use JVM options for all main files in a project? - ide

I can configure a main file to use natives needed, but in my project there are multiple main functions so I need all the files to to use the JVM option when I can choose to debug whichever one I want without having to create a configuration for each one

You can change the configuration under Defaults node (Templates in the new versions), all the new configurations will inherit its settings. Make sure to change the correct default configuration type, Application is most likely what you need.
Refer to the documentation for details.

Related

Modify IntelliJ custom properties in plugin tests

I develop plugin for IntelliJ. How can I modify custom properties for my plugin tests?
For example I want to set idea.max.content.load.filesize property to, say, 100MiB
These are system properties, so java.lang.System#setProperty
Depending on the properties you wish to modify, you may be able to use idea.properties, which contains the "default properties used to run IntelliJ IDEA" (per the link you provided). To modify the file, you go to Help > Edit Custom Properties... (see these steps).
For example, I used this approach to address a problem where my machine's security software was blocking plugins that used IntelliJ's default config directory (C:\Users<user>\AppData...).
This is the Windows OS default Application Data directory and is included in the paths scanned by the security software. By moving my idea.properties file to a different directory (c:/development/idea/caches/), not automatically scanned by the security software, my plugins were no longer blocked.
It's a different use case from what you're describing, but may be an approach worth looking into.

editing remote files locally and committing them to intellijea IDEA

I am currently writing a program with intellijea IDEA. I cloned my gitlab project. However, when I try to create new class, I don't get to see the option to create new class. Please what I am doing wrong? Or is there a better way to resolve this issue?
you need to define the content type of a directory. This way IntelliJ can provide context aware menu options for you.
First create a directory. E.g. src/main/java (like maven).
You can set this in the module settings:
Tip: If you use maven or another build tool, you can add support for that tool to your project too.

Is it possible to configure file types mapping in Idea via gradle 'idea' plugin

A little intro:
I work on a project with legacy codebase witch uses internal xml based descriptors with specific file extensions (about may be 10 extensions).
Let it be *.desc, *.check etc.
To have code highlighting for such a files I can configure Idea to consider these types of files as XML.
It's available through:
Preferences / Editor / File types
And then add all custom extensions to 'Recognized file types': 'XML'
Our project uses gradle as build tool
and my question is:
Is it possible to make same configuration via dsl of gadle 'idea' plugin?
The short answer is: No.
One could create a custom Gradle task that will modify IDE file type preferences XML file in the config directory. While it's possible to run such task automatically on the project refresh in IntelliJ IDEA, it will most likely not work since you can't modify IDE configuration when IDE is running (the changes will be reverted). So, you will have to run it from the command line, outside of IntelliJ IDEA when IDE is not running.
It's probably not what you want, but if documented, can be used by the team as the manual step to make this configuration change easier.
Using gradle idea is not recommended anyway.
A better way might be to provide your own IDE plug-in that will associate these file extensions with XML file type and instruct the team to install this plug-in.

Can I commit and share VM options in IntelliJ?

To execute my application, or run or debug unit tests, I need to enable various VM options, include -javaagent:<aspectjweaver-path> or -Djava.library.path=<some native lib path>
I can see how to change these configurations manually in IntelliJ IDEA under "Edit Configurations..."
What, if anything, do I need to check in to my VCS to share these settings with other members of my team, and ensure they pick them up automatically whenever someone changes them in the VCS?
Alternatively is there a way to set these automatically in IntelliJ without even touching the edit configurations? Especially the aspectjweaver. When I build/test my project from the command line using maven this is all handled for me by specifying argLine arguments to the surefire plugin, but IntelliJ doesn't respect these settings. Perhaps there are alternative plugins that can help me out?
First, you need to share your run configuration. It's simply done by checking the Share box right to the configuration name in the run configuration dialog:
Your run configuration will then be saved to .idea/runConfiguration (or whatever your settings folder name is).
From Jetbrains Web Help:
If this check box is selected, the run/debug configurations become available to the other team members.
The shared run/debug configurations are kept in separate xml files under .idea\runConfigurations folder, while the local run/debug configurations are kept in the .idea\workspace.xml.
This field does not appear for the default run/debug configurations.

When to use .xcconfig files

I have just set up three different configurations in my project for debug preview and release. No in Xcode there is an option to specify different .xconfig files per configuration. I am now wondering in what circumstances they should/could be used and what their advantages are over just editing the build settings per configuration.
Use xcconfig files if you find yourself changing the same build settings for each project you create. Place the build settings you're changing in the xcconfig file. By using a xcconfig file you can avoid editing those build settings every time you create a project.
Having the option to use different xcconfig files for each build configuration allows you to place the debug build settings you're constantly changing in one xcconfig file and place the release build settings you're changing in another xcconfig file. Use multiple xcconfig files if the build settings you're changing have different values for debug and release builds or if you change some build settings only for debug builds and other build settings only for release builds.
It's not me who you asked about an example #Besi but I would like to explain why the BundleId change is useful at least for me.
When I have different requirements for "Development", "Ad Hoc", "App Store", for example I need to send Push Notifications, so the push certificate will be different depending on the version.
In this case I can make 3 different XCode schemes and depending on the chosen scheme, when compiling the bundle identifier will change so a different kind of version will result.
Add to this the fact you can use you xcconfig to choose the "Code Sign Identity", and practically every build setting you can imagine. This way is more correct than having different targets for each version and with different plist files and build settings, because you avoid duplication and you can customize the way the settings should override each other.
Sorry if this is very convoluted, I tried responding the original question in the process.
One way I've used xcconfig files is to set up different BundleId's for iPhone apps. That way you can have different apps with different features/servers enabled. Very helpful. It involves using a variable name for the BundleId.