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
Related
I work in an organisation where i am provided with a folder having codes and other things for particular application.
I want to open this folder in eclipse and be able to navigate to all the classes that are used through resources(ctrl + click).
The problem is when I imported the folder the eclipse worked same as that of a notepad. Any changes no error would be shown.
I even added the required jar files for that project.
What should I do? I just need to navigate and check out the classes that are used and declared. Pls Help.
P.S. - I work on Ubuntu Machine.
If you have a java project, you may need to configure the source directory(s).
This can be done by right clicking on your folder -> Build Path -> Use as Source Folder.
I have 2 web projects and 2 framework projects in my Eclipse workspace. I copied one project to another and changed names in the .project file. All code and JSP pages compile fine. When I go to the Add/Remove dialog of my Tomcat eclipse server the new web project shows up named properlyy but in parenthesis it has the original project name. This is true of the new framework project also. Does anyone know where I need to change the name.
Found it.
.settings\org.eclipse.wst.common.component
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.
I'm having a little problem configuring my Tomcat Project. In short, I'm working on a Dynamic Web Page project but there seems to be some confusion as to from where I am running the application.
Running the following code
File f = new File("");
System.err.println(f.getAbsolutePath());
yields the output C:/Eclipse which happens to be where I run Eclipse.
Normally I'd expect this to be the output catalog, but it is not the case this time.
My eclipse project is configured to have myProject/WebContent/WEB-INF/classes as output folder
How can I configure to the desired directory? Right now I need to use absolute paths which won't work for all members of the project.
Alright, I found a solution.
It seems my default working directory was set to my eclipse folder for the project so i solved it by specifying the project root folder instead which normally is the case.
I configured this here:
Run configurations > Apache Tomcat Run configuration > Arguments tab, under "working directory" choose "other" and specify directory.
Thanks for your comments!
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