IntelliJ newcomer here. I'm having some issues getting my project dependencies working:
So I have a project called ClearDialogue. It's an IDE for making branching dialogue for video games. It relies on my other project, Clear (ClearVG and ClearWindows) for creating its window and also rendering the UI. ClearDialogue also depends on LWJGL3 and a few other dependencies. The projects use Maven to manage its dependencies.
Clear is a project on my machine that I've set up in IntelliJ and successfully ran its demos. ClearDialogue however is where my trouble started; it relies on Clear to work, which is another project (not a JAR thats uploaded for it to fetch). So what I'm saying is: I need to be able to use another IntelliJ project as a library in ClearDialogue.
According to other similar questions, I can achieve this by referencing the other project in the pom file of the project that's referencing it. So I did that and it actually did appear in the "External Libraries" dropdown:
.
There are a few problems:
1) Despite Clear appearing in the External Libraries section, it's still not being recognized by the IDE as a library and when I try to build the project, errors like this are printed to the console:
.
2) It seems that Clear is the only library being downloaded despite LWJGL3 and other libraries being designated as dependencies in the pom file. They aren't being downloaded and aren't appearing in the External Libraries tab. That said, Clear itself uses some of the same libraries (LWJGL3) so is it that it's just making sure they aren't duplicated? Either way, the code itself is drawing red lines because it can't find the LWJGL3 libraries.
Does anyone know ways to fix these issues? Thanks in advance.
I managed to fix both of these problems myself.
To solve the first problem of using another project as a dependency, I was able to use the maven attributes of the projects to do so. I referenced Clear in ClearDialogue's pom file like this:
.
Then I opened the Maven view (View -> Tool Windows -> Maven) and added the pom files from Clear's own modules to the list along with the needed modules within the project itself:
.
After this I pressed the "Reimport all Maven Projects" button (the button in the picture above that looks like a refresh button) and rebuilt the project (Build -> Rebuild Project). This successfully downloaded all of my needed libraries and successfully added the local libraries from my own projects only available on the machine as well. With that I was able to successfully run to program as well.
As for the second half of my problem, I was able to find this answer from another question here on Stack Overflow, which coincidentally was how I was able to figure out how to add local dependencies as well.
Over the last couple of months I have restructured (renamed) my Maven modules of my project. I discovered some unexpected behavior with respect to how Jenkins treats outdated Maven modules (i.e., they no longer exist in pom.xml files) produced by the build job.
This is depicted in the following screenshot:
As can be seen several modules are skipped (= grey bubble). Sadly, however from the UI, I have no chance to delete them by any means. Deleting the workspace does not help either. Actually, the problem exists in other build jobs as well in case a renaming of one ore more modules was conducted in the pom structures.
The next screenshot shows a German version of the menu options.
Despite I used the latest Jenkins version (2.23), there seems to be no possibility to clean up the ui / modules from this project.
Does anybody have an idea how I can achieve removing this obsolete artifacts without a fresh setup of the whole project or even the complete build server installation.
EDIT-1:
There is an offical issue for that at the Jenkins Project, which seems to be unresolved up to day.
EDIT-2:
I've tried the work arround mentioned in the issue using http://hudson-installation/job/the-project/deleteAllDisabledModules in order to obtain the delete view. However, this page does not exist.
I think this answer from Amedee Van Gasse provides at least a workaround to your problem.
He suggests removing the modules marked as "(übersprungen)" by hand using a Groovy script. His solution also implies why the use of http://hudson-installation/job/the-project/doDeleteAllDisabledModules won't work: The property disabled isn't properly set for the respective modules.
Goto:
http://jenkins-ci/job/<projectname>/<package>$<modulename>/
and click delete.
look at:
http://jenkins-ci/job/<projectname>/modules
It looks like you are in the menu of a build. You first have to go back to the project "Zurück zum Projekt". Afterward you can delete the project (Assuming you have the necessary permissions).
Some things you could try as a last resort:
Delete the job, and then recreate it.
Reinstall Jenkins.
Create a new FreeStyle job and use the same command as you expect developers to use:
mvn clean install
This behaviour is an outstanding bug in the Jenkins Maven Plugin
https://issues.jenkins-ci.org/browse/JENKINS-4561
For me it raises a deeper question of why would you ever want to use a plugin for this functionality. It is a DevOps principle to ensure that the developers use and understand the same techniques as are used to build for release.
After forking OkHttp and then cloning it, I tried to import the project into IntelliJ using Maven.
However, IntelliJ is not resolving the dependencies properly for me. I see errors all over and I have to add the dependencies between each module and external libraries myself.
There must be a proper way to do this, really appreciate any help I can get here.
Edit:
I am putting the screenshots here to explain better
This is one of those dependencies errors I am facing
From this you can see that no dependencies is added automatically
I imported the project from the root folder pom file
If it helps, this is the project I am trying to import OkHttp. I am expecting a much easier way to get the code down and to start work on them.
Sorry for late answer, but maybe it helps someone especially I keep seeing similar problems all the time and had them myself few times. These steps usually works for me and were tested on OkHttp. They are the same like from my comment above but maybe something has been missed:
git clone https://github.com/square/okhttp.git
Download JDK (in my case it's 1.8.0_91 but it shouldn't be so important)
Download Apache Maven (3.3.9 works for me)
Run IntelliJ Idea (tested on 2016.2 Community) and enter "Settings" (Click "Cancel" if a project is loaded automatically)
Find "Maven" and choose downloaded and extracted in step 3
Find "jre" and choose the one downloaded in step 2
Accept changes - "Ok" button
Choose "Open"
And choose pom.xml from root directory
After re-indexing and import everything should work correctly
So I have a maven module (module-A) in IntelliJ. I recently moved some classes from it into another new maven module (module-B) and added a dependency to it. Once I had done this I also modified the signature of a method of one of the moved classes (now in module-B).
I re-imported the poms so that IntelliJ would pick up the dependency changes and ensured all Java imports for the affected files were correct again. Now when I attempt to run my webapp (which depends on the two modules) I get a compile error in a class in module-A calling the modified method of the class in module-B.
The error message is basically saying that that method doesn't exist but believes the old method still exists! I click on the 'make' error and it takes me to the line in a class in module-A calling the modified method...the weird thing is, IntelliJ knows it is fine in the file. i.e. The method is not underlined in red like a compile error would normally be, but the class file name is :(
I compiled it from the command line using 'mvn install' (having also installed module-B) and it is all successful. I have deleted the classes directory in the target of both module-A and module-B and also invalidated IntelliJ's caches and restarted...still happening...any ideas?
I found out that this might help:
File -> Invalidate Caches
Maven Projects -> Reimport should help.
I spent a few hours on this same issue. All of the cleans in the world didn't help.
I deleted my out and target directory in my project and recompiled - that cleared it.
Edit: There is also a magic feature under the file menu: "Invalidate Caches / Restart" This fixes a bunch of "intellij is confused" problems.
Change "Java Compiler" setting in IDEA (User compiler javac in-process) to fix the problem.
Try to mvn clean your projects and mvn install your project B.
The maven integration with intelliJ is kind of buggy when you use the make command directly provided by Intellij. You should directly use the mvn commands, or start them from the maven panel.
I ran across a very similar problem that was driving me insane.
My code would compile fine with the ant task I normally run, but it would not build in IntelliJ, complaining about "Cannot Find Symbol blah blah"
Turns out, you can add "Excluded" files for the compiler. My file somehow got added to that list.
This list is located in File > Settings > Compiler > Excludes (IntelliJ 13)
Following steps should fix this problem :
delete .IntelliJIdea12 / .IdeaIC12 older under c:/user/.../
Invalidate Intelli's cache: File > Invalidate Caches.
This re-indexes your workspace on start-up and also clears your local history. Before you do this, commit or back up all your uncommitted changes.
Once your workspace is back after indexing, do a maven clean install.
when the build is successful, click on Maven Re-imports
This worked for me, I think it should work for others too with a similar problem.
So just stated it up this morning and it's all working!
Last night what I did do was open a new project (intelliJ project) from module-A's and module-B's parent pom and successfully got it to build, possibly doing that and then opening my original project again fixed it somehow...very annoying though
The behavior I see is similar to the one described by the original author.
Error markers show up on the right side of the editor in Intellij 14 and less so in 13.
This happens also if using Scala instead of Java and using SBT instead of Maven.
Also noticed this occurs after the second project is loaded. The first is always fine.
(After much trial and error) Figured it might be caused by Intellij's internal caches becoming somehow corrupt. "Invalidate caches" worked sometime and sometimes did not.
I work with a number of projects using Play! Framework and they use different versions of Scala and lots of dependencies.
I hypothesized the caches become corrupt because the internal key Intellij uses is not good enough to handle situations when the same class, loaded multiple times in different jars, has different signatures, and this results in the editor errors while external builds work fine.
Then the "Changing Ivy Cache Location for sbt projects in IntelliJ IDEA?" post gave the idea to segregate the ivy cache SBT and Intellij use in the hope that the ivy path is part of the internal cache key.
Paul Phillips of TypeSafe provide the "SBT extras" tooling and here I found a way to instruct SBT to use a project based ivy home, cache and SBT boot:
https: //raw.githubusercontent.com/paulp/sbt-extras/master/sbt
declare -r noshare_opts="-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy"
How to configure Intellij
: see http://content.screencast.com/users/SemanticBeeng/folders/Snagit/media/ec8ec491-6d0c-4691-9598-916a63ba65ef/12.02.2014-08.59.png
Then did the same for the external SBT build to work in sync
: see http://content.screencast.com/users/SemanticBeeng/folders/Snagit/media/dcb287c4-200f-47f3-a937-42865675a22b/12.02.2014-09.01.png
Finally got rid of the user home based .ivy2 and all the contents.
To be sure Intellij does not use this folder I made it readonly.
This was a mistake. Intellij seems to silently fail resolve dependencies if you do this.
This solved the errors and believe they will not come back. :-)
If Intellij guys hear this: please test your releases (Scala, SBT, editor) with all the Play Framework templates from TypeSafe. The problem becomes apparent quickly this way.
I just had a similar issue that was driving me insane. I had done all the other things mentioned in the answers above because I have used Intellij forever, but none worked. In the end I found out that in the maven projects portion of Intellij, one of my modules had been marked "ignore" a simple unignore command from the context menu did the trick.
In my case, I had manually marked a directory as "Test Sources Root" but IDEA marked it on a parent Maven project. Unmarking it in File->Project structure...->Modules fixed the problem.
This could happen if you are using different version of java while building outside IntelljJ. My IntelliJ had java10 and I was using java8 while building at terminal. Changing java version to IntelliJ fixed this issue for me.
I had a very similar behavior. Running (Scala-)tests would always fail due to errors in unrelated java classes during the 'make' step.
It turned out, I had included a 'global' SDK library that collided with one of the dependencies from the project. A proper helpful error message only showed up after I deleted the 'make' step from the test.
I then deleted the duplicate library, re-added the make step to the test and everything is now working fine.
I ran into this problem today after upgrading from 12 to 13.
Later I fixed issue as I used the same name for Project and Module and looks Intellij allows this but cannot handle it correctly.
No idea why setting will impact the compilation, although there is no error in java editor. Should be a bug in version 13.
I was facing a similar issue after upgrading from IntelliJ 12 to 13. After multiple uninstalls and re-installs (of multiple intelliJ versions), numerous cleans and .m2 repository clearing, I finally figured out what my issue was.
In my intelliJ settings, the repositories mentioned in my main POM file could not be connected to. this was in turn due and alternate repository that was mentioned as a part of my pom file.
Once the POM was made to point to the correct repository, all my classes had their compilation issues resolved.
To check if your repositories are being connected to, go to File -> Settings -> Maven -> Repositories
Here, your indexed maven repositories should be connected to successfully. If they are not, then intelliJ will not be able to resolve most 3rd party and module dependencies.
I'm embarrassed to say, but we also had this problem, but it was due to a mistake in our package name.
When creating the packages for a new project I accidentally created a package called "org.package".
My project then had a directory structure like:
/src/main/java/org.package/
Which caused all sorts of havoc with IntilliJ.
Once the correct folder structure was created on the file system, IntelliJ worked great.
/src/main/java/org/package/
Note the difference in /org.package/ vs /org/package/
The fix was i made it javac instead of Ajc and i put 1.8 of course according to your jdk version.
for some reason when i invalidate and restart intellij it was set to be the default !
my version is
This happened to me...what fixed it was realising there was an extra main.iml file in the source directory. Deleting that instantly made the compile errors go away.
None of the above answers worked for me.
In my case, I had to finally create an explicit Maven Run Configuration for the module (with Command Line as "clean install") and then run it.
It is in Run > Edit Configurations
close the project
go-to the project folder and delete idea project file and .iws file
run mvn idea:idea
restart the project.
seems idea keeping the old project dependencies without cleaning even though we run file -> invalidate caches
Setting the proper Java SDK solves the issue
Right click on the project and select "Open Module Settings"
Check if you have the right Java SDK under platform settings
Check the SDK under Modules
Rebuild the project from "Build" menu
Delete the installation directory.
Remove the following directories:
~/.config/JetBrains/
~/.cache/JetBrains/
~/.local/share/JetBrains/
This will remove each and every configuration plus installation of jetbrains tools, be it IDEA, goland,etc.
Now install everything from scratch.
That's the only way it worked for me
We started a Web Project in Eclipse 3.2 a ways back and we've since upgraded to Eclipse 3.4 but now the Project has the error:
"This project needs to migrate WTP metadata"
We've tried right-clicking and doing the "quick-fix" which is in fact to Migrate WTP Metadata. Unfortunately nothing happens and the error remains.
We can delete that error from the Problems and everything works as it should, however, every time we re-import the project from source control, the error re-appears. Any ideas on how to permanently get rid of this error or how to ACTUALLY migrate WTP metadata?
UPDATE: Everyone, please vote on the answer that works for you rather than adding your own answer that references a previous person's answer.
The above solution works fine but it creeps up again and again. An easier solution is to right click on the concerned project in Eclipse and choose Validate.
For me, none of these worked.
The solution for me was deleting the following file while Eclipse was stopped:
/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/myprojectname/.markers
Here is another thing you could try, only this worked for me :(
Go to project properties > Project facets > there tick "Java" and "Utility Module" ... apply
This works if your project is referenced from other projects ..otherwise you could play with those options ...see which one works for you.
try adding this line in the .project file
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
Or refer to this discussion: for instance, make sure there is no duplicate entries in .sessions/org.eclipse.wst.common.component
As noted in the comment by larf311, the actual answer in this instance was:
delete the ".settings/org.eclipse.wst.common.component" file.
Simple. ;)
Removing the .markers file resolved this issue for me. I would upvote that solution, except that I don't have the "reputation" to do so. :(
This just means that the project configuration of wtp are old, or there's a conflict between modules. go to Projct ->properties -> project facets. Then click the following: dynamic web project ver 2.5, java 5 or 6 and javascript toolkit (not sure if its necessary). You will notice that there have been changes to .settings file. check in the new changes, and everytime someone checks out the project it should be okay
Delete the project, and check it out of source control
I use SVN and every time I checkout the project in a new computer I have this problem, the way I fixed is to copy the .settings from the original location to the new folder of the project, of course use validation
Use maven ... mvn eclipse:clean ... mvn eclipse:eclipse ... reimport the project
In the Properties for the project I selected Project Facets. None were selected, but there was a message on the right hand side indicating that Java 1.3 or later needed to be selected. I selected Java 6 and then after closing the Properties window I still had to do a "Validate". The problem finally disappeared.