Eclipse deployment descriptor not found - java

I have a dynamic web project created in eclipse. I moved the location of the WebContent folder (to be located within the /src folder). However, the project still thinks that the directory is under /projectName/WEB-INF/ (I know this because when I try to open an element in the deployment descriptor it tells me that that path does not exist (it doesn't exist, but I need to have it point to the new location).
How can I point the build to the new location of the WebContent folder (and WEB-INF etc.)? Thanks.

Right click your dynamic web project -> Properties -> Deployment Assembly.
In Web Deployment Assembly, change the package structure to reflect your change. That should work.

Windows > Show view > Project Explorer should show "deployment descriptor" again

The original answer was unclear on the second step -- from the Web Deployment Assembly dialog, at the bottom is an Advanced toggle, which when opened will show the folder selection dropdown.
And I intended to give a link to the Eclipse documentation for the WTP Deployment Assembly Property Page -- however I cannot find it...

Go to windows > perspectives > reset perspective will possibly resolve this

Sometimes we are in default Java perspective , change it to Java EE perspective and if everything is correct then deployment descriptor is visible .

Uninstall Enterprise edition from Eclipse Market and then Install it again. My issue got solved by this

Related

Eclipse does not show src file

I have three different projects in my eclipse and yesterday src file became unvisible in one of the projects. Two days ago it was ok and I have no idea how this happened. I can not see src file in project explorer or package explorer.
Project Explorer :
However, if I look with navigator I can see all files in the directories.
Navigator :
I use Eclipse Indigo SR2 and IBM Rational ClearCase for first two project. The other is my local test project.
Do anybody know how can I get back to src file into the project explorer?
Thanks.
Try to right-click on the project and click on refresh.
I had the same problem today, it is because i switch to wrong view model.I suggest you to switch the project explorer to Package Explorer.
Check your Java build path to make sure the src is present. Right click the project and select Build Path -> Configure Build Path. If the src directory is not present in the build path, it will not show up under the Java area as you have shown, but it will be present in the Navigator.
I had the same problem in Neon - src folder had disappeared. One sub-directory in the src folder would show up but no other sub-dir and not the parent src file itself. No matter what I did in the buildpath configuration only the one sub-dir would show up. It looked like some kind of corruption in the settings. None of the above solutions worked for me, including deleting the project and all files, and then re-checking it out.
What did work was switching to an old workspace, importing a project and then switching back to the workspace with the issue. Magically, the project with the problem was again responding to my changes in the buildpath configuration. I'm not sure if I had to do the interim step of importing fromt he old workspace or not - possibly just switching back and forth would have worked but not sure.
Try removing (deleting) the project without removing the files (there is a checkbox that allows you to keep the project files).
Then re-import the project. Not sure if this will solve your problem, but I was facing the same issue and delete->re-import resolved it for me.
I had this problem today, and the issue was that the "src" folder was not correct in the "Source" tab of "Configure Build Path" window. It was there but the path was wrong, so it had a red X. Deleting that entry and re-adding the "src" path (from the project) resulted in putting the "src" folder back into the packages hierarchy.
In my case, this happened because of sharing the workspace between user accounts, the paths to the workspace and the folder beneath were not the same. One user accessed the workspaces locally, the other as a mapped drive, etc.
Fixing this and then standardizing the path to be identical for all who access sit, resolved the underlying problem that caused this issue to surface.
Restart your eclipse work space.
Also change open perspective in eclipse.

Eclipse & Tomcat: How to deploy a project to differently named directory

I am using Eclipse Juno. I'd like to know how, if possible, to deploy a workspace project ('Foo') to a folder under Tomcat called 'Bar'.
Some points to note:
Project name in eclipse: Foo
Folder that gets created when I publish: $TOMCAT/wtpwebapps/Foo
Folder that I wish to be created: $TOMCAT/wtpwebapps/Bar
I have set the 'Context Root' under 'Web Project Settings' to Bar
The project has the 'Dynamic Web Module' facet applied.
I am not asking about the way in which I would access this project via the webserver (ie., http://localhost:8080/Foo vs http://localhost:8080/Bar). I explicitly mean the name of the folder to which the content is deployed.
MyEclipse is able to do this. I don't want to use MyEclipse, so would love to know how to achieve this using the vanilla version.
Thanks in advance!
Open the project's Properties dialog (either from its context menu or the main Project menu with that project selected) and change the context root on the Web Project Settings page.
You can write a script which copy your /desired_folder to your desired_directory and call that script in your code at the end or somewhere in eclipse properties after compilation or execution.It may works fine

Java Web Project not building correctly

I've got a Java Web Project which I'm deploying to a Tomcat embedded in Eclipse's Servers Plugin, alas, when I navigate to the location of that webapp after publishing/starting the server, the .class files are all missing. I can navigate as far as ProjectName\WEB-INF\classes\path\to\packages\ -> All packages are empty.
Any Idea how to solve this problem?
Edit
Build Automatically is checked and it compiles just fine for another web project I've just included, just not for the one specified
Edit 2
Reinstalled Eclipse (because why not) - nothing's changed, works for Project #2, doesn't work for Project #1. Not even the path to the packages is existant now. The content of the src folder (that's supposed to be moved to WEB-INF/classes) isn't there at all - but the resources (I've got a resources folder with the same deployment assembly command) are.
A few steps to perform to restore sanity...
Refresh your project. It is possible that something was modified on the file system external to Eclipse.
Kick of Project -> Clean.
Now look at your project (not the deployed location) on the file system. Do you see the expected files in the /bin directory (or whatever you may have changed class output directory to)?
Let's now try exporting a war using the wizard. File -> Export -> Web -> WAR or something like that. Check the WAR contents. Are you .class files there?
If everything is good so far, there is nothing wrong with your project. The Tomcat server adapter just got confused.
In the Servers view... Make sure Tomcat is running. Next right click on Tomcat and select add/remove projects. Remove your project. Confirm that your web app is no longer accessible.
Now re-add your project via add/remove projects or invoke one of the run as actions.
The above should reset Tomcat server adapter and hopefully things should work as expected.
Check if you had deleted or moved your external JARs associated with the project on your IDE. I had moved it and ran into the same issue.

Linking Eclipe projects together using 'Deployment Assembly' and 'Build Path' options

I have a simple java project with this basic structure:
IncludeMe
src
deploy
siteSpecific
-> site1
-> site2
-> etc...
I also have another project which I check out as a Dynamic Web project.
I add it to a tomcat7 instance and run it locally on my machine.
MainWebApp
src
deploy
WebContent
-> resources
-> templates
-> etc...
What I need is to include the 'siteSpecific' folder from the 'IncludeMe' project under the 'WebContent' directory in the 'MainWebApp' project.
So if I make a change to files under 'IncludeMe->siteSpecific', they are automatically picked up and applied by my MainWebApp under 'MainWebApp->siteSpecific' i.e. I do bot want to have to manually copy the contents between the two separate projects.
I currently do the following with no luck:
- Open 'properties' of 'IncludeMe' and go to 'Deployment Assembly'
- Select 'Add' and choose the 'SiteSpecific' folder.
- Source then reads '/siteSpecific' and I adjust the deploy path to be 'siteSpecific'
- Open 'properties' of 'MainWebApp' and go to 'Java Build Path'
- Go to 'projects' tab and add the 'IncludeMe' project.
I'm using Eclipse Indigo 3.7 by the way.
Any help appreciated
Thanks
This is a bit hacky solution but the only one I found when I needed something like this.
The trick is to link external source folder and then use it in "deployment assembly"
Do the following:
Right click on Your webapplication project (MainWebApp)
Build path
Link source
Variables (Here we will add variable that points to our external project, relative to our current project)
New (add something like: "${PROJECT_LOC}..\IncludeMe" in "Location" and some name for new variable)
OK
Extend (You should extend variable You've created on prev. step).
Pick right folder and press OK.
Next.
Add exclusion pattern to prevent eclipse from building anything from that folder.
Finish
After this dancing You should be able to see linked folder in "deployment assembly"...

When does Eclipse copy resources to the output folder?

I noticed that "sometimes" the resources i put into a source folder in my Eclipse project will not be copied to the output folder ("bin") immediately.
E.g. i change a properties file using the eclipse editor and save... and "bin" still has the old version.
Does anyone know what exactly triggers the copying (and how i can trigger that from a plugin)?
I thought it happened automatically when a resource changes.
-- EDIT --
To clarify what i meant by triggering it from a plugin: I have a plugin that depends on up to date resources in the output folder, but apparently the resources are outdated when my plugin is called. And that's why i need to better understand what happens and how i can force it when i need to.
If you don't add the resource through eclipse (but for instance through the windows explorer), eclipse wont notice some changes until you refresh your project/folder. (right click in the packater explorer for instance).
After it notices the change it will copy it to the output folder when you build (often this is done automatically upon changes)
This is a Bug in almost all Eclipse versions, it happens without any reason. My eclipse 3.5.2 and 3.6.2 both meet this problem in someday. In my case, I need to copy modified .clj clojure source files to classes directory for immediate effection in a web app, now I have to set /src before /classes in CLASSPATH of web appserver startup script, It's solve my problem temporarily.
As #Thirler said, if you don't add the resource through Eclipse, it may not notice the files until you refresh your project. However, if the Refresh/Clean doesn't work (in my case, it didn't), you have to add the files to the folder structure IN ECLIPSE.
Just drag the file from the folder where it is in the file system using Finder/Windows Explorer, drop it into the same folder in Eclipse's Project Explorer (Eclipse will ask for overwriting, just say yes) and Voila!
EDIT:
An easier way is to just navigate into the folder using Project Explorer and then Refresh (F5).
As far as I know it happens when you build the project. You don't need a plug-in, you just need to tell eclipse to do a build of the project.
There is an Eclipse setting Java > Compiler > Building > Output folder > Filtered resources.
For unknown reasons, this was set to *.launch,*.testsuite,*.deploy,*.location,*.execution,*.datapool,*.artifact,*.html,*.svg in my workspace (while the default seems to be just *.launch). This was the reason, why my Eclipse constantly refused to copy a classpath resource index.html.
Late response, but I just stumbled over this question but non of the answers helped me to convince Eclipse to do its job.
This happened to me when I imported an Eclipse project as a whole, including both src and bin directories. The fix is to Clean the project: Project -> Clean... -> select your project and press Clean. This should re-build the project and properly locate the resources needed.

Categories

Resources