How to prevent IntelliJ from searching in bin folders - intellij-idea

I have a gradle multi-module-project with lots of modules.
When searching (Ctrl+Shift+F) the whole project, then hits are listed twice, under e.g. src/test/kotlin/... and bin/test/.... Hits under bin, since generated, are considered false positives.
I know, that I can exclude a single project's bin folder from search with Mark directory as excluded, but it'd be tedious to repeat that for all modules:
Question: Is there a way to exclude all the bin folders from search?

Related

In CMake, get all the include search paths in check_include_file_cxx

I want to check the self-sufficiency of all my headers in my C++ project managed with CMake. Using check_include_file_cxx I am partially able to do it, except that some include file are missing and false negatives are reported.
The solution in CHECK_INCLUDE_FILE_CXX does not respect 'target_include_directories' when looking for include file involves manually adding the required directories.
I would like to instead transfer all the search path used during any normal compilation in my project to CMAKE_REQUIRED_INCLUDES. Is it possible and how ?

Is there a way to make cmake find_package config mode VERSION selection automatically work with complex paths or is my path structure flawed?

I want to have find_package in config mode is the user points cmake with the SDK <Project>_ROOT variable then possibly calls find_package passing in version numbers and setting the flags for version number sorting.
set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
find_package(<Project> CONFIG)
CMake would then automatically finds the latest config.cmake file and everyone is happy.
The problem I have is the SDK folder structure:
<Project>/<Version>/<Toolset>/cmake/config.cmake
SDK/2.1.1/v140/cmake/SDKconfig.cmake
Where <Project> is the root folder. Based on the kinds of paths searched I could make it work if I reduced the path by 1 folder combining the names and added the project name as a prefix for the subdir but that feels very weird.
Other ideas I am considering is creating a dummy config as a find_package forwarder or maybe an importer in the middle of the path that re-tries a find package or imports things further down to the correct version or maybe toolset but haven't pursued that yet. It might again require that the version number or other have the project name as a prefix.
Is placing these highly specific content config files that far down the wrong approach?
If you look at the find_package search procedure you'll see that it will consider directories prefixed with the project name. Here are the Windows-compatible structures CMake will consider:
<prefix>/ (W)
<prefix>/(cmake|CMake)/ (W)
<prefix>/<name>*/ (W)
<prefix>/<name>*/(cmake|CMake)/ (W)
** <prefix>/<name>*/(lib/<arch>|lib*|share)/cmake/<name>*/ (W/U)
<prefix>/<name>*/(lib/<arch>|lib*|share)/<name>*/ (W/U)
<prefix>/<name>*/(lib/<arch>|lib*|share)/<name>*/(cmake|CMake)/ (W/U)
The fifth one down, the one I marked with **, is the most promising. Note that lib/<arch> is only searched if CMAKE_LIBRARY_ARCHITECTURE is set and * means "0 or more characters"; however, the * in lib* can only be 64, 32, or x32 (and only on Unix).
So here's one suggestion that's mostly useful if you're going to create an eventual directory structure that contains multiple project versions and multiple toolset versions:
<prefix>/<Project>-<Version>/lib/<Toolset>/cmake/<Project>/<Project>Config.cmake
Your users should then set CMAKE_LIBRARY_ARCHITECTURE to v141 or whichever (I have found it is blank by default on Windows). As long as you have a <Project>ConfigVersion.cmake file, users setting the version via find_package should get the correct one.
I tested this locally while writing the answer, but I've never deployed this myself. So I can't really tell you how great an idea this is beyond that it seems like it would technically work.

In IntellIJ IDEA how can I exclude a few files from find in path?

When I do a find all (Ctrl-Shift-F) it takes very long, because I have some autogenerated js files in my project that are quite large.
How can I exclude those files from my searches?
Obviously I don't want to exclude all js files.
IntelliJ let's you pick one or more file types to search, but is there any way to search everything except 2 or 3 known files.
I tried marking them as ignored, but they still show up in searches.
The help is here https://www.jetbrains.com/help/idea/2018.3/finding-and-replacing-text-in-project.html#limit_search
It recommends restricting to a directory, or a module, but there are quite a few directories and it's all in the same module, so that does not work for me.
In the File Mask you can use ! oparand to exclude the files for example for not in js file then the file mask would be !*.js. You can use , to add multiple conditions to exclude or select the file types you are interested into.
!*.json, !*.txt,!*.js,!*Test*.java,*.java
In IntelliJ 2021, you can include specific file type by .ext1 separated with commas and to exclude !.ext2
Refer image, I need only .java file and not !.js
you can also exclude !Test.java as well.

Exclude folders based on regular expressions in IntelliJ Idea PhpStorm

Is there any way to exclude folders in PhpStorm through regular expressions?
I have multiple "subproject" folders in my main project folder and every subproject has its own vendor folder I want to exclude from indexing.
So far I've been excluding those folders manually but since every week or so more subprojects are added the maintenance is annoying. If I decided to exclude another subproject folder, I'd have repeat that action for 30+ subprojects.
This question suggests ignoring folders (which can use file masks to select files/folders), but I need to be able to see the folders in my project window and ignoring the folders hides them.
This question suggests ignoring folders (which uses regex to select files/folders)
It does not uses regex. It excludes by exact name or ordinary file masks (e.g. standard * char that means any).
Back to the subject -- it's not possible.
https://youtrack.jetbrains.com/issue/IDEA-127753
https://youtrack.jetbrains.com/issue/IDEA-150784
Watch those and related tickets (star/vote/comment) to get notified on any progress.

How to exclude non modified(scm) modules from maven release

i have huge project that contains around 200 jars, when i prepare release maven prepare for all jars but for sure there are jars that has not been modified since last build so is there any way to check if jar has been modified since last build from scm? and exclude them?
i dont want to relase jars (more than 200) individually.
for example: i want to make relase for parent but i dont want to relase jar4 that has not been modified
-Parent
---------Module1
----------------jar1*
----------------jar2*
---------Module2
----------------jar3*
----------------jar4
for example: i want to make relase for parent but i dont want to relase jar4 that has not been modified
The syntax for this is
mvn -pl Module1,Module2/jar3 <your maven goals here>
(in this case you want to build all of Module1 and just jar3 of Module2)
Now the tricky part is how to assemble the parameter to -pl. I am pretty sure there is no maven way to do that, so you will probably have to write a shell script (or Ruby, Groovy, PERL python etc. script) that does that for you.
Basically, what your script must do:
look for all maven project directories (directories that contain a pom.xml) in the given directory, sort them in reverse (deepest paths first)
find all changed files in the entire hierarchy (using svn, cvs or whatever calls)
map each changed file to one of the projects (by comparing paths), collect all matched projects in a list
Now optimize the list by doing some parent/child optimization (if all children of a given parent are present, remove the children and add the parent). Do this repeatedly until you reach the root hierarchy.
From the remaining list, extract the relative paths, join them with a comma and start your maven process using that value for the -pl parameter.