So, I believe I am missing something with Intellij.
Sometimes I am able to debug my code, other times I am not.
I am not sure why? I know I am using Gradle to pull my dependencies and to run through some tasks in my build.gradle file. Is that building my project in a different directory than what intellij is looking for when debugging locally?
My Question is How can I consistently use the Run, Debugg tools in intellij and gradle at the same time?
Btw: I followed these links to set my project to auto-compile:
https://www.jetbrains.com/help/idea/compiler.html
and
https://www.jetbrains.com/help/idea/problems-tool-window.html
But I find IntelliJ's site to be really confusing and outdated in lots of places.
So I closed out of the project and reimported the project, making sure to overwrite the .iml file.
That seemed to work. Hope this helped somebody. I am still confused why I had to do this though feel free to answer if you have any clues.
Related
I've come back to project after a long diversion, and upgraded tooling. This means Netbeans 12.5, Java 17, Gradle 7.3… at least allegedly. For some reason, despite setting the Gradle version to 7.3, it appears to build with 7.0.
Per the image below, setting the Gradle version to 7.3 doesn't seem to be picked up. (That is immediately after hitting Apply.) It still tries to build with 7.0. And – for some indeterminate reason – it can't.
Restarts don't help; I can't get the configuration to be picked up. (Searches for reference to similar issues provide 5-year-old answers that are no longer relevant.) I've even tried deleting the 7.0 distribution; to no avail, it comes right back.
Can anyone provide guidance on getting this to work properly?
Netbeans 12.6 fully supports Java 17 and Gradle 7.3. Gonfiguring the Gradle wrapper for 7.3 gets picked up correctly, eliminating all errors I was experiencing.
Don't bother with gradle in Netbeans. It's a horrible, buggy disaster and 12.6 just seems to want to up the ante.
Netbeans does NOT support gradle in a meaningful way for normal users.
You now get complex multi-projects whether you want them or not.
When creating a Java Application you don't get a choice at what the Main class is called. It will be App with app.java and you will like it.
If you try to rename app.java to something useful. It will not change "Class App" to "Class Useful" it will instead change it to "ClassUsefulp". It will not rename the test file and you will be left with several syntax errors that you can have fun cleaning up.
No, you cannot rename the subproject itself. That will continue to be the extremely descriptive and useful "app" subproject. The IDE will not provide you a way to rename that.
There is no meaningful, intuitive way to create/delete/modify subprojects.
If your gradle version is somehow out of sync there is still no useful way to reset/recreate the gradle wrapper other than creating a whole new project and moving your source code over to the new project.
Oh, so you gave in and accepted the multi-project structure. You noticed that if you go through the multi-project creator GUI then you can create multiple subprojects. Yeah, good luck with that. They won't have gradle build.scripts or wrappers. You won't be able to build your awesome creation.
Want to use command line arguments? Forget it. There is no "run" element in the project properties. You cannot create different run configurations.
Want dependencies? Or any other project configuration? It's all manual editing of gradle files. There's no GUI to assist non-gradle-wizards.
Yeah. you can probably work around a lot of this by dropping to a command line shell and editing the gradle scripts/files manually and running gradle commands manually. A) you're going to need to be a gradle wizard, and B) why are you using an IDE in the first place? you've got gradle, you've got vi available. Bathe in the nostalgia because you'll have to anyways.
Do you like the idea of gradle? Do you use Netbeans? Stick with Ant, or Maven if you need external dependencies; you'll thank me later.
I've been having a problem with NetBeans plugin development. I was writing a plugin and was having some trouble with it, so I deleted the plugin folder and started over again. — It's worth noting at this point that I am using a Module Suite, not just a standalone Module.
That all worked fine, until I tried to test another module from the same suite. When I ran the suite and tried to open Tools>Plugins it keeps popping up an error message that said could not find localizing bundle [path to Bundle.properties]
My question is this:
How do I go about clearing the cache of the missing modules so I can test in peace again?
Thanks,
-tlf
The solution to fix this is very simple.
Open the 'files' tab/window/pane/whatever in NetBeans (or open the project in your file browser of choice).
Navigate to your Module.
NOTE: If you are using a Module Suite, navigate to that instead. All further instructions are the same.
Open the build folder.
For precise adjustment, open the testuserdir folder, and tweak away.
To simply reset the test IDE, delete the testuserdir entirely because you, like me, have no idea what to tweak to set what you want, then restart NetBeans (yes you have to, sorry), and run your project!
-tlf
P.S. I want to mention, to prevent confusion, that this question was posted with the "Answer your own question" box checked.
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
I have an urgent and puzzling problem with Eclipse. My system crashed on itself this morning, and after I rebooted, I can run a program perfectly within Eclipse, by right-click on the Java file and choose 'Run as Java Application'. However, after I make the project into a .jar file, and execute that, the behavior of the program simply does not reflect what the code does.
I have checked that I am compiling the right project, and running the same code from the same project within Eclipse does not cause any problem. And btw, I am using a plug-in called fat jar to compile the .jar file, if that makes any difference. I have used the same plug-in numerous times before to compile the very same project, and never had any problem.
Does anyone know what might be causing this weird/inconsistent behavior of Eclipse? Do I need to re-install Eclipse and fat jar to fix this? Thanks.
My usual procedure for strange things like this is,
A) Clean and build again i.e. Project -> Clean
B) (not so eclipse related) Since I am usually using a build tool, do the same thing from the tool to ensure its eclipse.
C) If it gets really bad, I'll start a new eclipse workspace and try from there.
D) Iff I had just installed a new plugin before things went strange I'd think about reinstalling
It sounds extremely strange :)
But Eclipse can, and has, acted strange before. I have had problems in both Java, C++ and PHP development during the years that could only be fixed with a resinstall of Eclipse. You could probably fix it by digging around, but the time it takes to find and fix these types of strange problems in Eclipse is simply not worth it.
Good luck!
Please try to Reset Perspective first (Before reinstall eclipse)
Window->Reset Perspective.
I've run accorss a really weird issue, in eclipse I've got a codebase I've been working on for a couple of weeks and it's working fine. I did an svn update and all of a sudden one of my classes doesn't compile because it can't resolve an enum which is in the same namespace to a type.
I've checked the Java version and I'm running under Java 6 so enums should be supported.
Also it worked up till yesterday and now it doesn't.
Has anyone else seen this kind of behaviour? I've reloaded eclipse but beyond that I dont know where to start diagnosing it.
If it does say "Step cannot be resolved to a type", just try and clean the project (Project -> Clean). Eclipse gets confused sometimes, and a clean usually helps.
I had this recently. Turned out that someone had committed some jars that conflicted (had a previous build in) and put on the build path. Check recent commits to see if that's the problem, or to see what could have caused it.
However I would definitely do a build clean first within Eclipse, and see if ANT/Maven is affected (you do have such build scripts I assume).
Weird idea, but could it be that eclipse is trying to compile your class using a 1.4.2 compiler and isn't recognizing the enum?
I unloaded the project and reloaded it and it just works... No idea what the origianl issue was...