Stop IntelliJ polluting Project tool window with module names? - java

On the back of this question, is there a way in IntelliJ to disable displaying the full .iml module name [in bold and in square brackets] next to folder name when it is simply a fully qualified version of it? It is unnecessarily noisy on a big project...
http://i.stack.imgur.com/eE5nz.png

There is a related feature request open in IntelliJ IDEA issue tracker:
IDEA-82965 Clean module names
Feel free to vote/comment.

As a newcomer to both IntelliJ and Maven, I also found the module names to be noisy. Perhaps I'll need them later, but for now I needed to be able to focus on the file directory structure and just needed them gone. Switching from "Project" to "Project Files" did the trick. The Project Files view has an option in its Options Menu to Show Modules that I was able to disable. Maven module information is no longer visible. It might not be the perfect long term solution, as I don't fully understand the difference in the views yet, but it did reduce the as-yet-unnecessary information I was being bombarded with.
(Thanks to https://youtrack.jetbrains.com/issue/IDEA-126014 for pointing this out while working on a similar issue.)

Related

Intellij "go to > implementation/declaration" navigation feature not working

I have a maven java project that I would like to use IntelliJ for development on. One of my favorite navigation features of IntelliJ is the 'go to > implementation' feature that appears when you right click on a method or function.
My problem is that this feature is not working for me; when I choose it nothing happens, no error, it just sits right where it is. It also isn't suggesting functions and methods as I type, so it's as if IntelliJ is failing to recognize dependencies and relationships among the various classes in my project.
I know the code is fine because it compiles and runs, has anyone else experienced this? I made sure to open the project as a maven project using the pom.xml file but that made no difference.
Right click on the root folder of your project (Application code folder)
and
select -> Mark Directory as -> Sources root
It seems that the index is wrong.You need to force reindex the project files.
Just try:
File -> Invalidate caches...
Then restart your IntelliJ
This is way too broad of a inquiry!
There's a few things that could be wrong but compiling and running has nothing to do with it. Compilers such as maven can generate sources or modify behaviors of compilation units and can be considered non-deterministic programming which because of its very essence, can't be analyzed.
You're referring to a Contextual IntelliSense operation; in the context you're in currently, dependencies etc may not be properly configured. You can't know what you don't know; similarly, Intellij can't either. Make sure all libraries are listed properly within the Project/Global -> Libraries section in order to have them properly function.
Alternatively, your cache could have become corrupted. Try File -> Invalidate Caches / Restart...
Lastly you could simply have the option disabled somehow. There's various settings which will disable the option. For example, Power Save Mode may be enabled. For the rest I suppose it'd be best to refer you to the help documentation.
I had the same issue with idea and i did:
"Mark Directory As > Sources Root" not worked.
"Invalidating cache and restart not worked"
"Deleting .idea and .iml files not worked"
Finally right click on pom.xml and select "add as maven project" worked for me.
Ishnark's comment on my question provided the solution I needed, reposting here so that it can be upvoted and hopefully help others. All I needed to do was right click on the source root of the projecet and select "Mark Directory As > Sources Root". More details here:
solution
In my case the problem was the next: for some reasons *.py files were registered as a text files, not python ones. After I changed it, code completion started to work again.
To change file type go Preferences -> Editor -> File types -> add *.py into Python again.
comment from: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360005050480-Cannot-find-declaration-to-go-to-solved-
GO TO File>New>Project From Existing Source then choose you're project
let maven build you're project again.

Eclipse how print missing libraries

I have many missing libraries in a Java Eclipse (3.7.2) project. Is there any way of copying the list of libraries, to paste into a document for editing?
You can select the errors in the "Problems View" and copy them. Eclipse will put a pure-text version into your clipboard which you can then paste into an Editor.
If you have a working project and want to copy libraries from there, open the (hidden) .classpath file. It's XML which you can copy&paste. I haven't tried copy&paste from the "Build Path" dialog but maybe that works as well.
While Eclipse may recognizes compile-time required dependencies that are missing i hardly doubt it knows runtime-required librarys (so no, eclipse and as faar as i know any other IDE does not support that unless dependency management is set up with for example Maven).
The librarys missed at compile time should show in the 'Problems' view of Eclipse.
Window -> Show View -> "Problems" (select view 'Problems')
Once you have a tab with that view you can order the problems by its description and all of the 'missing library..." issues will be listed in a group. You will then be able to select according entrys and CTRL+C / CTRL+V them out of there.
Also note that in my case using maven eclipse oftenly thinks there are classes or dependencys missing by the fact eclipse is not that skilled when it comes to local synchronization of your workspace.
Id rather invest that time to start adding missing dependencys or think about Maven for more proffessional dependency management.

Import/use code from an other Intellij project

I have two Intellij projects and in one of them I want to use some classes from the other. I'm not interested in making a library, because I want both projects to update if I change the code in the shared classes.
I have tried with modules, libraries and dependencies, but it won't work.
Thank you.
EDIT:
Followed the answer, this still doesn't. Picture show dependencies.
Perhaps this is the step you're missing.
Suppose Project_B depends on Project_A. To make one module depend on another
open the "Project Structure" dialog
click on the module that will have the the dependency
click the "Dependencies" tab
click the "+" (it's platform dependent as to exactly where it's located)
click "Module Dependency..."
when the dialog opens, click on the project to depend on
I'm not entirely sure if this is what you want but it is possible to share these files using some sort of version control.
Personally I recommend Git, it's reliable and easy enough to use.
You could use commits, push and pull to sync your files.
for more info on git: http://github.com
EDIT: I found a question on stack overflow that might be able to answer yours:
Sharing Java packages between modules in IntelliJ?
This user made a third module and put the shared data in that, and then linked the third one to the first two. Maybe if you set it up like this it will work for you.

Sources from referenced projects are not deployed to Tomcat in Eclipse

I have setup a dynamic web project in eclipse with JSF in which I trust on code from another project (framework). Therefore, I added the framework project to the build path of the website project.
So far so good, Eclipse recognises every class and the project builds without errors.
Problem is though that when I do "run on server" to test it on tomcat 6.0.24, the application fails. I get ClassNotFoundException on every class from the framework project.
Is this a bug or is some specific configuration necessary for this?
I was googling and ended up here for a similar problem. I wanted to make a note for others about the current situation on Eclipse Indigo, as the terminology has changed a bit by the looks of things.
On your project properties, do a filter/search for "deployment assembly".
It is then straightforward to add a project dependency. Job Done.
Thanks to Alexander's edited answer which led me to this.
Did you check Warnings in Problems view?
Do you see Classpath entry /your/framework.jar will not be exported or published. Runtime ClassNotFoundExceptions may result warning?
If you do.
Right-Click the warning and choose Quick Fix.
Choose "Mark the associated entry as publish/export dependency." from Select a Fix box.
Click Finish.
EDIT
Now, I think I understand where disconnect is. I think now I remember the joy of figuring this out for the first time.
In your website project ( I will speculate here , but I guess you've created it as a Dynamic Web Project ):
Open project properties
Select Java EE Module Dependencies panel
Check your framework project in JAR/Module column. Beware, that for reasons not known to me, the list is not sorted ( and is not sortable ) in any particular order, so you may need to search for your project reference there.
The results of this operation will be written to /website-project/.settings/org.eclipse.wst.common.component file. Put this file into your source control.

Dependency bundle (jar-files/sources/API docs) in Eclipse

I'm developing various in-house extensions for JIRA, the issue tracker we use. So far I worked with Netbeans and everything worked like a charm. However, now I need to switch to Eclipse and I'm having struggle setting up the environment for this development project.
First a clarification why I'm using the approach I'm describing here: building JIRA (in an IDE) is not easily done and I'm absolutely not interested in wasting my time to figure out how to do it. Besides, I don't need to build it, I just want to develop extensions and be able to use the IDE's auto-completion and help support (API docs). Atlassian (the company that develops JIRA) provides a "development" package, but it's just a sorry excuse rather than a real solution.
What I did with Netbeans was to create a library bundle with all relevant jar-files, the Java source files and the API documentation. This way I could use auto-completion, "jump to" the source and the API docs would pop-up when needed.
It seems Eclipse doesn't offer such a functionality, at least I couldn't figure out how to add the sources and the API docs to a "User Library" (which I'd then add as a dependency to my project just as with Netbeans).
My next approach was to create a separate project that holds all the stuff and mark that project as a dependency of my project. This works, but it leaves me with another issue: now I get 37k errors reported (all within the "dependency project"). As said, correctly setting up building for this dependency is a major struggle and not my original goal, therefore I'd happily ignore these errors. Automatic building is turned off and changing the "Errors/Warnings" settings under "Java Compiler" for the project didn't change a thing, so I'm kind of lost now.
Okay, let me try to phrase this as questions:
Maybe I just didn't find it: Is there a way to create a dependency bundle (call it whatever you want) in Eclipse that -- besides just carrying jar-files -- gives me the ability to use the API docs and "jump to" the declaration in the sources?
If not, what's the common practice to do in such a situation?
If the "dependency project" solution is the way to go, how can I completely disable compiler errors for that project?
Check this for illustration with images
Add the source code for jar
Add the Javadoc for a jar
Or just right-click on the jar file in the Package Explorer view. Select "Properties" then set the according paths in the "Java Source Attachment" and the "Javadoc Location" field.
When you create user libs via window->preferences->java-build path->user libraries you can specify which jar you need, sources (in archive or folder) && javadoc (from internet, or local, or from archive). Then you can use this lib in your project via context menu on project->Build path->add library->user library-> choose your lib.
Here you acn pick up more info Eclipse help

Categories