IntelliJ Idea doesn't place dependencies in External Libraries Folder - maven

Currently have a hard times working on one project. While building with maven I'm getting success but when I open the project all classes are red with unresolved dependencies and folder "External Libraries" contains only JDK classes.
Does anyone know what might be the reason of this?
Thanks in advance.
I'm using Intellij Idea 14.0.2 and Maven version 3.2.5

Enable auto reload for your pom file(s). intelliji doesn't do it automatcally unless you enable it.
To do so, just open a pom file and you'll see a popup that asks you if you to enable auto relaod.

Related

Modules, Gradle Subprojects, and IntelliJ Woes?

I am trying to make use of modules and gradle subprojects and either receive compile time errors or complaints from IntelliJ.
My project structure is as follows:
Root
- settings.gradle
- core
- build.gradle
- desktop
- build.gradle
- src/main/java/module-info.java
The desktop build.gradle file as a requirement on core as:
dependencies {
implementation project(":core")
}
There is no reference to the "core" project in the module-info.java files.
In this configuration, IntelliJ doesn't like usage of classes from the "core" project in the "desktop" project (I see a lot of red), but running gradlew.bat desktop:run works with no issues. Bug with IntelliJ? I am using microsoft's openjdk, but hopefully that doesn't matter.
My best attempt to fix this, was to add a module-info.java file to the core project as well and reference the core project in the desktop project's module-info.java file. Unfortunately this configuration, while making IntelliJ happy, renders me unable to run the desktop from command line anymore. I get errors about the core project being unable to find required modules that are the exact same as the required modules I pull in for the desktop module. I think this might be an error on my part, but I'm not sure how or what to do to fix it.
Would appreciate any insight.
P.S. Of these issues, I think I would prefer to get IntelliJ working with the first setup, because I intend to have this core library be shared between the desktop project and an android project, and while I haven't looked into it yet, I am not sure Android supports new java modules?
I think terminal should be the first priority. If your original setup made it compiled successfully under terminal, then there is no problem in your project. Do not add extra files for just making the IDE happy.
There's still something you can do. The first step is compiling your project successfully under terminal. This step downloads all the necessary dependencies before IntelliJ, reducing the problem scope to IntelliJ's linking and indexing. Then there are some options:
In the Gradle tool window, click the top-left button Refresh all Gradle projects.
Delete all the .idea folders in your project. Then open the root folder of your project via UI or CLI.
Click the invalidate caches/restart in the main menu.
You can also also create a new Gradle multi-module project with command gradle init, and open it with IntelliJ. It should be analyzed by IntelliJ normally. Then you can compare its project structure with yours. Maybe there's something different.
Hope these steps could help you.

intellij idea maven dependencies resource code using decompiler

It is said that Intellij idea would automatically download resource code from maven for maven projects. However I am still having "decompiled .class file bytecode version 50.0". I would like to view the resource code from .java.
right click on the project. maven -> download resources and documents (or just download resources). I have already checked the settings -> maven ->importing ->sources and documents, but this does not work no idea why.

Using Intellij + Maven to import libraries: Cannot resolve symbol

I have imported a library (JBox2D) using Maven in IntelliJ 13, for use in an android project. Maven didn't give me any error messages, so I assume the library was imported correctly.
However, as soon as I try use a class from the library, I get "Cannot resolve symbol". IntelliJ doesn't offer the option of adding an import statement, as it normally does.
How should I proceed?
Open the maven window and hit the reimport button (it's usually the first one on the toolbar). This will force IntelliJ to reimport your project based on changes in your pom.
Also, check the maven settings within IntelliJ and confirm that you're configured to use the same maven in IntelliJ as you're using on the command line.
If this doesn't work, then try to explain in more detail what you mean by your having imported a library with maven?

intellij idea. what library uses project?

I have Android Maven project which works with Netbeans and Eclipse and compiles in command line itself, but i have some problems with Intellij Idea. After importing the project the IDE complains about non-existing method of imports:
import org.w3c.dom.Node;
cannot find symbol
symbol : method getTextContent()
The method getTextContent() added in java version 1.5. I do use 1.7 Oracles JDK. Build target in pom.xml points to 1.5
Similar post about problem in Eclipse mentioned here says:
There are many jars packaged with xml-apis and they sometimes contain the same library routines, but at different versions.
I have searched how to lookup which version of library is used with IDE and how to priorities the right libraries.
Do someone have the answer?
In intellij go to module settings (right click module and its in the context menu).
Select project, you can choose and/or add a project SDK here, If you are using 1.7 it will probably be that version.
when you make/compile your project its probably running against the version above.
You can run maven targets (in my version there is a tab on the right) you should be able to do this if you right click on the pom file, this should compile.
In conclusion
use the same java version on your pom and in your project
try to move Android SDK module up. in "Project structure" -> "Modules" -> "Dependencies". And make sure You do not have the old maven module xml-apis there.

Adding existing source packages to a Maven Web Application in Netbeans

I have a normal Netbeans project, and I would like to add the source packages of this project to a project that is a Maven Web Application, also within Netbeans.
I tried copy-pasting the packages into the /src project directory of the Maven application, but this doesn't seem to work.
Could someone please tell me how I could do this ?
If this is not possible, could someone tell me if I can convert the entire normal project into a Maven Web Application ? Thank you :)
It sounds like you need to add the dependency to your web-application instead of the source code, cause maven is intended to handle exactly such situations.

Resources