MANIFEST.MF (The system cannot find the path specified) - eclipse

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.

Related

Maven sources src/main/java are not seen, advices from same topic not working

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.

Eclipse+Maven src/main/java not visible in src folder in Package Explorer

I'm wondering why I can't see following folders in src node in Package Explorer
src/main/java
src/main/resources
src/test/java
src/test/resources
I can access those folders as direct children of the project and they exist in the file system.
I'm using Spring Tool Suite (STS of Eclipse).
Maybe I can configure Eclipse somehow ?
I have solved this issue by below steps:
Right click the Maven Project -> Build Path -> Configure Build Path
In Order and Export tab, you can see the message like '2 build path entries are missing'
Now select 'JRE System Library' and 'Maven Dependencies' checkbox
Click OK
Now you can see below in all type of Explorers (Package or Project or Navigator)
src/main/java
src/main/resources
src/test/java
Eclipse filters out folders that are marked as source from the "raw" folder path. That is, they are visible only as source folders:
If you can't see them in either place, then they
are either filtered out in the settings: check your settings for Package Explorer (the Package Explorer bar, downwards menu arrow -> Filters...)
or they were created externally and Eclipse haven't noticed them: Refresh your project in this case.
or they don't exist: right-click on the project, select New->Folder and input the path, e.g. src/test/java (not "Source Folder"). After you use Maven->Update Project... on the project, they will be automatically added as source folders, provided you have the default configuration.
Now, as I said, those folder will only be used as source if you preserved the default configuration in your POM. If you defined other resources and/or testResources, those will be used instead. In general, Eclipse m2e synchronizes Eclipse's project source folder configuration with what's in your POM.
EDIT: maybe this is unclear - see those folders at the top? The ones labeled with the /-separated paths? These are your folders. These are the same folders that you would expect to find in main and test, just represented differently.
I used to get the same problem, but solved it by pointing to the right jre used for the project.
Right click on the project
properties
java builpath
see the jre selected
edit it
select alternate jre
installed jre
select the right one
ok
After changing right click on project>maven>update project
Hope it helps.
Attaching screen shot.
If you are looking for Simple/quicker way, you can follow this solution.
Right click on your project.
Goto > Build Path > Configure Build Path > Java Build Path
Goto 'Source' tab, there, you can see like <<your_project_name>>/src/main/java(missing).
Click on it and remove.
Click on Apply and Close.
Now, right click on project and >New > Source folder > add source folder "src/main/java".
happy learning and do not forget to upvote :)
I had the same problem, I changed my Eclipse project view from Package explorer to Project Explorer.
After 2 hours of trying everything...
Just go on window -> show view -> project explorer
and in project explorer you can view of all files solution
I had a similar issue when I checked out a web project from a github repo on my eclipse. src/main/java was directly inside the project root in Package Explorer. My expectation was that src/main/java be visible inside a source folder "Java Resources". There were few things which I did to achieve this.
Right click on Project > Build Path > Configure Build Path..
Select filter "Java Build Path" and click on Tab "Libraries"
Verify your "JRE System Library". If it is not pointing to your latest JDK, then you can click on Edit Button and follow the subsequent dialog boxes to select most appropriate JDK home path in your system.
Once done click Apply, Apply and Close, Finish to close all the associated open boxes for the current filter.
Select filter "Java Compiler" and ensure your JDK Compliance points to correct JDK. Click Aapply
Select filter "Project Facets". Ensure both Java and Dynamic Web Module is selected with correct version.
Click Apply and Close.
Source folder "Java Resources" gets created with src/main/java in it when viewed in Project Explorer.
Navigate > Show In > Package Explore
Right click the Maven Project
-> Build Path -> Configure Build Path
Go to Order and Export tab,
you can see the message like '2 build path entries are missing'
Now select 'JRE System Library' and 'Maven Dependencies' checkbox
Click OK
I have solved this issue by below steps:
Right click the Maven Project -> Build Path -> Configure Build Path
In Order and Export tab, you can see the message like '2 build path entries are missing'
Now select 'JRE System Library' and 'Maven Dependencies' checkbox
Click OK
Now you can see below in all type of Explorers (Package or Project or Navigator)
I used this tutorial to create my maven web project http://crunchify.com/how-to-create-dynamic-web-project-using-maven-in-eclipse/ and eclipse did not create src/main/java folder for me. When i tired to create the source folder src/main/java eclipse did not let me. So i created the folder outside eclipse in the project directly and then src/main/java appeared in eclipse.
I was not able to see the build path option in the properties as well. Also the
src/main/java
was not visible in Project Explorer. below solution worked for me
Go to Project root
Select "Project facets" from Properties
Check "Java"
This fixes the issue
If none of the answers worked for you. You might be in the wrong "Window". I was in "Package explorer" and switching to "Project Explorer" showed me the folders.
Right click on the project > Build Path > Configure Build Path > Source > Add Folder > Select src/main/java > apply and close > refresh the project.
This error happens when there are no files inside /src/main/java
Just make some empty files inside and the problem will go away.
A side note: lots of version control systems (mercurial for example) do not commit folders if there are no files inside.
After creating the project go to properties --> build path --> configure build path --> order and export tab and check jre and maven dependencies. You will then have the folder.
Right click on eclipse project go to build path and then configure build path you will see jre and maven will be unchecked check both of them and your error will be solved
My problem was kind of the same at first and then a little different in the sense that when /java folder showed up, it was deep down in a nested folder somewhere in src/main/resources/java.
Initallially the problem was being in the Package Explorer and not in the Project Explorer as many people have talked about. So,
a. right-click on your project root
b. show in, and select Project Explorer
However, the main problem was I missed to notice a checkbox at the second step of Maven Project Creation from the wizard. That got me created a complicated structure and not a clean direct one.
Once I marked it checked I got a clean project structure as what asked.
I was also facing the issue but I open POM xml file and keep it open. Wait for some time till maven read pom then Automatically it will come.
I tried all the solutions mentioned in this post but none of them worked for me.
The solution for me was to go to build-path and then into Source tab. I found src/main/java folders present there and there was no error. I double clicked on this folder and a window opened like this:
Do not make any change and click on Finish. The folders will appear suddenly.

Eclipse: "declared package does not match the expected package", but buildpath does define the declared package

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.

Import maven project in eclipse - folder structure not as expected

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.

eclipse project not importing the jar packages in local Maven repository

I am facing a problem in setting my eclipse project.
The problem is whenever I am creating a new project and import the code.Eclipse is not resolving the packages which are present in the jar files which are present in the C;/..../user/.m2/repository.
Hence it's giving a lot of compilation errors until I add all the required jar files manually in the build-path by going to "Add External Jars"
I saw that M2_REPO is present in my Eclipse classpath.But still it is not resolving the packages.
Please suggest how this problem can be resolved.
Gaurav
I've been having a similar error in Eclipse on OSX. In Eclipse on the Mac, there is no "Maven" entry when you right-click on a project in the explorer.
However!
I just discovered that if I right click and then click "Validate", it suddenly magically resolves all the dependencies. No idea why, but maybe this will help.
I've had this issue on Eclipse Kepler EE which comes prebuilt with m2e, I finally got it working by doing the following on each project:
Right click on the Project
Select Properties
Select Maven
Uncheck the option that says: Resolve Dependencies from Workspace projects
It should pop up with a box that says Maven setting has changed. Do you want to update project configuration. Click Yes to this.
To confirm:
Right click on the project
Select Properties
Select Java Build Path
Check the Libraries tab under Maven dependencies that all the jar you
expected are now there.
close your project, and remove your project settings files: .project, .classpath, .settings/. Then re-import this project. It will be ok.
Though this answer is late. But it can help the future audience.
You can give it a try using Project(Right-Click) -> Maven -> Update Project. To select all or the number of projects you want to update.
This worked for me.
Have you put all needed dependencies in the pom.xml? Even if the Jars are already in your local repository, each project needs its dependencies mentioned in the pom.xml to resolve the dependencies. If you do that, m2eclipse will automatically resolve the build path.
Another possibility. Are you running Eclipse using JDK or JRE - the default is JRE. You will see a warning in Eclipse console, if so.
maven eclipse plugin will not work correctly unless run with JDK.
I just had a similar problem. The JDK was there, the problems view was set to Show All, and yet there were hundreds of unresolved type errors. Not even Refresh (F5) would work.
In the Project|Properties|Java Build Path|Libraries window I was seeing only the JRE System Library, but not the desired "Maven Dependencies" entry. And "Maven Dependencies" was also missing from the Package Explorer view as well.
I finally fixed this by right clicking on the project in the Package Explorer, selecting Maven from the menu, then selecting "Update Project Configuration." This added "Maven Dependencies" and all the errors went away.
This was nice because prior to this fix I had to treat Eclipse like a dumb editor and run mvn compile on the commandline to find errors.