As per https://www.jetbrains.com/idea/help/compiler-excludes.html, I excluded one of the java class which was used only for some scripting purposes. While I am running some Junit whose configuration has a before launch task "Make", it is trying to make the project and showing errors in this excluded java class. How is it possible? Is it a bug in my intellij idea ultimate mac version 14.1.4 build 1532? Or am I missing something here?
Strangely, I excluded two classes and this problem is coming in only one of them, i.e. the second excluded file is indeed being excluded and not showing compilation failure during MAKE.
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'm attempting to use VS Code to run some unit tests in my solution. When I do, I get the following error:
java.lang.NoSuchMethodError: 'org.mockito.internal.progress.MockingProgress org.mockito.internal.progress.ThreadSafeMockingProgress.mockingProgress()'
at org.mockito.ArgumentMatchers.reportMatcher(ArgumentMatchers.java:1330)
at org.mockito.ArgumentMatchers.eq(ArgumentMatchers.java:908)
When I run it using maven, I do not get said error. I have two theories. Either the IDE's test runner pulls in an older version of mockito or one of my test dependencies has some older mockito code embedded in it and somehow I'm getting lucky when running it from maven.
My thought was to print out the class path and see if there was anything unusual. But it appears that the code samples1 I've found on the Internet doesn't seem to work in Java 11. I'm guessing this is due to things changing with the introduction of modules.
So how can I discover what all jars are on my classpath in Java 11 to resolve a duplicate class issue?
Specs: Linux Mint 18.3, Eclipse 2019-06, Groovy 2.5.8, Java 11
I started a Groovy project, and created a package "test" under the "source folder". Under test I put a file, "test.groovy". This file looks like this:
package test
It's got a horrid white-cross-in-a-red-box. The error message is:
Multiple markers at this line:
- The type groovy.lang.MetaClass cannot be resolved. It is indirectly referenced from required .class files
- The type groovy.lang.GroovyObject cannot be resolved. It is indirectly referenced from required .class files
I have tried multiple strategies: restarting Eclipse, cleaning the project, removing and putting back the JRM for the project. Nothing doing.
There are a few cases of this error when I Google, but mostly they appear to be from years and years ago, on an active bug list, so I presume resolved.
Any ideas what's going wrong?
NB according to my notes, I have had this problem before a couple of times with Gradle projects, and the problem was resolved by going Gradle --> Refresh for the project. But this is a (pure) Groovy project, not Gradle, and the "Refresh" option is not available.
By the way, when I look at this problem in the "Problems" the error type is said to be "Java Problem".
later
It's been suggested that the cause might be Java 11. This is an interesting idea. However, Groovy 2.5.x in itself is not incompatible with Java 11. Firstly, I have no problem running this at the CLI, and no problem with Eclipse-based Gradle projects configured with Java 11 and Groovy 2.5.x, using Groovy as the language of the app and testing files. Crucially, of course, the Gradle wrapper chooses its own Groovy version, and in such circs the user chooses their own Groovy version for their executables as a dependency in build.gradle. So Eclipse Groovy-handling is mercifully "bypassed".
I am thus beginning to suspect that the Groovy-Eclipse add-in may be the culprit. Amazingly enough, and I was surprised by this, I downloaded and set up the 2019-12 Eclipse package, completely separately, and tried to create a Groovy project in it. Even after several attempts to install both the "release" and "snapshot" versions of Groovy-Eclipse for this version of Eclipse (i.e. here), I cannot start the simplest of Groovy projects in that IDE.
So my suspicions are circling around this theory that Groovy-Eclipse is unable to work properly with Java 11. Only problem is that you might expect to find such a bug as one of the issues, but there is nothing.
Add "requires org.codehaus.groovy;" to your module-info.java
I am using sca-maven-plugin to scan a multi module maven project. Unfortunately I ran into the the following warning while executing translate
[warning]: The following references to java functions could not be
resolved. These functions may be part of classes that could not be
found, or there may be a type error at the call site of the given
function relative to the function declaration. Please ensure the java
source code can be compiled by a java compiler.
The code can be compiled by a java compiler, which leads me to believe that something is wrong with the classpath. Despite this I remain unconvinced due to the fact that as I understand it Maven handles the classpath and passes it to sourceanalyzer. How do I solve the issue?
Check the maven compiler plugin you are using . May be you are using some code which compiles with the higher version of java.
Also makes sure all the dependencies are added properly and the jars are apart of classpath.
Please share your pom.xml
I think I'm making a simple mistake here, but I can't get Frege to find any classes outside of the local Eclipse project.
I have a working non-trivial Java project (that's not mine), that I do not want to modify. I want to have a new clean Frege enabled project that makes use of classes from the original project.
I tried marking the original project as a dependency of my Frege project, and I tried packaging the original project into a JAR, and listing the JAR as an external dependency of the Frege project. In both cases, a Java file in the Frege project can access the classes, but the Frege compiler says "class org.foo.bar.Class is not a known Java class". This seems like a bug, but I am not confident that I have not missed a simple configuration step.
I have not tried setting arguments in the project configuration as I wouldn't know what to set.
I did quickly discover that I can make a new Java file in the Frege project with a blank subclass of whatever class I need and use that in a Frege file. I have successfully compiled and run a simple program like this. The program just makes a new object, gets a field, and prints the correct value, so I believe my Frege is installed and working properly.
More info:
Eclipse Luna 4.4.0
Java 7
No Maven
Official eclipse-ferge plugin installed through Eclipse
It should be enough to have your library listed in the build path and under "Referenced Libraries". Your recent comment indicates that the compiler does indeed find the class in question.
However, when you have an open editor tab it will not take notice of changed dependencies. Also, especially in recent eclipse versions I have observed that resolved error markers are sometimes not cleaned up correctly.
Please close the editor tab that has the false errors shown, and reopen it.