I'm facing a rather odd issue which is I've set the necessary dependencies a mentioned in Spring documentation but once I add the #EnableConfigServer annotation Eclipse says it cannot be resolved. I checked the Maven dependencies folder and the necessary Spring Cloud Config *.jars were there. I tried deleting .m2 directory and rebuilding project nothing seemed to work. Any idea on this would be great.
Looks like this is the pure eclipse issue.
Try cleaning the project once and check.
Related
Using maven version 3.6.3 and JDK version "openjdk-17"
I've tried using Maven's dependencies so I could use the xstream library in my project. Following a guide I added com.thoughtworks.xstream to my pom.xml file:
I then tried to use xstream, but intellij couldn't resolve "XStream" even though it seems to work for JavaFX just fine. This code does not compile.
EDIT: I loaded a new project, where I used, what I believe to be, up to date versions. Maven 3.8.1, the latest intellij version, and everything else (JDK, openjfx) at version 17.0.2 yet when I try to use "XStream" in my project code (after reloading the maven project) it says "Cannot resolve symbol XStream"
Edit 2:
I added junit to the dependencies, it works. I add Gson to the dependencies. It doesn't work.
I figured out that in the "modules-info.java" file, "requires xstream" is needed. That is all
One of the following may solve your problem:
These are based on my previous experiences.
because may be auto import disabled. re Import maven project.(intellij: press Ctrl+Shift+A then actions - input "reload" find "Reload All Maven Projects").
in my experience, sometimes it does happen that the dependency is not fully received. remove xstream special version folder from .m2 (com->thoughtworks->xstream) and repeat step 1.
maybe repository not valid. check repository source in file settings.xml in .m2 (if exist) or replace to other source.
invalid cache and restart (intellij: file-> invalid caches/restart). This has solved my problem several times.
Your access to the site or repository may be closed. check network policy or use vpn (Poor probability)
So I've created a library which is not released as not tested, so I'm importing it manually using the Project structure to test it out, just like explained in here.
Here's a snapshot as well:
And it even seems that it is imported in the intellij as it is shown in the editor, as well as I can navigate to its definition.
But unfortunately the build fails see this:
And i tried changing the scoped of the dependency, but nothing worked.
How could I solve this, any help would be appreciated 😊.
Finally i got it working by removing external dependencies I had added manually from Intellij IDEA's Project structure.
And add the external dependencies by using the gradle:
compile files('path/to/the/jar/my-plugin.main.jar')
This file() uses project's folder as root, then we can navigate through that.
Issue may have been occured because of using both gradle and intellij project management at the same time.
Hopefully if somebody having same issue, he/she may fix it using gradle.
I am using VS Code to compile and debug my Spring Boot Java project with help of Gradle. I recently added Redis dependency to my project. The project compiles in Eclipse, but throws error in VS Code.
I'm not sure this answer becomes helpful to you or not but,
Normally VS code is not comes with default configurational setting of spring boot.
Spring boot project not able to run without dependencies.
So Because of your project not able to find relevant dependencies so it is generate this errors.
It solved using download plugin of vscode-spring-initializer and / or others.
If you need more detail then,
Try recognize your spring boot project in different IDE like IntelliJ or Eclipes. You see that there is some extra files are there like following,
External Libraries - which handle by maven kind of tool for load dependency.
.iml file in intellij : File which handle development module(contain plugins, module and other details).
This files are not existing there so that it generate issue.(That are different based on IDE)
If you have recently modified the pom.xml or build.gradle config file, you need right click on pom.xml or build.gradle file and then run the menu "Update project configuration" to force the language server to update the project configuration/classpath. Otherwise, the java language server cannot recognize the newly added dependency.
I'm trying to get the Eclipse STS plugin to validate my spring bean config files, however I'm getting a class not found exception for every class that is outside of the current project (but is still in a dependent project obviously), There's an option to "Update Maven Dependencies" in the Spring Tools menu but that fails due to it not being a Maven project.
Is there a way to tell the plugin to look at the gradle dependencies ?
Thanks.
Try
apply plugin: 'eclipse-wtp'
Then try
gradle eclipseClean
gradle eclipse
on your project directory. It should erase any eclipse configuration you have on your project and regenerate everything (.classpath, war generation settings) in order to match your gradle dependencies. Beware that this is quite intrusive, as it wipes out your eclipse manual configuration (it is actually a gradle coup d'état to your eclipse configuration :P)
Thanks for the advice, ended up moving to Kepler instead of Juno which seemed to solve the issue anyway, so most likely was something to do with my plugins not working correctly.
I have a multi-module project in Eclipse, which works fine.
Now I want to work with IntelliJ (I have 12.1), so I imported project to IntelliJ, and have configured below things in it:
All modules
configured all lib (.jar) files with each project where I need (by adding lib)
have configured module dependencies
have configured tomcat7 with them, and added it in dependency of module too
Everything looks OK, but when I run the project it shows:
Caused by: java.lang.NoClassDefFoundError: org/xx/yyy/zzzz
Although org.xx.yyy.zzzz class exist in model module, which is already added to web module (my project has 2 modules web and model), and also scope of dependency is set to provided.
What should I try to resolve this problem? Help me if I am missing something.
Finally I got the answer.
I kept the scope to provided, and Added model module to artifacts and it worked. :)