How do I change in an eclipse web project the WebContent folder to something different? - eclipse

With the Galileo release it is finally possible to convert a normal Java project to a dynamic web project. Unfortunately it assumes that the Web stuff is located in a folder WebContent, which is not necessarily the case for an existing project. How can I change it? In MyEclipse it is quite easy, but with a stock eclipse I don't find such an option!

I am not sure what you meant by "a stock eclipse", but Helios allows this functionality in a very straight-forward way:
Right click your dynamic web project and open "Properties".Find Deployment Assembly and you should be able to set context paths from there.

I am not sure if there is UI for this or not, but you can edit file .settings/org.eclipse.wst.common.component, and change following line:
<wb-resource deploy-path="/" source-path="/WebContent"/>
Change /WebContent to your preferred directory. I use this for a several years now and encountered no problems with it.

Go in the project properties and do like this example where I use the Maven webapp folder:

Related

Importing Netbeans project to Eclipse

I have created a GUI Applicaiton using Netbeans because of several obvious reasons like GUI Builders and all.
Now I want to implement Hibernate as ORM in this app in eclipse , because of the Hibernate plugin that makes it very simple and time saving .
How can i import that Netbeans project to my Eclipse IDE . I know there is no direct solution for this .
I have tried to find (.war) file under dist, but its not there even after clean and build in netbeans. So please tell me a way to make it done .
I also faced the similar problem. What I did was I copied .project and .classpath files (from my other eclipse project or you can create it, I was too lazy) into the netbeans project directory and then simply imported the project into eclipse. now I can make UI changes in netbeans and edit the other part in eclipse.
For the problem of AbsoluteLayout you need to make a classpath entry in ".classpath" file for AbsoluteLayout.jar
Hope that solves your problem.
I also faced a similar problem with my project the best way to solve this issue to do the configuration manually on eclipse. Its tiresome but there is no shorcut way to it..
Goto eclipse and create dynamic webproject
Create the simlar packages
Create same folder in the WEB-INF directory
Paste all the content(Source code, jsp file, js, css etc.)

How do you change a NetBeans project type after it has been created?

I created a project from existing sources as a PHP project in an older version of NetBeans.
I now want to change the project type to an HTML5/CSS project in NetBeans 7.4.
Is there any easy way to change the type of an existing project in NetBeans?
I'm trying to avoid creating a new project from existing sources as I have all my server connection variables already configured.
The project data is stored within the main project directory in a subdirectory named nbproject.
The file project.xml contains the main configuration data for the TYPE of the project. The type and data xml namexspace settings determine the basic project type. Here is a PHP version:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>codex-slp</name>
</data>
</configuration>
</project>
Here is an HTML5 project version:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.web.clientproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/clientside-project/1">
<name>csa</name>
</data>
</configuration>
</project>
Note the line is different. The HTML 5 project uses the namespace org.netbeans.modules.web.clientproject. The PHP version is at org.netbeans.modules.php.project.
Also of note is the data xmlns entry with HTML5 pointing to the clientside-project directory while PHP points to the php-project directory.
How to change the project? Not easily. Your best bet:
Close out the NetBeans IDE.
Go to the project directory.
Remove (or rename) the nbproject subdirectory.
Open NetBeans.
Create a new HTML5 project from existing sources.
That will switch the project type from PHP to HTML5 and give you the corresponding dialogue boxes.
The reason I decided to take this approach is there are a lot of other things that hang off this namespace specification. The project.properties file, for example, has very different entries for a PHP project, thinks like the PHP version, that do not exist for the HTML5 project. The HTML5 project has new properties that are not present in PHP projects.
There is also an entire private subdirectory that has a plethora of options set in the private.properties file that contains things like the source remote connection for a PHP project that does not exist nor seem to even be SUPPORTED for an HTML5 project.
There are far too many disparities between the two project types to simply hack up the nbproject directory files and hope it works.
IMO your best option is to follow the steps above to recreate the project.
Sadly, it does not appear as though HTML5 project types have matured to the point of the PHP project types with things like supporting remote pull/push of changed files. For this particular project I've reverted back to the PHP project type even though this is not really a PHP project. I heavily rely upon the automatic remote server push via FTP. How did I restore the project? I renamed my nbproject directory to saved_nbproject, so to revert:
Close Netbeans.
Go to project directory.
Rename my saved_nbproject directory back to nbproject.
Restart NetBeans.
Maybe changing project types AND HTML5 remote server support will be available in the future. For now, with NetBeans 7.4 it does not appear this transition is readily available.
If anyone else has input or other feedback I'd love to hear it as NetBeans has become my go-to tool for complex code projects.
NOTE: I would strongly suggest to create a new project from existing sources to ensure everything will work as expected. In most cases its faster and less problematic.
(If you persist....)
Following the accepted answer may result in an error. Besides what Charleston Software Associates posted, you may need to copy other variables included in "project.properties" file.
For example, these are for PHP: (adjust properly. I suggest to see some of your other projects to prevent mistakes).
auxiliary.org-netbeans-modules-php-phpunit.bootstrap_2e_create_2e_tests=false
auxiliary.org-netbeans-modules-php-phpunit.bootstrap_2e_path=
auxiliary.org-netbeans-modules-php-phpunit.configuration_2e_path=
auxiliary.org-netbeans-modules-php-phpunit.customSuite_2e_path=
auxiliary.org-netbeans-modules-php-phpunit.test_2e_run_2e_all=false
ignore.path=
include.path=
php.version=PHP_53
source.encoding=UTF-8
src.dir=/var/www/example
tags.asp=false
tags.short=false
web.root=.
These are for HTML5:
auxiliary.org-netbeans-modules-css-prep.less_2e_compiler_2e_options=
auxiliary.org-netbeans-modules-css-prep.less_2e_enabled=false
auxiliary.org-netbeans-modules-css-prep.less_2e_mappings=/less:/css
auxiliary.org-netbeans-modules-css-prep.sass_2e_compiler_2e_options=--style compressed
auxiliary.org-netbeans-modules-css-prep.sass_2e_configured=true
auxiliary.org-netbeans-modules-css-prep.sass_2e_enabled=true
auxiliary.org-netbeans-modules-css-prep.sass_2e_mappings=/scss:/css
auxiliary.org-netbeans-modules-javascript2-requirejs.enabled=true
auxiliary.org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder=js
config.folder=${file.reference.example-config}
file.reference.example-config=config
file.reference.example-test=test
file.reference.www-example=/var/www/example
files.encoding=UTF-8
site.root.folder=${file.reference.www-example}
test.folder=${file.reference.example-test}
You can mix both in a single file without any problem.
Using: Netbeans 8.0.1
Try to edit your project.xml replace type with
<type>org.netbeans.modules.web.clientproject</type>
Guys this has changed for version 7.4?
in private.properties
remote.connection=remotename
remote.directory=/public_html/
remote.upload=ON_SAVE
run.as=REMOTE
url=http://remotename.com
I tried changing xml and that didn't work well for me. I fiddled around and found a way that seems simpler to me - just delete and create a new project!
Right click the project in netbeans, and click delete. (make sure to NOT check the box that says delete sources!). That clears out the netbeans project info. Then just make a new project of whatever type you want. Go to File->New Project. Select project type (in this case HTML5 Project with existing sources), making sure to select the one that has "with existing sources". Hit next. Now here is a key part. The site root is your mysite/public_html folder most likely. The project directory is your mysite folder. The netbeans config will be put in the mysite folder.
Then you should be good to go!
Close Netbeans.
Delete nbproject folder inside your app folder. It can be hidden folder , so , in windows, go to folder properties and activate hidden folder.
Reopen Net Beans. Create a new project of the correct type.

Where is the bin folder of GWT Internal Jetty Server in DevMode?

I need to put some property files (config file required by a library) in the starting path of the Jetty server in DevMode but could not figure out where to put them. Where should I put them?
I googled but no luck for that. Any help is appreciated.
You need to share your project set up information. Maven? Also mention whether property file is for app or jetty and what you are trying to achieve.
Also you can try putting up the properties file in web-inf/classes if it is project specific.
I am guessing you are not using any standard GWT project set up. It will be very difficult to proceed further even if you get this solved. I recommend you should go with gwt standard set up. You can reference GWT samples folder from here.
Use Hello project set up as template. If you are beginner also read up on https://developers.google.com/web-toolkit/doc/latest/RefCommandLineTools#webAppCreator.
If you use maven in your project, placing them in the src/main/resources should work.
Otherwise put it in your WEB-INF/classes

Dynamic Web Project libraries

Good morning in my timezone.
I have imported one Dynamic web project to my eclipse. I have downloaded the Tomcat server.
If I work without any IDE, I know that every libraries that we use in the project must be inside the lib folder in tomcat.
Folder structure : Tomcat\webapps\WEB-INF\lib
My question is, if I need a library (*.jar) should I put it directly in the lib folder or should I configure in the build path, adding it in the libraries tab?
Second question, my project steels have the red cross above the project name, but I do not see where the error is, in the src folder no class have any error and inside the Web Content folder there is not any cross, so how can I know where the problem is?
Thanks in advance.
Best regards developer community.
There shouldn't be any need for configuration, just copy them in the lib folder.
Make sure you have set the right jdk and the server libraries. right click on project -> build path -> configure -> libraries. if there is no tomcat runtime lib, you should add it.(I assume tomcat is embedded in eclipse. If not, right click on servers(next to console) and add the tomcat server.)

In eclipse, is there a way to specify a location other than the WEB-INF, for web.xml

I want to place development web.xml in another folder in eclipse.
This can be done using the Deployment Assembly properties. Right click on the web project, choose Properties, and then navigate to the Deployment Assembly panel. Remove the /WebContent entry (pointing to /) and then add another entry, of type Folder. It should be rooted where you want to keep the web.xml, and mapped to /.
This technique can be extended to make Eclipse work with arbitrary build tool source layouts.
You might want to use Apache Ant
for that purpose. You may define a "conf" directory and place all you config files there, or a resource directory for the same reason.
If haven't use ant for that purpose, I strongly recommend you to do so.
Here is a sample ant build.xml for a web app Sample Build.XML
I'll use Maven myself, but since you're just beginning, Ant would be just fine.
I am using the eclipse builder and not ant.
Actually what i did was that i defined web.xml in another folder. So now I have two web.xml, one for welogic with a lot weblogic specific stuff like filters. And i have another for development which i placed in another folder, in the web project and added this folder to the deployment descriptor for tomcat in eclipse. So now when i deploy the application, the web.xml for tomcat which is in my specified folder owerwrites the web.xml present in web-INF folder(in the deployment directory).
Looks to me a nice workaround.