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
Related
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
I have the current version of the dependency successfully installed in the local mvn .m2 registry with mvn clean install (confirmed by cd into .m2 repository).
I then modified the pom.xml of the project to include the new version number:
<dependency>
<groupId>com.xyz.lib</groupId>
<artifactId>xyz-lib-abc-model</artifactId>
<version>1.4.0-SNAPSHOT</version>
</dependency>
Maven was able to build successfully with 1.4.0-SNAPSHOT, but when I accessed the project in IntelliJ, it linked to an old version (0.1.1-SNAPSHOT) instead of the current version.
When I checked the dependency tree using `mvn dependency:tree, I have:
[INFO] +- com.xyz.lib:xyz-lib-abc-model:jar:1.4.0-SNAPSHOT:compile
Which looks correct to me.
I have tried using <dependencyManagement> but then it makes the project failed to build, and failed to detect the model.
Anyone knows what's going on and how to get maven to pull the correct version?
Thank you in advance!
Try re-importing the dependencies from local m2 in IntelliJ like :
Open the project view in IntelliJ
Right click the pom.xml file and
select Maven - Reimport If this works for you IntelliJ will add the
dependencies to the project
Check the if the dependencies you need are added in File - Project
Structure - Project Settings - Libraries and File - Project
Structure - Modules - Dependencies
I have seen this issue with IntelliJ.
If you don't need the old version anymore, you can cd to .m2 directory and delete the older version manually.
But you need to keep the both versions, you can open the project as a fresh project using the pom.xml. This will solve the issue.
Try the following approach:
Close the project in IntelliJ
File --> Open ...
Find pom.xml of your project, not the idea project files
Open this pom.xml. It will re-build all the dependency model in accordance with the information found in this new pom.xml (that I assume doesn't have an old dependency anymore).
DependencyManagement section is irrelevant in this case - mention it because you've said in the question that you've tried this - so don't bother, it will save you some time :)
my first guess goes to the used maven type in your IDEA is not the one that you use in the terminal. :)
You can set up the installed maven instead of the bundled one.
Or another solution is that you proceed a “refresh/reimport” in pom.xml. It will investigate the classpath based on your pom.xml and refresh the ones that needed.
You should see the "Reimport button here
If you don't see Maven at all, that means. you haven't added your project to IDEA as a Maven project.
Please then do the following
1. Right Click on pom.xml
2. 2. Add as a maven project
I have a multiple-module project using STS4/JDK10. When my modules appear in the Maven dependencies of another of my modules, they always show with '(without test code)" rather than a version such as "1.0.0.jar - {repository location}". I have used Run/Maven Install the jar to my Maven repository and I have used deploy to put in my Archiva repository. Some of these modules have Junit tests. Is there a way to resolve the issue?
Am I missing something in my module-info file or my pom?
This is not because of you missed anything in pom. In fact this is a feature in eclipse, related to maven.
To see the jar(as you are expecting), follow the below steps:
Right click on module->Maven->Enable Workspace Resolution.
These steps solve you problem.
I am using the eclipse kepler version 4.3.2. I have recently checked out the java project from the svn repository. I have checked the project contains the pom.xml file but I am not able to build the project in the eclipse. I shows the various build errors such as
Missing artifact org.springframework:spring-web:jar:3.0.5.RELEASE pom.xml /RAWS line 1 Maven Dependency Problem
Note:
I have the eclipse maven plugin installed in the eclipse because I can see the maven option in the dialogue box in the window->preferences option
How should I solve this issue ?Do I need to download the maven?How should I solved the issue of build errors? Do I need to download the new plugin ?
Can anybody tell me the steps than it would be helpful?
Update your maven project orelse Open the pom.xml with Maven POM Editor and you will find the Dependencies tab click that and add the required JARs in to your project
As the desired jar is in MavenCentral, it is likely that your MavenCentral connection is not working. Either you replaced the MavenCentral url (in the settings.xml or your pom) or you live behind a proxy and MavenCentral cannot be seen.
In the "Maven repositories" view in Eclipse, you can see the indices of the repositories. Check whether central has an index there (after possibly applying "Update Index" on it).
I think you should give us more informations about your problem.
Maybe you could post some snippets of your pom.xml or tell us which repository you try to access?
It's also possible that your maven version is too old/new.
I'm using eclipse with the m2eclipse plugin now I just want to resolve a - imho - easy problem: I've got two maven projects, I want to add project A as dependency to project B.
Well how do I achieve this in a manner way? If I add the project A to the build path of project B eclipse recognizes the classes but this project isn't resolved by eclipse on build time.
I got it working by installing project A to my local repo and adding this as dependency to my pom. This works but is cumbersome because I always have to install a new version of project A when something changed.
Shouldn't the plugin handle such a situation for me?
Providing that you have both maven projects open in your workbench then make sure you have the "Enable Workspace Resolution" option enabled in the Maven context menu.
Yes Eclipse handle this situations.
You can add both the Projects A and B in the same work-space.
I could help you creating a simple work-space from the scratch.
I am assuming that you have already installed the MAVEN plugin M2Eclipse for Eclipse.
Start a new Eclipse in a blank Work-space
Right click on Project Explorer --> Go to Import dialog and add a Maven Module.
Locate the POM directory and add that directory.
It will list all the projects in all the sub folders.
Add as many as Maven Based modules in a single work-space.
By doing this you dont need to install the dependencies. Any change will be reflected on the derived module.
Hope that will help you.
The way you did it is correct, because it assumes that project B will be using the dependency of project A that will be in the artifactory, so you can develop both independently.
And anyway, for the project A, if you are using maven, don't you use maven clean install for compiling and deploying? That way you are sure you always have the latest version
The other option is, in case both of the are more dependent of each other, you should consider make one of them as a module of the other, or maybe make a project C that contains both modules, but that would mean both of them are part of the same project (like an ear containing two jars), depends on the situation