Intellij exclude single file from module output - intellij-idea

How to exclude a single file from module output? I have seen the field "excluded files" in the module configuration (File -> Project structure -> modules) and tried to enter a pattern like that one:
path\to\file\*Server*
in order to exclude the class
path.to.file.MyServer
but it doesn't work

You should go to Settings | Build, Execution, Deployment | Compiler | Excludes and add your file name to the list.

Related

Intellij Idea compile output including non-class file?

I had a project that source code including non-class file in package(eg:.sql,.ftl). I want to generate output including them but the artifacts always contains class file. How can I include them?
It's a web application, and below is source structure(java code part):
src
|
main
|
java
|
package1
|
Class1.java
Class2.java
sql1.sql
sql2.sql
template1.ftl
The output only contains compiled class.
I found a solution:
Project Structure->Module:at the bottom, Exclude files:*.java
Project Structure->Artifacts:Output Layout:add 'java' directory contents to classes

CMakeLists.txt cross-referencing each other

I am trying to migrate a project from a custom build script to cmake. The source structure looks roughly like this:
src
|
+-CMakeLists.txt
|
+-generated
| |
| +-CMakeLists.txt
| |
| +-database
| |
| +-...
|
+-main
|
+-CMakeLists.txt
|
+-database
|
+-...
The source files in generated/database get autogenerated. cmake seems to be capable of this (that's not part of the question), but I wonder how I can make it build stuff in the right order. main/database contains the framework that is used in the autogenerated files. However, there are other folders in main that depend on the generated sources. If I structure the top-level CMakeLists.txt like this:
add_subdirectory("generated")
add_subdirectory("main")
I cannot refer to main/database in generated/CMakeLists.txt as dependency.
Overall, I have the impression that cmake forces me to structure my files according to their dependencies, but I want to preserve the current layout - the dependencies in the project are far too complex to map them onto a file system hierarchy.
Should I just avoid add_subdirectory and write everything in the top-level CMakeLists.txt? It seems like this should be possible. Or is there another way to solve this?
Overall, I have the impression that cmake forces me to structure
my files according to their dependencies
If CMake has information that target A depends on target B (for example
target_link_libraries(A B)) B will be build first, then A.
If you use generated sources CMake can't get dependency information
and you need to provide it using add_dependencies.
From documentation:
Adding dependencies with this command can be used to make sure one target
is built before another target.

importing files from other directories in xcode

I have the following directory structure.
A
|---B
| |---C
| |---D
|
|
|---E
| |---F
| |---G
I have A directory under which I have B and E. In B, I have C and D files and in E I have F and G files.
I am working on G file and I need to import D file. How do I do that ? If I directly write import "G.h" its throwing error as it will search in E folder. If I use import , its throwing error. Please let me know how to traverse directories in Xcode. I am using latest version of XCode (Xcode 4.6). Thanks!
If you have added the files to the project correctly you should simply be able to write
#import "G.h"
as the physical location should not be an issue. Xcode should be keeping track of those.
Try removing and re-adding the files in question.
You could add "B" to the "Header Search Paths" directly in the Project or Target Build Settings.
Add "${SRCROOT}" to HEADER_SEARCH_PATHS to include your source directory. In your Example it points to A.
If you set it to recursive it will check all subfolders (including B).
With "${SRCROOT}/B" you would only include the header files in folder B.
The quotes are needed, if you have blank space in the path.
But you should not need to do that, if the desired file (G.h) is in you xcode-project.
Try re-adding the file as suggested by Mundi.
Apple Developer Documentation: SRCROOT

How to make /out directory appears in the project (cannot include it)?

I am using IDEA 12. I cannot include /out directory into my project.
I tried Project Structure -> Modules -> MyModule -> Sources and then click on Exclude, but nothing happens. /out directory still remains excluded and red-colored.
Is this a bug or I am doing it wrongly?
Screenshot
I can't deselect Exclude to make folder included.
'Exclude output paths' option on 'Paths' tab relates to the module output path. The project output specified in File | Project Structure | Project | 'Project compiler output' is always excluded. If you really need to include it you can do the following:
Switch to 'Use module compile output path' option on 'Paths' tab for all modules.
Select 'Project' item in the left list and clear 'Project compiler output' field.
Reopen the project.
After that 'out' directory should become visible in the 'Project View'. However I recommend you to exclude actual module output subdirectories in the 'Sources' tab by hand. Otherwise IDEA may rescan and reindex output files generated by the compiler after each compilation and this can lead to performance problems.
It looks like Android specific bug, I've created a new issue, please vote:
IDEA-97776 Output is excluded from the project view regardless the "excluded folders" and "exclude output paths" settings

reinclude excluded file in Intellij

In Intellij, if I have an error in a source file, then when building I can choose "Exclude from Compile" by right-clicking on the file in the build output.
But, now I would like to include the file again. Where is the menu item that lets me put it back into the build? (The file shows in the Project window, and has a small 'x' in its icon to show it is excluded, but I see no way to get this to go away.)
Edit - I found there is a compiler.xml file, and I found I can delete the file from the "excludeFromCompile" section, but still, there must be a menu item somewhere to do this.
Settings | Compiler | Excludes.
For Intellij 14.0 on Windows, undo excludes from compilation
File -> Settings
Then inside Settings -> Build, Execution, Deployment -> Compiler -> Excludes
or just search for "excludes" to find it.
Note in IDEA v12, there is no longer a File | Settings menu option.
I'm not sure how to exclude/re-include individual files, but this is how it works for folders...
Now the menu item is File | Project Structure... and that brings up a multi-column dialog.
In the rightmost column, click Modules, then select the directory that contains the excluded folder in the second column.
If it is a folder you are trying to re-include, it is listed in the third column's directory list, and excluded folders are at the bottom, in red.
If you click on the red 'X' to the right of the folder name, it will remove the folder from the "excluded" list which has the effect of including it back in the project. Awkward and counter-intuitive, but that's how it works.
I found that johnkaplantech's answer didn't work because Idea would complain about multiple modules sharing the same root.
So I manually edited the project files to remove the exclusion. File modified was %ProjectRoot%/.idea/modules/<ModuleName>.iml. Inside module/component/content of this XML file was a tag excludeFolder. Remove that.
In IntelliJ IDEA 15.0.3 File | Settings | Build, Execution, Deployment | Compiler | Excludes | (Remove path from right list).
For Mac it would be :
1) Go to Preferences:
2) Expand Build, Execution,Deployment section
3) Expand Compiler sub section
4) All the excluded classes will be available in the Excludes
5) Delete the classes you want include for compilation and press Ok.
Hope it helps.
From menu:
File | Settings | Compiler | Excludes: you can add/remove excluded files to be compiled in the dialog.
For me excluded folders did not appear neither under File > Settings> Compiler > Excludes nor File > Project Structure > Modules > Sources > Exclude.
What I did was: I clicked on the excluded folder with right-click of the mouse. In the menu which opened there is an option "Mark Directory as". I chose "Not Excluded".
A simple workflow is to create a directory in your project and exclude the entire directory.. For example, create a directory called, 'excluded'... add files to exclude... right click directory > mark directory as excluded... If you want to add or remove files from that directory reverse the process... cancel exclusion on the directory, get/put files... mark as excluded again.
To configure classes to be excluded from import open:
Editor / General node, then click Auto-Import.
This works for me. You can also find this in the documentation:
IntelliJ was still excluding a file after I removed it from the compiler exclude folder. It turns out I had also excluded it in File > Project Structure > Modules > Sources > Exclude files (at the bottom of the window).
Nothing to worry about. Simply follow this steps Mac/ windows
File > Settings >
Build, execution, deployment > Excludes
Select the file that you selected as exclude from compile (mistakenly)
Finally delete it and Press ok.
Now you can run the program/code again.
Congratulations!! Problem solved
I had the same problem of exclude things, and my solutions where:
Tuve el mismo problema de sacar sin querer cosas que no debía y mi soluciones fueron:
Case 1:
IntelliJ IDEA ->Preferences -> Build,Excecution, Deployment ->Build Tools (my case) -> Maven -> Maven ->IgnoredFiles (uncheck the relevant option )
Caso 1:
Me pasó lo mismo y mi solución fue ir (en Mac) a:
IntelliJ IDEA ->Preferences -> Build,Excecution, Deployment ->Build Tools (en mi caso) -> Maven -> IgnoredFiles (destildar la opción, en mi caso el file en cuestión
Case 2:
IntelliJ IDEA ->Preferences -> Build,Excecution, Deployment -> Compiler -> Excludes and select the relevant option -> minus or plus
Caso 2:
IntelliJ IDEA ->Preferences -> Build,Excecution, Deployment -> Compiler -> Excludes and select the relevant option -> clickear en el signo más o en menos según corresponda
Up-to-date in 2023:
Go to Editor > File Types > Ignored Files and Folders tab
Remove the file/folder pattern you want to include again.