I'm working on a Gradle project in VS Code, but my dependencies aren't resolved. It does not complain in the build.gradle file, however the imports simply don't work inside the source files.
However I know for sure that the import statements are correct since the code is cloned and unmodified from a repository and I know that the code works in this state. The other creator did however use IntelliJ.
Someone has an idea why this does not work? I've got all kinds of gradle extensions installed.
Related
I'm running into a bit of a strange issue with eclipse 4.18 that I'm hoping someone can help me with. My project is a jetty webapp that does some communication with an external server over FTP. I'm using mockftpserver (https://mockftpserver.org/) to assist with unit testing the code that needs to communicate with the FTP server.
I have the library dependency defined in the pom as
<dependency>
<groupId>org.mockftpserver</groupId>
<artifactId>MockFtpServer</artifactId>
<version>3.0.0</version>
<scope>test</scope>
</dependency>
I then have an import defined in my test class like
package my.project.test;
import org.mockftpserver.fake.FakeFtpServer;
public class TestGuiceModule extends GuiceModule {
}
Nothing too exotic going on, and maven seems to be able to run the compile. Eclipse however does not seem to be able to see the library. I have a bunch of errors along the lines of
The import org.mockftpserver cannot be resolved.
I double checked the build path and I can see the library listed under 'Maven Dependencies' and the package structure of the jar matches my import statement. Even stranger, I have other 'test' scoped dependencies in the pom.xml and eclipse is detecting those just fine. I'm at a bit of a loss as to why it is having an issue with this one particular library. Any suggestions on what I could do to track this down?
I was eventually able to solve this by deleting my settings folder and .project file and reimporting the project (see: Eclipse throws NullPointerException during Maven update).
The project was originally created in an older version of eclipse, but I thought I would be ok since I was checking out a fresh copy from the git repo. Apparently something must have gotten checked in that the newer version of eclipse didn't like.
I'm writing an InteliJ plugin, and one of the things it is required to do is add a maven dependency to a project if it doesn't exist already. I've found a unit test in InteliJ that does what I want to do, which serves as an example, but I can't figure out how to access the org.jetbrains.idea.maven.dom in my project.
I tried following the instructions here, and that meant that auto-complete etc. worked and I was able to write the code, but when I tried to compile it, I got:
error: package org.jetbrains.idea.maven.dom does not exist
import org.jetbrains.idea.maven.dom.MavenDomUtil;
Please declare dependency on Maven plugin as described here http://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_dependencies.html
I'm having a new problem this morning with my project (it worked fine on Friday). Eclipse seems to be having trouble figuring out it's module / class path, and nothing I'm trying seems to affect it. I'm using the following Eclipse configuration:
Version: 2019-03 M1 (4.11.0 M1)
Build id: 20190117-2133
Oracle JDK 10.0.2
My project is a Java Maven multi-module (those are maven modules, not java modules) project, but does not define any java modules itself (we haven't converted it yet). When attempting to compile it, eclipse throws up its hands and sends the message
"The package java.sql is accessible from more than one module: <unnamed>, java.sql".
While, on the surface, this seems helpful, I cannot find another module that defines the java.sql package, and the only instance of a class from the package (e.g.: java.sql.ResultSet) exists within the JDK system supplied library. This also happens with the javax.xml package with the same error.
I've attempted closing and re-opening eclipse, performing a clean, and a maven update project for everything, to no avail. I've inspected the eclipse .log file, and there's nothing useful in there. Is there anyway to figure out what other module Eclipse thinks it's pulling that package from?
My next step is to delete the entire project and re-import it.
UPDATE: I think I may have found the offender... there's a dependency that declares a couple of classes into the java.sql package, and that's probably borking things up. The specific JAR is net.sourceforge.hatbox:hatbox:1.0.b8, and is a transitive dependency of the com.h2database:h2:1.4.197 jar. Is there any way to tell eclipse to ignore the package from that JAR?
Update 2: Build Path:
I'm not sure I count this as a true solution, but I was able to find a workaround to my problem. I downgraded eclipse from the installed version listed in the question (4.11.0) to the base photon install (4.8.0), and I can now compile and work again.
I'm having some trouble importing my project from build.gradle file.
It's not able to find classes from hamcrest-core-1.3.jar.
gradle clean build
runs successfully on terminal.
My environment is
Intellij 2016.3.1
Gradle 2.14.1
It was able to resolve the reference one time but it went away on restart. When it was able to resolve hamcrest, it later failed to resolve pigunit jar. I got NoSuchMethodError (class was loaded from wrong jar) also once.
Invalidate Cache also didn't work.
I tried importing the project from scratch multiple times.
Please let me know if any other information is needed.
For some reason org.hamcrest.CoreMatchers loads CoreMatchers from
mockito-all-1.10.19.jar instead of hamcrest-core-1.3.jar.I played around with the order of these two jars in the modules libraries.
Please refer to the screenshot below.
So, I have a fairly basic Gradle project. Everything works fine through Gradle using either "test" or "build". However, when I go to actually import this project into IntelliJ, everything seems to be added as expected except none of the dependencies make it into the build process. The Gradle tool window clearly lists the dependencies used and such, but actually trying to use these ends up with none of the packages being found. I've tried resyncing it, cleaning and rebuilding, etc. But it always ends up with none of the dependencies actually being there in IntelliJ's build process. Building from Gradle is fine.
How can I resolve this!? I tried using the "idea" plugin with the "ideaModule" task. This puts all the dependencies into there as I expect, but also overwrites all of the changes that I made (such as excluded/included source files)... And I'd need to make sure to manually run it any time I change dependencies
How can I get IntelliJ to actually recognize and build with the dependencies in the Gradle build file?