Checkout maven project from SCM: disconnect and merge - java

Whenever checking out Maven project from svn server in Eclipse, it creates a new folder like maven.xxxxxxxxxxxx under the target workspace. After specific time, it disconnected from SVN server.
My question is when the new checkout process is started again:-
Can the next checking-out process merge to one of the existing folder maven.xxxxxxxxxxxx?
Any input would be appreciated!!

No, not directly. This happens if something stops the import step. While I can not tell you wat exactly went wrong in your case, I can tell you how to solve it:
Rename the maven.xxxxxfolder in your workspace to the real project name.
The select File -> Import... -> Existing Maven Project and choose the project folder. The project will appear in your workspace as maven project.
Depending on your eclipse configuration and plugins environment, you might also need to right-click on your new project and select Team -> Share... -> SVN (if there is a long list of options under Team, it is already correctly identifed as SVN project).
Update
If your maven.xxxx folder is empty, than you seem to have connection problems. Split the checkout and the import part:
Switch to the "SVN Repository Exploring" perspective, create the repository (if not already there). Can you browse the repository? If not, you have a connection problem (proxy?).
Right click your SVN project and select -> Checkout...
Select Check out as project in the workspace
This checks out the project as simple resource project
now back in the java perspective you can either delete the project and do an "Import existing Maven Project" or convert the project to a maven project using right-click -> Configure -> Convert to Maven project (exact command may vary with your m2e version).
If everything elese fails, try to checkout your project using TortoiseSVN (on Windows) or the commandline and doing "import -> existing maven project" afterwards.

Related

Checking out SVN gradle project directly into eclipse?

Let's say I have a few java projects on an SVN repository. If I want to check them out in an eclipse workspace at the moment, I first need to check out the projects in the workspace, then import them as gradle projects using Eclipse Buildship.
If I try to check them out using the new project wizard, it seems to just initialize another gradle project on top of what's already there, leaving me without the files I was trying to check out in the first place. What I would like is to be able to directly check these out as gradle projects, in a one-step process as opposed to checking them out and then re-importing them into my workspace. Is this possible? If so, what plug-ins or gradle build configurations are necessary to achieve it?
Right-click on your project at Project Explorer -> Configure -> Add Gradle Nature should change your project's configuration to a Gradle project without creating any configuration file.

Maven root pom.xml marked as red when importing existing project into eclipse

When importing existing maven project into eclipse my root pom.xml is marked red.
when i select on the pom.xml the message reads :
Can't import project XYZ from an existing workspace folder
This only happens for the root pom.xml
Eclipse in use: Luna Service Release 2 (4.4.2)
Maven Integration for Eclipse 1.5.2.20150413-2215
I have tested with number of different maven projects and in different workspaces.
Please note this worked before, I have been working on some tutorials and created number of Maven projects with same name and artifact Ids etc. I have deleted all the earlier projects, but could there still be some conflicts ?
any suggestions will help
Yes, You should start your Eclipse Workspace out of the pom.xml folder.
for example: D:\workspace\Project_Name.
In your Project_Name folder which contains pom.xml.
So you have to select D:\workspace while starting the eclipse.
And now, then import the project called Project_Name as maven project, It will work.
Hope, it will help !!
1. In Eclipse select -> File -> Switch Workspace -> Other...
2. The choose one directory up from the the one containing pom.xml
3. Import as Maven the project directory one directory up form the one you are intrested in.
4. Select project of interest from the list of projects.
I also came across this same issue. I kept my eclipse workspace name and existing maven project name same and got the error importing pom.xml. Later i opened new workspace with different name which is not matching to the existing maven project and now i could import maven project.
Solution:
1.Click on Windows tab then Preference(if you are using Eclipse).
2.Search for the Workspaces first and remove all of them from list(which you can add later eventually)
3.Then search for Maven and choose User Setting and check your .m2 path along with the updated setting.xml(meanwhile check the proxy too)
4.After that restart your eclipse and import the existing maven project again.
I'm 100% percent sure u'll no longer face this issue after that. Good Luck :)
I had the same issue while importing the existing spring project to eclipse, what I did is create a new folder as my workspace,
under that I put my spring project,
Then reopen eclipse and gave the workspace location as my newly created folder path
After that,
File -> Import -> Maven -> Existing Maven Projects -> Browser -> (Select the spring project) ->Finish
The problem is the project and the workspace must be two different folder. In my case I have erroneously selected my project folder as my workspace folder and so I was unable import the project.

Compilation unit is not on the build path of a Java project

I joined an SVN server and checked out the source files a project from that server. In the Eclipse editors, when I hit Ctrl + Space, I got the following error message:
This compilation unit is not on the build path of a Java project
What should I do to solve this problem?
Read this guide on how to use maven projects with eclipse
http://maven.apache.org/guides/mini/guide-ide-eclipse.html
Taken from the above link :
Reason why you get that notice :
Eclipse needs to know the path to the local maven repository. Therefore the classpath variable M2_REPO has to be set.
Solution
Execute the following command:
mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo
Restart your Eclipse IDE (if you already have it open) for this change to take effect.
You can also define a new classpath variable inside eclipse: From the menu bar, select Window > Preferences. Select the Java > Build Path > Classpath Variables page
For Simple Projects :
If you have a simple java project which is made up of only one module, using eclipse is very simple. To generate the eclipse project files from your POM you execute the following command:
mvn eclipse:eclipse
If you have created or checked out the project with eclipse, you only have to refresh the project in your workspace. Otherwise you have to import the project into your eclipse workspace (From the menu bar, select File >Import >Existing Projects into Workspace). In the latter case the project (directory) should not be located in your workspace, because eclipse might come into trouble, especially if you want to use eclipse as the scm client.
For a more detailed explanation refer the above link.
Import project as maven project.
File-> import-> Maven-> Exiting Maven Project-> Next-> Root Directory-> Browse your project from Disk
Follow these steps:
Right click project in Eclipse. Select to Run As → Maven build...
In Goals add eclipse:eclipse
Select Run
Wait for build to finish
Right click project in Eclipse. Select Refresh
This is due to the issue in build path .
If you had imported the project as Existing Maven project, do the following to resolve the issue.
Right click in the Package Explorer -> Maven -> Update project.
Or select the project in package explorer and perform Alt+F5 which is the shortcut for the maven project update.
Execute mvn eclipse:eclipse on command line and once the build is successful, refresh your project in eclipse. This resolve the issue.

imported maven project does not appear as java project. Shows folders

I checked out the existing project source code from SVN to a folder in my system.
Then I opened eclipse. Import Project-> Existing Maven Project.
It imported without issues. However, Project Explorer shows it as just folders instead of packages. (Like when we create a package and then add classes to it, it shows a different icon for package root). I opened Navigator and Package Explorer as well. But they are showing them as folders as well.
I tried:
mvn eclipse:clean
mvn eclipse:eclipse
on the root of the project. But it did not help.
Can anyone help on this one?
My folder structure:
ecs->
ecs-ejb->
src/java/main/com/xxx
pom.xml
ecs->ear->
src/java/main/com/xxx
pom.xml
pom.xml
Try to:
Right click the project->Configure->Convert to Maven Project
---- Edit ----
If this doesnt work, it is likely that someone checked in their environment files into your SVN. If they checked in:
.project
.classpath
.settings/
They could be conflicting with your environment (different settings/plugins/versions of eclipse...). Try dropping your project, deleting the folder/files, then remove these files from SVN, and repeat your initial process. All of these files/folders will get generated during the import to eclipse.
---- Edit 2 ----
Per your recent edit to the question, you have a multi-module project. If you only did this on the parent project, then there is no source folder. So you wouldn't see it. You should:
File->Import...
Choose Existing Maven Projects, Next
Set the Root Directory to ecs/ecs-ejb, Finish
Repeat for all other modules.
In eclipse, each module of a multi-module maven project needs its own eclipse project.
Right click the project->Configure->Convert to Faceted Form
This solution worked for me
Possibility is Module doesn't have .classpath.
Kindly right click on Module and Change Project fact as Java.
else
If you are using command Prompt.
1. mvn eclipse:clean
2. mvn eclipse:eclipse
else
Delete Project from Eclipse don't delete content from disk. remove .classpath and .project
Re-import as maven existing Project
Right Click->Maven->Update Project.
Above works perfectly fine for Eclipse Juno and solves the problem.
You just need to change the nature of the project.
For MAC->
-> Right click on project
-> Properties -> Check Project Natures
-> Then add or remove accordingly if you are having a maven project then add Maven, add Java
I had the same problem. I tried a lot of things that I read on internet but the only way that I found to solve my problem was exclude all of my workspace files (.metadata folder) and create another one.
After that, I imported a existing maven project and all my problems are gone.
I also faced a similar issue. I resolved it by downloading the correct apache maven plugins in the maven repository org / apache/ Maven/ plugins. IN my case, everything was working fine earlier and I had deleted .m2 repository completely. After that I started getting these issues with same iDE and newer IDE versions as well. The pom.xml showed error related to lifecycle mappings. On downloading the correct plugin, the workspace worked fine.
Delete the metadata folder. Checkout again but select "Checkout as a project configured using the New Project Wizard" instead of "Checkout as a project in the workspace".
Then a New Project wizard will open, type maven there and select "Checkout Maven Projects from SCM" preferably or "Maven Project". It should work. Remember this step should be performed for Maven Projects only. For normal Projects just select Java Project or whatever relevant type Eclipse project it is.
Check and make sure you have eclipse pointing at a Java JDK directory instead of a Java JRE directory.
I had just installed eclipse and only the JRE was in the settings. I added the JDK path, changed it to the default and clicked on Maven -> Update project. Then the packages appeared in Package Explorer.
The hint that helped me figure this out is that when I tried to use the refactor to rename a class, it wouldn't do it, complaining that it wasn't a JDK.
Instead of importing as Existing Maven Project, follow below steps
I assume that your folder has pom.xml, src/main and src/test.
Step 1: Right click > Create New > Java Project > Chose the project folder has pom.xml
Step 2: Right Click on Project > Configure > Convert to Maven project
I got it working using Proyect --> Properties --> Project Facets
In my case was a web project so I checked Java and Dynamic Web Module
Try right click on project, Maven->Update Project... (or similar, the link name changes depending on version)
This works for me when adding new folders, but I have not encountered the problem when importing a project.
Right click the project, then click Configure -> Convert to Maven Project. If the packages still display as ordinary folders, then right click on the folder one level up (the one that is supposed to be the source folder), then click Build Path -> Use as a source folder.
Here is my solution please close the Project Explorer at the left top and open again.
(or)
1). Right Click on your miscellaneous project and choose project Explorer if available.
Adding projects to working sets should help
try it ->
right click the project -> Maven -> Assign Working Sets... -> Add projects to working sets

open existing java project in eclipse

As one of our dev guy is on vacation, I got his task. The source code is in our svn repository and i got down the java project source. downloaded eclipse 3.3.2 sdk as that were his instruction.
How do I open an existing project in eclipse? Coming from MS world, i do not have the luxury of finding a .sln file.
File -> Import -> Existing Project into Workspace
Browse for that directory.
Alternative: Check out the code in SVN to some folder
Create a new folder in windows
In eclipse File -> switchWorkspace -> newFolderName
close the welcome window in eclipse
In eclipse File -> Import -> Existing project into workspce-> select root dir -> browse and show the svn checkout folder
If this is a simple Java project, You essentially create a new project and give the location of the existing code. The project wizard will tell you that it will use existing sources.
Also, Eclipse 3.3.2 is ancient history, you guys should really upgrade. This is like using Visual Studio 5.
The typical pattern is to check out the root project folder (=the one containing a file called ".project") from SVN using eclipse's svn integration (SVN repository exploring perspective). The project is then recognized automatically.
Eclipse does not have internal Subversion connectivity. After you've downloaded and unzipped Eclipse, you have to install a Subversion plug-in. Check with the other developers as to which Subversion plug-in you're using. Subclipse is one Subversion plug-in.
After you've installed the Subversion plug-in, you have to give Eclipse the repository information in the SVN Repositories view of the SVN Repositories perspective. One of the other developers should have that information.
Finally, you check out the project from Subversion, by left clicking on the Package Explorer, selecting New -> Project, and in the New Project wizard,left clicking on SVN -> Checkout projects from SVN.
Simple, you just open klik file -> import -> General -> existing project into workspace -> browse file in your directory.
(I'am used Eclipse Mars)

Categories

Resources