I am trying to move a Java project from Selenium 2.53 to 3.4. I am using Eclipse Mars under Windows 7. Eactly the same problem happens in a fresh installation of Eclipse Neon.
I have changed the Maven dependency to selenium-java 3.4 and got NullPointerException when trying to run the project in Eclipse. After a Maven build of pom.xml, the resulting jar runs fine.
I thought the project might have gotten corrupted, so I started a new Maven project, hoping to move the code into it eventually. After creating a simple Maven project I added selenium-java 3.4 as a dependency - and immediately got an error during the project build in Eclipse. The details say, again, NullPointerException. Then I installed Neon,created a new project again, added selenium-java 3.4 as a dependency and got the same issue.
Unfortunately I have no way of knowing on what line the NPE happens. When trying to save pom.xml, I get a windows saying:
'Building workspace' has encountered a problem. Errors occurred during the build.
When I click Details I see:
Errors occurred during the build.
Errors running builder 'Maven Project Builder' on project 'service.apm.ui_auto.dataentry'.
java.lang.NullPointerException
When I look into Errors, all I see is "Project configuration is not up to date with pom.xml. Select Maven -> Update project from the project context menu or use Quick fix". When I do that, I just get another window with "'Updating Maven Project' has encountered a problem". And the Details button shows a message about the NPE again.
After a lot of "trying stuff" I have stumbled upon an apparent solution.
I rename C:\Users\myuser\.m2 and then the new project starts working just fine - it builds, runs, Maven Update project works... until I try to build the old project. As soon as I try to build the old project or update it (right click old project > Maven > Update project), the Null Pointer Exception returns, and then it affects the new project too.
Moreover, even if I do not touch the old project, the NPE eventually returns, apparently during downloading sources and javadoc. While I will try disabling downloading sources and javadoc, this does not look like a complete solution.
After a lot of "trying stuff" I have finally stumbled upon an apparent solution. It was not great, but I am placing it here for the benefit of others who get the issue.
I have:
Installed Eclipse Neon in a separate directory and with a separate workspace
deleted C:\Users\myuser\.m2
created a new project from scratch, and did NOT import the old projects into the new Neon
Now things seem to work fine, though at one point, the NPE returned - I think updating the indexes corrupted the repository again. I deleted .m2 and the NPE went away.
It seems there is a maven build issue with current version of selenium jars 3.4.0, so what worked for me was adding dependency for a lower version of selenium, in this case, version 3.3.1. Once added and saved, no error was seen and the project was successfully built.
Related
I am working on Eclipse plugin. At the beginning exporting of it worked fine but I guess that after updating Eclipse it broke down. Eclipse started to mentioned that I have uninstalled some equinox packages. It took time till I understood that version of Eclipse made a problems and I reinstalled older version of Eclipse. Now I am again able to run sample environment with plugin but I still am not able to export plugin. In export form where I need to select deployable plugin and/or fragments I don't have listed anything. From what I found I understand that it might be problem with importing project in Eclipse as it might not remove information that project is external and thus not listing as project that could be exported. But I did not find any way to prove this case.
Is there anybody having any idea how to solve this kind of issue?
I'm checking whether we'd be able to migrate from Ant to Gradle, but got confused right at the very beginning of these checks - Apache Netbeans 12 LTS (+ Gradle plugin from official repo) refuses to properly open Gradle projects that were created by a another Netbeans instance, which is a major pain.
I tried to open (in Netbeans) one of the Java library project examples from Gradle docs, only to find out the IDE immediately spews out errors (missing imports for tests) that are unjustified and offers a very limited amount of IDE integration - forget running specific tests, even debugging is all grayed out. Gradle and Netbeans also see different classpaths.
If I create a Gradle project inside Netbeans, everything works fine - no errors, Projects Tree shows an additional tree node, called "Configurations", like in the image below, I'm able to debug and everything just works.
However, even if I just copy/paste this project's directory to a different location, everything breaks after the project is reopened (I also get this issue, same thing happens for example projects found in Gradle docs).
What is going on here? Netbeans seems to know more about a project it created, than about projects that were created outside it or were just relocated. How do I force it to treat all Gradle projects equally (so that they work as expected)?
I used Gradle 7.0.1 and let the New Projects wizard "Initialize the Gradle wrapper" for the project created inside Netbeans 12 LTS. The setting to prefer existing wrappers is enabled in settings if relevant.
Enabling an "experimental" option in Gradle options, called Enable 'lazy' Source Group Initialization does help with simple projects that were created by Netbeans, so they open as expected.
But this does not work for Gradle projects that contain subprojects, such as the example project from Gradle docs:
The issue tracker for this Netbeans plugin has been quite active recently, mentioning issues like this, so perhaps there is hope.
At least part of the problem is that the LTS release of Netbeans (at the time of this writing) doesn't support gradle 7. The latest release, Netbeans 12.4, is the first version that supports gradle 7.
I'm running Eclipse Neon.2 Release (4.6.2) and was in the middle of a Spring Boot course when an Eclipse update killed my Workspace.
After many hours of research on -clean, eclipse.ini edits, etc I decided to start a new workspace. I have a local repo created on the HD and subclipse 1.10.13 plugin installed, so I knew my actual project was safe.
Problem is I can't get Maven to recreate the original structure of the project with the new project wizard (assuming this is what I need since a straight checkout was missing many directories/files. Using the wizard the structure is still off and it creates a duplicate pom.xml file.
How do I get Maven to recreate the structure the way it was without creating a duplicate pom.xml?
You can try to right click on your project, then from the context menu, click Configure > Convert to Maven project
Did you tried to start your Eclipse and Workspace with the start parameters -clean -initialize
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've been fighting an internal Eclipse error for two days. I'm running the latest Spring Tool Suite edition of Eclipse, and I've attempting to import a collection of existing Maven projects. Whenever I do so, Eclipse throws a NullPointerException, but no stack trace is available from the Error Log view. If I instruct Eclipse to update the Maven project (Maven > Update Project), I get a NullPointerException again. This time, the Error Log view reports the following stack trace:
java.lang.NullPointerException
at org.eclipse.wst.common.componentcore.internal.resources.VirtualResource.getProjectRelativePaths(VirtualResource.java:119)
at org.eclipse.wst.common.componentcore.internal.resources.VirtualFile.getUnderlyingFiles(VirtualFile.java:104)
at org.eclipse.wst.common.componentcore.internal.resources.VirtualFile.getUnderlyingResources(VirtualFile.java:93)
at org.eclipse.wst.common.componentcore.internal.resources.VirtualResource.exists(VirtualResource.java:88)
at org.eclipse.jst.common.internal.modulecore.util.ManifestUtilities.getNonBinaryComponentManifest(ManifestUtilities.java:124)
at org.eclipse.jst.common.internal.modulecore.util.ManifestUtilities.getManifest(ManifestUtilities.java:81)
at org.eclipse.jst.common.internal.modulecore.util.ManifestUtilities.getManifestClasspath(ManifestUtilities.java:147)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getManifestClasspath(J2EEModuleVirtualComponent.java:248)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.calculateManifestReferences(J2EEModuleVirtualComponent.java:368)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.cacheManifestReferences(J2EEModuleVirtualComponent.java:360)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:176)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:214)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:207)
at org.eclipse.m2e.wtp.WebProjectConfiguratorDelegate.configureClasspath(WebProjectConfiguratorDelegate.java:386)
at org.eclipse.m2e.wtp.WTPProjectConfigurator.configureClasspath(WTPProjectConfigurator.java:107)
at org.eclipse.m2e.jdt.internal.DefaultClasspathManagerDelegate.populateClasspath(DefaultClasspathManagerDelegate.java:61)
at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:253)
at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:363)
at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:343)
at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:371)
at org.eclipse.m2e.jdt.internal.BuildPathManager.updateClasspath(BuildPathManager.java:191)
at org.eclipse.m2e.jdt.internal.BuildPathManager.mavenProjectChanged(BuildPathManager.java:180)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.notifyProjectChangeListeners(ProjectRegistryManager.java:746)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.applyMutableProjectRegistry(ProjectRegistryManager.java:865)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:289)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration0(ProjectConfigurationManager.java:369)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:316)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:1)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:161)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:137)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:89)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1301)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:313)
at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:77)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Here's what I've tried:
I've blown away my workspace and created a new one. Multiple times.
I've blown away my Maven repository so that it would be re-created.
I've reinstalled Spring Tool Suite.
I've tried asking Eclipse to update the Maven repositories.
I've checked for merge conflicts in my local SVN repository. (There are none; this is a brand new branch from trunk that is freshly checked out.)
I've checked the Synchronize view in Eclipse to see if it notes any differences. (Eclipse can't get far enough to recognize any projects available to synchronize.)
I've searched Google for NullPointerExceptions occurring in VirtualResource.getProjectRelativePaths(). I've found NullPointerExceptions in other very similar places, and I've tried the recommendations for them, just for the heck of it, but none of them work.
I'm at my wits' end with this problem. Help me, Obi-Wan Kenobi, you are my only hope.
This is what I did to fix it:
Removed the project from the workspace
Remove .classpath, .project and .settings folder
Reimport the project
I'm strongly sure that the problem is not related to the maven plugin; but if it is, i was wandering if you run a mvn eclipse:eclipse before importing the project into eclipse, if you do that and you are using maven 3, I had checked that maven plugin does not support maven 3 properly yet; so I encourage you to make a mvn eclipse:clean, then import the project as an existing project, and after that activate the maven plugin nature from eclipse.
I hope it helps,
PS. it seems to be a know eclipse bug (https://www.google.com.uy/search?q=j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java&oq=j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java&aqs=chrome..69i57.128j0j7&sourceid=chrome&espv=210&es_sm=91&ie=UTF-8); try downloading the last eclipse version; I'm using kepler at work, and I'm working in maven/spring projects and it works fine.
Good luck!
This happens because your m2e plugins are corrupted. To rectify follow the steps below.
close eclipse
Go to your eclipse workspace folder Under .metadata/pluigns folder, identify all m2e plugins
delete them
copy the relevant plugins from non-corrupted workspace, either from
your machine or from any one of your team members machine
restart eclipse
As echinelli indicated, this did turn out to be an Eclipse (or STS) bug, but installing the latest version isn't the fix, as I already had that version installed. I had installed STS based on Eclipse 4.x; when I uninstalled that and went to the 3.x version, the problem went away.
Ok, I had the same issue with a more obscure reason.
I used pluginExecution for aspectj-maven-plugin and over the course of trying to fix yet another maven issue I had commented out <action><execute><execute></action>
This leads to the nullpointerexception.
I solved by adding the <build> section with "maven-compiler-plugin" artifact in the POM. I noticed that without it, Eclipse threw a java.lang.NullPointerException.