eclipse m2e: can't open declarations after importing maven projects - eclipse

Okay so the situation is simple so I'm not sure what the problem is and I've spent over three frustrating hours debugging with no luck!
I cloned a maven project from GitHub (using git) to ~/workspace/MyCompany/MyProject.
Then I did File -> Import... -> Existing Maven Projects and then selected MyProject as the root directory.
It appears like the import was a success but eclipse doesn't recognize any classes, even String and ArrayList! Whenever I right-click and choose Open Declaration, I get the following error message:
Problems opening an editor. Reason: project_name does not exist.
I'm using eclipse Juno and m2e 1.2.0. m2e was installed via Help->Install New Software...

Related

Maven SCM Handler for CVS in Eclipse (Juno)

I'm a longtime Eclipse and Maven user, but am just now upgrading to the more recent Eclipse builds (Luna- 4.4.1).
I've noticed that while Luna ships with m2e (1.5), the m2e marketplace no longer seems to have the 'Maven SCM Handler for CVS' as it did in the past. Has this handler been discontinued? Are there any other handlers that would allow for clean integration of Eclipse/Maven/CVS?
Without that handler, importing a Maven project from CVS is a rather painful affair; import generic cvs project, apply java project wizard, convert project to maven project. Once that's done, you then have to reconfigure other project settings such as Java source, resources, etc. All of this was automatically handled in m2e 1.0.x with the CVS handler.
For CVS SCM connector (if you want to import maven project from cvs repository):
Install new software: http://repository.tesla.io:8081/nexus/content/sites/m2e.extras/m2eclipse-cvs/0.13.0/N/0.13.0.201304101743/
More info: Maven Eclipse (m2e) SCM connector for subclipse 1.10 (svn 1.8)
(In case you're wondering, it also worked on Eclipse Mars)
First solution
How to install the SCM connector:
download zip org.sonatype.m2e.subclipse.feature-0.13.0-SNAPSHOT-site.zip or files from above repository location
unzip the file to an empty folder somewhere, remember that folder (or put the files from repository in that folder)
In Eclipse,
go to Help/Install New Software…
Click “Add…” to add a new site
In the window, click on “Local…” and choose the folder where you unzipped the site before. The result in the Location field should look like file:/C:/theUnzipFolder/
Click OK, choose all available packages to install, and continue the installation as usual
Second solution
Open Eclipse
Go to Help -> Install New Software -> Enter above repository location and hit enter
Select Maven Integration for Eclipse CVS Team Provider -> Finish
Alternative solution to SCM connector:
Checkout your project in workspace
Open cmd.exe and go to project location in that workspace. Then execute the following
mvn eclipse:eclipse
Open Eclipse with that workspace path as target
Right click in Project Explorer panel, Import -> Maven -> Existing Maven Projects -> Select project location from workspace and you should see the projects in here
Right click on your project in Project Explorer panel -> Maven -> Update project -> Select all projects -> Ok
Don't forget to:
set your corresponding JDK in Window -> Preferences -> Java -> Installed JREs
set your corresponding compiler level in Window -> Preferences -> Java -> Compiler -> Compiler compliance level
set JAVA_HOME environment variable

Setting up project is eclipse

I want to setup my work project in Eclipse, with following features:
1) Connect to SVN repository
2) It is a maven - multi module project
3) It is a spring project
If I import this project as Maven project I am not able to connect it to SVN repository.
If I check - out SVN repository, I am not able to set it up as Maven/Spring project.
And ideally I want to make it hot deployable, (as eclipse dynamic web project), so Development can be efficient.
How can I possibly do this.
I have setup eclipse Juno SR1 with Maven, STS, and SVN plugins.
What you can do is follow the below steps :-
Checkout from svn to your local drive.
As it is a mave nbuild project you will have the pom.xml file in the root of the project. Do a mvn eclipse:eclipse -Dwtpversion=2.0 on the project.
3.Open eclipse and go to File-->Import--> Existing projects into workspace.
This should do.
FYR see this
After the project is checked out into the Eclipse workspace, just remove the project by using the following action: -
right click at the project ---> delete ---> click ok
Please take a note, do not check the check box named "Delete project content on disk". We have just want to remove and re-import again.
All we need to do is re-importing by using the following action: -
File ---> Import ---> Maven ---> Existing Maven projects
This will help us to integrate the Maven with the SVN in Eclipse. We will see the revision information after the project name, folders, packages, classes, etc.
Anyhow to use Maven in the Eclipse, you should install the Maven Integration (m2e). Furthermore there is a useful plug-in to integrate the Eclipse WTP with the Maven as well. It is named Maven Integration for WTP.
I hope this may help.

Eclipse Maven: no "Checkout Maven project from SCM" option

I have to compile and run a Maven project that some colleagues of mine developed some years ago. I'm using Eclipse Helios on Microsoft Windows Server 2008.
In their documentation about how to compile it with Eclipse, I read that I have to install on my Eclipse:
Maven plugin (from http://m2eclipse.sonatype.org/sites/m2e )
Maven plugin extra (from http://m2eclipse.sonatype.org/sites/m2e-extras )
Subclipse plugin ( http://subclipse.tigris.org )
After installed these plugins, their document says to select the option "Checkout Maven Project from SCM" and other operations.
I've tried to install these plugins, but, first, I realized that they are antiquated.
I discovered that Maven Plugin changed name and address (now is Maven Integration for Eclipse 1.2), and that Maven Plugin Extra does not exist anymore.
Subclipse, instead, is available.
So I installed these plugins, but, afterwords, no "Checkout Maven Project from SCM" functionality was present on my Eclipse.
Then I searched online to solve this problem, and I found this thread on StackOverflow.com. It suggested to install the Maven SCM handler for Subclipse.
I've searched it on the plugin repository of Elcipse but it does not exist anymore.
Which Eclipse plugin may I use to get the "Checkout Maven Project from SCM" functionality on my Eclipse IDE ?
Thanks a lot
When you go to Window -> Preferences -> Maven -> Discovery, you have a button "Open Catalog", which opens a plugin marketplace specific to the m2e plugin. There you'll find a plugin called m2e-subclipse, which should give you the appropriate options:
Change the installed sub version to have m2 plugin. then check out as maven shows up.
Eclipse Marketplace -> Installed -> Subversive SVN -> Change -> Subversive SVN Integration for the M2E Project (Optional) and install it.
see images below.
I have recently run into same issue and found solution, as preferences trick mentioned in this post did not work for me.
All you need to do is to go back to your SVN installation (tested for subversive, guess similar for subclipse) and check m2e integration plug-in.
In my case: Eclipse Marketplace -> Installed -> Subversive SVN -> Change -> Subversive SVN Integration for the M2E Project (Optional) and install it.
I have a workaround , since I was not able to find m2e-subclipse in Window -> Preferences -> Maven -> Discovery.You need to check out the project.Once done, right click on the Project Explorer and Import->Maven->Existing Maven Project and select the checked out project and click Finish.
Just a heads up for anybody seeing this again for future versions of Eclipse.
Sonatype is no longer maintaining this:
You can either use the fork currently being maintainted in github [https://github.com/subclipse/m2e]:
https://dl.bintray.com/subclipse/releases/m2e/1.0.x/
Or you can use the eclipse maintained link for the eclipse version:
https://download.eclipse.org/technology/m2e/releases/1.9/1.9.1.20180912-1601/
Install either one by using the "install new software" link in Eclipse above "Eclipse Marketplace"
I used eclipse version 2022-12 from this website https://mergedoc.osdn.jp/
After I face this problem and try many ways. Finally, I got the solution.
Right-click on repo
Select Find/Check Out As...
Choose Check out as a project with the name specified, then input your project name alias
After checkout is finished. Right-click on the project.
Select Configure > Convert to Maven Project.

Importing C Eclipse Project into Perforce

I have the Perforce plug-In in my Eclipse IDE. Now I want to import Eclipse C projects that is already in the Perforce server. However, I cannot build them. They do not get imported as a C project.
I observed the same situation for Java project. Looks like any project from perforce is imported as just the Project. So that to resolve the problem I used the following approach.
Create project from perforce
Create separate language-specific project and set it up so that it is created from existing sources.
Share project (in perforce plugin terminology) so this is under perforce control now
In my Eclipse, I can right click on the project and choose New --> "Convert to a C/C++ project (Adds C/C++ Nature)". See also this question: Adding a C/C++ nature to an Eclipse project

subclipse not showing "share project" option on project context menu in eclipse

Within eclipse, with Subclipse installed, if I right click a project and select "team" there are normally 2 options:
apply patch
share project
Once you have shared project you get the full Subclipse menu from "team"
One project however only has one option - apply patch. If I close the project I see both options but the share project option is grayed out.
I have other projects where this is not happening.
What could be special about this project to stop me getting the share project option? Is there another path to the share project function I could use?
Regards
Solve this problem with these steps:
Verify that you can update using TortoiseSVN (this will guarantee that your .svn is not corrupt)
Delete all your projects that have this problem, but in the delete dialog, do not delete the project contents!
Select File -> Import -> Existing projects into Workspace.
Select your projects folder or your workspace folder.
Subeclipse should now detect and connect your projects automatically, without need to select 'Share Project' for each one of them.
This is usually the case when the directory containing the project is not properly under version control (bad or corrupted .svn).
So:
can you execute SVN commands in a shell a the root of your project?
where are your .project and .classpath files (in the eclipse workspace or at the root directory of your project?)
If you upgraded your Eclipse recently, make sure you're still using the same SVN plugins... :)
In my case, I upgraded my Eclipse and accidentally installed Subversive instead of Subclipse. The existing .svn directory of the project contained data in the format expected by Subclipse, and so Subversive got confused (e.g. but not showing the "Share Project" option).
Close Project and Re-Open project has worked for me.
I have the same problem after emergency-migrating (again!) from Subversive to Subclipse.
Old .svn entries are all there but Subclipse won't pick them up.
I can successfully commit using an external tool, in this case TortoiseSVN, but in Eclipse, I just see normal Java projects that cannot be shared (because of stale .svn entries I suspect).
The only solution I see is to commit everything you want to keep with an external tool, then freshly check out your projects into a new workspace and copy over any missing pieces from your old workspace.
Try to select prespective as java instead of j2ee and then restart as eclipse .
This works for me.
Delete the file:
<ECLIPSE_WS>\.metadata\.plugins\org.eclipse.core.resources\.projects\<PROJECT_NAME>\.indexes\properties.index
And the Share Project option appears!
I had the exactly same situation with Yaniv above.
If you upgraded your Eclipse recently, make sure you're still using
the same SVN plugins... :)
In my case, I upgraded my Eclipse and accidentally installed
Subversive instead of Subclipse. The existing .svn directory of the
project contained data in the format expected by Subclipse, and so
Subversive got confused (e.g. but not showing the "Share Project"
option).
My solution is like below:
Exported the current project in the new workspace into .war file.
Double-checked the current project is in the svn repository.
Removed the project in the new workspace completely once I was sure that I have the exported .war file and svn repository so that I will be able to import the project again.
Imported the project from svn, and checked out the project from the svn.
(Or, you can import the project from the .war file and you will be able to Share Project)
-> It worked well with the Subversive which is installed in the new workspace.
Please double check if you were using: Subversive or Subclipse?
It is likely that you have opened an old project with a newer Eclipse installation, where the software to be used may not be the one used previously, for example:
Subclipse instead of Subversive
Subversive instead of Subclipse
In my case after a fresh install of "Eclipse IDE for PHP Developers"
Version: 2018-09 (4.9.0)
Build id: 20180917-1800
while I needed to make some modifications to an ancient SVN tracked project.
I had Subclipse instead of Subversive (so simple yet you may be up for a spin).
Credit to the answer from Yaniv, he had installed the software the other way around - same issue.