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.
Related
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.
Since version 2.2.0 Tycho has introduced a new feature to allow using maven artifacts in PDE target platforms, and here's the how-to. Following its instructions I have included an artifact of Saxon-HE into my target platform. I can see the wrapped OSGi bundle of Saxon after ticking the Show Location Content option in the Target Definition Editor. Also I ran mvn clean verify command to make sure that the artifact is downloaded into my computer. However,
as I began to try to import the package into my Eclipse plugin code, I found no suggestions from this package.
When I tried to include the package as a feature in the Product Editor, I couldn't find any option.
In addition, when attempting to include it as required plugin / imported packages in the Plugin Editor, there was no option, too.
What's more, the product produced by mvn clean verify did not contain such plugin as Saxon-HE after checking my whole RCP project.
All the efforts in vain above made me wonder how I can use a maven artifact in my plugin development. I desperately need the functionalities Saxon-HE provides with to enhance my plugin. Anyone experienced sharing your expertise?
-- 2021.08.13 update --
Manually I included this plugin in the plugin list of my RCP project via source file editing. Its jar file appeared in the plugin folder of the product. But anyway I was not able to validate the availability of the library in the dependency tab of the plugin manifest editor as shown in Vogella's tutorial. Restarting the IDE did not help, either. This might mean that I have to manually code the source code without the content assistance.
I have two pairs of projects that I develop in NetBeans, both of which have a GUI project, and a library project, where the GUI project depends on the library one. In one of them, NetBeans recognizes that the dependency is local, and indicates as such with an Ma symbol, as seen below, with the dependency project in green:
This provides some nice functionality, most notably that the "Navigate to" (ctrl+click) functionality from the GUI project takes me to the source code in the library project. I also don't have to manually rebuild the library project for the GUI project to pick up any changes.
However, for the other pair of projects, NetBeans will pick up that the dependency is in my local Maven repo, but does not recognize that the source code is a Maven project that it also has open:
I've tried looking through all the right-click menu options, removing and re-adding the dependency from the NetBeans GUI, comparing the pom.xml, comparing nb-actions.xml, and nb-configuration.xml, but cannot find any explanation of why one library is recognized as local, but the other is not. The only information I've found online is at http://wiki.netbeans.org/MavenBestPractices, where it notes:
"Hint: If you open a project that other projects depend on, the icon in other projects changes to a "maven project" icon to denote that the IDE knows about link between the projects. However such a link is only established when the groupId, artifactId and version all match in the dependency and project declaration. Frequently occurring problem is that you change an API signature in your library project, but the application is not picking up. Often it's caused by the fact that the application is using an older version of the library artifact. The artifact icon can help you track down these problems."
However, I've verified that the pom.xml of the GUI project depends on the version being built in the library project, and even made the versions identical between the GUI project and library, and the "maven project" icon still doesn't show up.
Does anyone know how to debug this issue, or if there's a magic setting somewhere that I'm missing for how to make this link work? I've been trying with both NetBeans 8.2 and 8.1, and am compiling with Java 8 for both the successful pair of projects, and the unsuccessful ones.
Revisiting the project a couple years later, I finally figured out a way to get the dependency to connect locally.
Change the artifact ID of the dependency, and update the dependent pom to match the new name.
This is admittedly bypassing the root issue rather than addressing it, but given the inability to pinpoint the root cause, seems the best option at this time.
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.
I have had a working Indigo workspace for quite a while, with many projects checked out from SVN. Mostly Ant projects, but a few critical Maven projects.
I'm struggling to get a Kepler workspace working with the same projects. I've essentially given up on the pure STS installation, as that gives me (different) errors in both Maven projects. I filed both Eclipse and STS bugs, and they both say it's the others problem, so I've given up on that path for now.
I'm now trying to start with pure Eclipse and install the Spring pieces I want. I thought I had all the plugins installed that I need, and I'm not getting the error dialogs that I was getting with the STS installation, but I'm getting a build error I can't handle. It's saying this:
Build path is incomplete. Cannot find class file for Could not initialize class org.springframework.ide.eclipse.springframework.aop.aspectj.AspectJExpressionPointcut
I suppose I'm missing some plugin, but I don't know what it would be.
I even did a somewhat exhaustive search for that class ("AspectJExpressionPointcut") in my workspace and Kepler distro, and it can't find it, unless it's in a jar file that's inside a jar file (my search just looks for classes in jar files in a directory tree). I see references to it on the internet, but I can't get much out of those references.
The solution is to install Spring IDE AJDT Integration. For Eclipse Kepler you need to add
http://dist.springsource.com/release/TOOLS/update/e4.3/
to the list of update sites, then install "Spring IDE AJDT Integration"