Intelij idea in project view under external libraries shows sbt dependencies which doesn't exist anymore for the specific project. I had a dependency in project, then I removed it, refreshed the project dependencies and still see it in project view.
It can't be transitive dependency from another lib, because I checked with sbt-dependency-graph plugin that dependecy was not present in output after removing it.
I also can browse classes from that removed dependency.
How to tell Intelij Idea not to show removed dependecies in project view?
This is a problem I am also phasing with IntelliJ. How I deal with it: I manually go to project properties, select the library and manually remove it.
Click on the project structure menu.
Go to libraries.
Find the one it shouldn't be there. Right click, select delete.
Give IntelliJ some time to refresh (it can get slow for few minutes).
Related
Eclipse has a good feature that I can link to other project in the same workspace as a dependency specified in pom.xml. Is it possible for me to do the same in intellij ?
Of-course you can do, I am doing a sbt project having dependencies of multiple projects. It will be easy to debug if you attach the dependent projects. It can be achieved easily by holding the ctrl and mouse clicking on any of the methods from the other projects in your current project. It will open the compiled code of the same. Then to the right top corner you can find Choose Sources... . Click that and in the explorer go to your dependency project and select the source. There you can see other project in the same workspace.
I used maven a lot before, now, I want to investigate about gradle, but it seems gradle dont give me a good first impression.
When I config the repo, and build the project, intellij idea show me build successful, however, I cannot see the dependency from the project view, I have no idea why, I try to create several projects with almost same configuration, some of them will show dependency, some of them not, I have no idea why. Sometimes, the dependency will come out suddenly, and actually, I found gradle already download those dependnecy into the catch folder, but I have no idea why intellij cannot show it and use it.
Can someome show me how to fight with gradle and intellij?
Br,
Tim
I'm working on multiple Gradle projects with internal and external dependencies, and so far I am happy that thanks to Gradle's dependency management I can modify a library project without affecting every application that uses the library.
When I need to modify a library project and test it using an application project that uses it, I need to do the following,
Modify the library project and commit to SCM
Trigger CI to build the library project and push it to my Gradle repository
Update the application project's build.properties to refer to the new version of library project
Iterate the above steps until everything works and there is no bug
So it became quite combersome now. Can I configure IntelliJ IDEA so that
All my Gradle projects are in one window, like the screenshot below, which is Twitter's Finagle imported using its pom.xml. Sadly IntelliJ's JetGradle plugin doesn't seem to understand Gradle subprojects.
When build.properties's dependencies are my subprojects, read dependency from local snapshot, otherwise download them from the Gradle repository
Thanks.
If you want to open all projects in a single IDEA window, you'll have to aggregate them into a multi-project build, at least until IDEA 13 hits the market. Before IDEA 13, it's better to use Gradle's IDEA integration. Once you have a multi-project build, all you need to do is to add allprojects { apply plugin: "idea" } to the root build script, run gradle (cleanIdea) idea, then open the generated IDEA project.
Currently in IntelliJ IDEA 2019.2 you can add the gradle subprojects like so
Open Gradle Tool Window via View > Tool Windows > Gradle menu
Click on "Link Gradle Project" button (the plus sign)
Select the build.gradle file corresponding to the subproject
Go to File > Project Structure > Modules > NameOfSubproject
Navigate to main/java and click on Mark as: Sources
Mark the main/resources as Resources
Restart IntelliJ IDEA
The sources of the subproject will be recognized by IntelliJ and you can use Navigate Class action for the classes in the subproject
I have an Android project that uses some external libraries. The problem is that within intelliJ I can build the project and it runs fine, but the editor marks classes that come from the jars as unknown.
I've added the jars to the correct module (project structure -> module -> dependency) independently, from the libs directory, as classes, jar directory, etc. I've also tried to add them using project settings -> add libs, attach them to the module. But to no avail. I also tried to add them within the project explorer with right-click -> add library. Nothing works.
It was all fine before but now after a horrible IntelliJ crash it no longer works. This has happened to me twice now. And I loose a lot of time trying to fix this. Am I fighting an intelliJ bug here?
File | Invalidate Caches is the first thing to try in similar cases.
I have 2 completely separate projects where one depends on the other. I've very recently mavenized the main project but can mavenise the dependency if absolutely necessary.
Originally these were Netbeans projects, with the main project having several modules. What I liked is that I could declare the dependency as a dependent project. This allowed me to use the most recent code as it changes a lot (the project is in its infancy). NetBeans would put the dependent project on the classpath when running, and build a jar in the /dist directory when doing a clean and build.
Now that the main project is in maven, I can't do this anymore. The only alternative I've found was to manually copy it into the project repository, but that removes a lot of automation and ease of use. Every time I wanted to test a change I would have to rebuild the dependency, move it to the buried project repository folder, rename it appropiatly, switch back to NetBeans, then run. This is vs clicking run and everything being done automatically.
Maybe I'm just lazy, but is there an easy way to do this?
I have 2 completely separate projects where one depends on the other. I've very recently mavenized the main project but can mavenize the dependency if absolutely necessary.
Mavenizing the dependent project would help a lot. Like Eclipse or IntelliJ, NetBeans supports something Eclipse calls Workspace dependency resolution: if a project A depends on a project B and you open both of them in your IDE, A can be configured to depend on B sources instead of B jar (and any change would become immediately visible).
mavenizing the depedency project is the best option.
Alternatively you might get away with using a system scope dependency which points to the dependency project's dist/ folder jar artifact.