I am new to maven projects. Steps followed :
I tried importing a maven project in eclipse through File -> Import.
Gave the location of root dir of the svn checkout project. It recognized the pom.xml file.
Clicked Finish. Project imported and all files were placed in the Project Explorer of the eclipse.
Problem:
The directory structure was not as that of a java package, it was just a normal folder structure. I am not able to browse the code quickly i.e. get the declaration, different calls to a method and all the code browsing shortcuts. It gives a error says.. Project not in Build Path. On right clicking the project, there are no options present in the 'Build Path'.
Please let me know, what I am doing wrong here. How to import a maven project correctly into eclipse and set it up ?
Run :
mvn eclipse:clean
Then
mvn eclipse:eclipse
And it should be it's old self again, if not refresh the project in eclipse and that should do it
I have faced similar issue . I have resolved this issue :
Right click on project -> properties -> Project Facets -> convert it into Facet form
And you can get the folder structure as you want
I faced the same issue and could resolve by following steps
First ensure that you are able to maven clean or install. Just to ensure the proj setup works.
Right click on Project.
Navigate to Maven > Update project configuration.
This should resolve the issue. Hope this helps.
I resolved this issue with:
go to Window > Preferences > build path
under output and source folder choose the project
delete/backup original project and create/import the same.
your issue will be resolved.
Related
After creating the Maven Project in Eclipse from maven-archetype-webapp archetype i have the src/main/java not seen in project explorer and advices from same topic here do not work, so it is not a duplicate, because:
in my effective POM already stays :
<sourceDirectory>X:\Programming\workspaceEclipse\TomkatFromArchetype\src\main\java</sourceDirectory>
<scriptSourceDirectory>X:\Programming\workspaceEclipse\TomkatFromArchetype\src\main\scripts</scriptSourceDirectory>
<testSourceDirectory>X:\Programming\workspaceEclipse\TomkatFromArchetype\src\test\java</testSourceDirectory>
<outputDirectory>X:\Programming\workspaceEclipse\TomkatFromArchetype\target\classes</outputDirectory>
<testOutputDirectory>X:\Programming\workspaceEclipse\TomkatFromArchetype\target\test-classes</testOutputDirectory>
what is actualy ok.
But after updating maven, installing, building - whatever, i can not get the damn src/main/java shown in the project explorer and can create new java classes only in src/main/ressources.
I want generally know what is the reason for that behaviour, options for folders in m2E, so i could turn it and configure in different ways manually.
Some more info:
The folder src/main/java is sort of "exist", because if i try to create the folder, it shows that there is one with this name, but is not seen.
Opening project properties (right click) -> java build path ,stays
src/main/java and src/test/java (missing), how can it be?
Solved by looking in the file explorer, is the path realy there.
If it is there,it may be added in project explorer menu. If not - you create it in file explorer and add in project explorer menu
this issue occur into eclipse many time. you need to go to Project property > project facets and click on convert to faceted from.. then apply and ok. after this you can see the src/java/main into your project resources. you can fine image below:
One solution that could work in this scenario(suddenly src main java folder vanishes) is :
delete the project from the workspace. (not from disk)
re-import the project again as Maven project.
This worked in my case.
I am trying to create the project as set out in the tutorial "http://crunchify.com/how-to-build-restful-service-with-java-using-jax-rs-and-jersey/". I have followed all the steps but I get thee POM error ....
Description Resource Path Location Type
C:\Users\xxxxxx\workspace\CrunchifyRESTJerseyExample\target\m2e-wtp\web-resources\META-INF\MANIFEST.MF (The system cannot find the path specified) pom.xml /CrunchifyRESTJerseyExample line 1 Maven Configuration Problem
I've noticed that I have 2 Web Content folders: One under Deployed Resources, which does contain my MANIFEST.MF file and another at the same level as the Deployed Resources folder. Eclipse seems to be looking for it in the second WebContent folder where it is not located. Is there a simple fix for this?
I had similar problem and updating the Maven project solved it.
In Eclipse, right click on the project > Maven > Update Project
See this post:
http://kodurishiva.blogspot.pt/2016/04/manifestmf-system-cannot-find-path.html
This situation returns when I do a maven clean.
Thre are two ways to solve this error.
From Eclipse:
Right-click on the project -> Go to Maven -> Update project.
The second way is from maven clean install using the command line maven.
Use the following command:
mvn clean
Go to Libraries tab in the projects' Build Path. JRE system library must be projects's default JRE.
Thre are two ways to solve this error.
From Eclipse:
Right-click on the project -> Go to Maven -> Update project.
Updating Maven project just resolved my problem
For Eclipse:
Check if your project does not have the folder - src/main/java.
Then right-click on the project -> Click Build Path -> Configure build path -> click on the sources tab in the opened window.
You will not see the error for the src/main/java folder missing.
Select it and remove it. The error will be gone.
As the title mentioned I have the following problem: I use Eclipse with Maven Nature and when I update my Maven Project, I get this error:
An internal error occurred during: "Updating Maven Project".
Unsupported IClasspathEntry kind=4
The solution that always comes back is the following:
rightclick project, remove maven nature
mvn eclipse:clean (with project open in eclipse/STS)
(sometimes they suggest to do mvn eclipse:eclipse next)
rightclick project and reenable maven nature
Now I exhaustively tried all combinations several times. But I always keep getting the above error. The error starting occurring when I had to mvn eclipse:eclipse the project. Before it was always running fine using only m2eclipse features and setting everything in eclipse.
I had to do it slightly different to work for me:
rightclick project, remove maven nature (or in newer eclipse, "Maven->Disable Maven Nature")
mvn eclipse:clean (with project open in eclipse/STS)
delete the project in eclipse (but do not delete the sources)
Import existing Maven project
I just went to Properties -> Java Build Path -> Libraries and removed the blue entries starting with M2_REPO.
After that, I could use Maven -> Update Project again
This is all you need:
Right-click on your project, select Maven -> Remove Maven Nature.
Open you terminal, navgate to your project folder and run mvn eclipse:clean
Right click on your Project and select Configure -> Convert into Maven Project
Right click on your Project and select Maven -> Update Project
After trying all these procedures it still didn't work for me. What did work was
go into File Explorer and delete the .classpath file under the project's root folder
run Maven update within Eclipse, and check Force update of Snapshots/Releases
Our current work required integrating a number of disparate projects so unfortunately use of SNAPSHOTs in a production environment were required (taboo in Maven circles)!
This issue (https://bugs.eclipse.org/394042) is fixed in m2e 1.5.0 which is available for Eclipse Kepler and Luna from this p2 repo :
http://download.eclipse.org/technology/m2e/releases/1.5
If you also use m2e-wtp, you'll need to install m2e-wtp 1.1.0 as well :
http://download.eclipse.org/m2e-wtp/releases/luna/1.1
Slightly different option usually works for me:
"mvn eclipse:eclipse" for this project in the command line.
"Refresh/F5" this project in eclipse.
That's all, no need to re-import but need to have the terminal window handy.
I solved this by looking at this comment on JBIDE-11655 : deleting all .project, .settings and .classpath in my projects folder.
I have that problem and my solution is going source folder and run command line: mvn clean install -DskipTests eclipse:eclipse then return eclipse workspace and refresh project. Hope that help!
Your command line mvn eclipse project generator may not be the same version as that of your eclipse, and eclipse doesn't understand for your command line tool is generating.
Just use eclipse's in this case:
remove the project from eclipse (including all modules if multi-module)
run: rm -rf .settings/ .project .classpath to delete eclipse project files, also from modules
import your project as an existing maven project
I imported the project as general project from git repository.
Deleted .settings, .project and .classpath in project's folder
Configure -> Convert to Maven Project. Only this solved the problem in my case.
I removed my .classpath file in my project directory to correct this issue. No need to remove the Maven Nature from the project in Eclipse.
The specific error I was getting was: Project 'my-project-name' is missing required Java project: 'org.some.package-9.3.0 But my project wasn't dependent on org.some.package in any way.
Perhaps an old version of the project relied on it and Maven wasn't properly updating the .classpath file.
It helped in my case
rightclick project, remove maven nature
mvn eclipse:clean (with project open in eclipse/STS)
delete the project in eclipse (but do not delete the sources)
Import existing Maven project
My tricky solution is:
Open your windows Task Manager,
Find the Javaw.exe process and highlight it, then End it by End Process
In eclipse project browser, right click it and use Maven -> Update Project again.
Issue is resolved.
If you have Tomcat Server Running in Eclipse, you need to refresh project before restart Tomcat Server.
In a maven project called my-project, eclipse keeps telling me
The declared package "com.myself" does not match the expected package "main.java.com.myself"
although I verified that in the project's build path, I have an entry:
my-project/src/main/java
Included: **/*.java
Excluded: (None)
Native library location: (None)
Ignore optional compile problems: No
What could be the problem then?
What is the easiest way to fix the problem?
I suspect that something is wrong with the eclipse settings files, because after importing the project to the workspace and converting it to a maven project, I had to change the folder structure manually in to get the conventional folder structure of a maven web project. But it could be that during those changes, something was not understood properly by eclipse.
Also, maven is able to build my project (from within eclipse, as well as from the command line).
I'm just getting those compilation error from eclipse.
P.S. I've already tried project > clean, but it did not help.
Set my-project/src/main/java as the source folder (Project -> Properties -> Java Build Path -> Project -> Add Folder). Remove the old source folder.
Restart eclipse if necessary.
Simply put, Eclipse thinks that your project begins at my-project/src. Therefore, it expects all packages to descend from there, starting with main.java.
Looks like the project is still not in maven nature...
Follow the steps:
Right Click on the project folder -> Maven -> Update Project...
OR, open the command prompt, go to the root project directory, and type the following command:
mvn eclipse:clean eclipse:eclipse
I copied the project folder to some place outside of my eclipse workspace.
Then I deleted the project from the eclipse project explorer and the workspace.
Now I created a new java project with the same name, and imported the original project that I saved at (1).
Tah dah! no compilation errors.
I have imported my maven project in eclipse using Import Maven project. It got import in eclipse project explorer, but all the source folder are opening as files and folders, its not opening as java source folder. Since its opening as files and folder, it doesnot have compilation unit, found very difficult to code using it.
What do I need to do inorder to make the source folder as java source folder so that I can code easily?
Select the project and from the context menu choose Maven -> Update Project Configuration (This menu item gets reworded across various maven releases so look for something similar). You may also need to choose Update Dependencies.
In the shell/command line, execute mvn eclipse:eclipse