I'm getting an error in eclipse "configure build path" for maven libraries which I have imported from maven.
And after cleaning the .M2 repositories of all libraries, updating the project, mvn installing and any thing else I could think of I still get these errors:
1 - Configure build path
2 - No class exist eclipse keeps sugesting that I use another annotation for EnableWebSecurity even tough its in the the build path...
Please help
There where two issues
1 - As stated by #howlger I needed into insert maven compiler for version 11 of java...
<properties><maven.compiler.source>11</maven.compiler.source><maven.compiler.target>11</maven.compiler.target></properties>
2- Wrong dependency, I was using a diferent version for dependency. I used spring-core-security and needed to use spring-security-web-core
Thank you #howlger
Related
I'm using IntelliJ IDEA Community 2020.2.3.
My project is built around Kotlin 1.3.30 and Java 11.
I've upgraded one of my dependecy to java 11 too, and after that, the IDE shows the dependency under "External Libraries", it build the app without errors, Maven build it from terminal without error, but the IDE shows unresolved references on each occurrency of the classes, functions and imports of that library.
I already tried to empty the cache or deleting idea files and importing again the project, but none of those worked.
Any tips?
You can use CTRL+SHIFT+A and look for Load Maven Changes or CTRL+SHIRT+O to do the same thing
I am trying to open this module in Intellij:
https://github.com/eugenp/tutorials/tree/master/javaxval
The steps followed by me:
Go to required directory javaxval/ in my local and
mvn clean install.
Open the pom.xml inside javaxval/ and open it as a project.
But Intellij is not syncing with the libraries mentioned in pom.xml as I can see in libraries section in Project Structure settings. Also, because of that, I can see lot of compilation errors.
Any idea what is the issue I am facing and how can I fix it?
This project imports and builds fine in IntelliJ IDEA 2019.2.2 version using the bundled Maven 3.6.1 for importing and JDK 1.8.
If it doesn't import/build for you, perform the diagnostics and check the logs as described in this answer. Make sure the parent pom file is present in the directory tree on your disk.
I have an issue with my Eclipse Neon configuration on my maven project. The issue that appears many times is the following The superclass "java.servlet.http.HttpServlet" was not found on the java build path. I know there were few posts about that and know also that there is two solutions. The first one is to add a Tomcat server on runtime and the second one is to add servlet dependency in the pom.xml.
As it's an SVN project, the depedency was already in it and anyone in my team has a Tomcat configured on runtime but the project is building well on their eclipse.
Any idea ?
The problem was that I had some errors when I built the project for the first time. The solution was to empty the m2 folder which is the local maven repository, then clean and build and it works.
You can also resolve this issue by Updating the Maven dependencies in your project. You can do this by
Right click on the project -> Maven -> Update Project
I cloned one of the open source git repositories and was trying to import it as maven project in eclipse. After I imported everything as a maven project, whole package is getting messed up. See the below error:
How can I fix this issue so that I can build it on my local box? I cloned the same git repository locally on my desktop.
I am using eclipse version:
Eclipse IDE for Java Developers
Version: Luna Service Release 1a (4.4.1)
Build id: 20150109-0600
Steps I have tried already:
I have already tried maven->update project.
I have also tried removing and adding it again.
I tried mvn clean install both on command line and eclipse, they are successful as well.
Can anyone help me with this? If needed, you can also clone it and try importing it to see whether it works for you or not.
The root of your problem is that the build section of the pom.xml for that project specifies:
<sourceDirectory>./src</sourceDirectory>
Eclipse uses the sourceDirectory tag to tell it where the root of the main sources are. If you change that to ./src/main/java, then right-click on the project > Maven > Update Project... and click Ok (I had to do this twice) it will fix the Eclipse classpath so Eclipse can build the project. You can then revert the pom back to the head revision and so long as you don't run Update Project again it should continue to build.
I'm unclear on why that project specifies a non-standard source directory but uses the standard Maven layout, but this should at least get you into a working state within Eclipse.
I'm expiriencing multiple compilation errors in my project, most of the code is in red, but the strange(or not) thing is that while building the project with maven everything is build successfully and the war is assemled as it should be.
The thing is that auto suggest is not working because code is not compiling. What can I do to fix this?
I'm using eclipse, sorry
UPDATE:
I've tried all suggestions below but none worked
If you are using Eclipse, try Project > clean.. your project.
I don't know why, but Eclipse sometimes just think your project was wrong but it's not. Clean it to entirely build it again.
If it's Eclipse do
Project > Clean
then right click at the parent-most project and do
Maven > Update Project Configuration
Maven > Update Dependencies
I guess you have m2eclipse installed, already.
Use a maven plugin in your IDE
plugin for eclipse
plugin for netbeans
Most likely you have to include external libraries/dependencies in your IDE. It seems when you're building with maven, those dependencies are solved for you.
Some IDE's support Maven projects, try to see if yours does.
You haven't specified what IDE you're using or what the errors are, which makes it pretty hard to give you advice. My guess is that you haven't configured your project (or whatever the equivalent IDE concept is) to tell it the libraries you're using... whereas the Maven build file already contains that information.
EDIT: Okay, so it can't find the right libraries. Options:
Use a Maven plugin and let it manage the project
Edit the project's build path and explicitly tell it which jar files to use.