Eclipse Dynamic Web Module and Apache Wicket - eclipse

I want to place .html files in the same package with .java files under /src/main/java but when creating new .html file Eclipse offers /webapp as the default folder. Is there any way to change this behavior?

The default is to offer to place it in a folder that will be deployable to the server and readable by clients. You're still able to pick another folder, aren't you?

I like to put my Wicket HTML files in the /src/main/resources folder. Then I mark that folder as 'source folder' in Eclipse (Project Buildpath).
So that, I have the HTML separated from the java files, but they will be packed together (both with Eclipse and Maven).

Related

How to delete only class files with eclipse?

I have dynamic web project in eclipse. I set my default output folders (my class files) to be in WebContent/WEB-INF/classes. I have another files in this folder like .properties and .xml files. The problem is when eclipse make clean or new compile or I dont know exactly but sometimes it delete all the files from this directory. Do u know how to set eclipse to delete only the class files and never touch the other ones?
put your .properties , .xml files in source folder of your web project and not in classes folder. doing this way, eclipse will directly copy those files from source folder to classes folder after a build.

How to display the source code of an external JAR in Eclipse?

In Eclipse, I just imported an external JAR. Viewing any of the classes in the Package Explorer will instead of showing a source code open a Class File Editor with saying "Source not found". The folder of the JAR I have downloaded, however, has only JAR, no lib, no src, no docs.
Is there still a way how to view/generate a view the source code so then I can view it in Eclipse properly?
.jar files don't contain source code but are more like binary files for Java.
You can either get the source code from the projects page (if it is an OpenSource project of course)
An other possible way to view the source code of a .jar file is by using a decompiler (http://jd.benow.ca/; Also has a Eclipse plugin I think). This method can be very painful though when an obfuscator has been used by the developer who generated the .jar file.
Try this :
Download java decompiler from http://jd.benow.ca/ and now double
click on jd-gui and click on open file.
Then open .jar file from that folder.
Now you get class files and save all these class files (click on file
then click "save all sources" in jd-gui) by src name.
You cannot view the source form a .jar files as it contains binaries.Use a java decompiler instead to decompile the .class files and view their sources.
If possible I suggest you to use Maven for manage dependencies of your project, in most cases it did the trick for you.
See: Get source JARs from Maven repository

Best way to open phonegap project created with CLI in eclipse

When I create a phonegap folder structure via the CLI (3.0), how do I open this in Eclipse?
When I choose project [New] - [Android project from existing code], the assets are taken from the platforms/android folder. But I need to change the html and js of the top folder (www). These are the files that are being used when I build the project to other platforms (via CLI or build.phonegap).
Now I change the assets in the editor of the eclipse environment and then manually copy paste the content to the files under www.
Actually PhoneGap project structure and Eclipse project structure are somewhat different. But they work in a similar way. If you want to create phonegap project in eclipse then you have to create html,js,css within asset/www folder. The java source files will be within src folder(as usual).
If you want to create project without eclipse like with command phonegap/cordova create MyApp, then you will get all java source file within project/platform/android folder and html,js,css in www folder which is auto-created. On the other hand in eclipse you have to create this www folder manually.
But project is compiled in a same way whether it is created in eclipse(IDE) or in other text editor.
I have experience in both Eclipse and Text Editor(SublimeText,Vim). I prefer Text Editor because Eclipse sometime creates problem and it needs some extra things like creating www folder and place all scripts,templates,css etc manually.
If anyone whan to go with CLI, then I think SublimeText,Vim,gEdit etc are the best choice for coding.

Webcontent code modified from eclipse not updating

I have java source code of about 3000 classes & other web content (js, css, html). I imported the project in eclipse(indigo) and run the project on Tomcat6. After ant compile.complete.deploy, a new folder ${env.CATALINA_HOME}.
I am modifying few js & html files from IDE, but it doesn't reflect in the browser. I reloaded the page several times, but no changes are done.
In Project -> Buildautomatically option is checked.
Do i need to modify on the files in ${env.CATALINA_HOME} or the direct src code is fine?
For all the UI related content - Webcontent folder files needs to be changes. And when new class files are added or existing classes are modified then "ant smartbuild" does fine.
--
thanks.

Ignore SVN files when exporting a WAR file from Eclipse?

I have a Dynamic Web Project in Eclipse. I can pack it to a WAR by right-clicking the project and choosing Export > WAR File. This creates the WAR file as expected and it works.
The problem is that Eclipse includes all the .svn folders of the project into the WAR file.
Is there a way to tell Eclipse to ignore .svn folders in the WAR exporting process? Or even better, tell it to ignore all files or folders that match some given regular expression?
Enter the project properties > Resource > Resource Filters > Add... > Exclude All > Files and Folders > All children (recursive) > Name matches *.svn > OK.
All .svn files and folders will be ignored, including when you export WAR files.
This seems to be documented in bug 182534 (2007! And still opened).
A custom separate ant script would be needed for now in order to build the exact war.
The internal "Export War" eclipse feature is not yet good enough for this scenario.
Installing the Subclipse plugin will make Eclipse aware of the SVN folders.
This also includes ignoring them in a WAR export.
You could use an svn client to do the trick. For example TortoiseSVN let you export a directory without .svn folders and files.
So what you could do is:
Export you war
Unzip it (a war is a zip file with changed extension)
Tortoise-export the directory (remember to check "Include unversioned files" cause your .class will probably be unversioned)
Zip the new directory and rename it to .war
This is not a good workaround but it saves you from checking every subfolder in your war to see if some .svn has not been removed.
While exporting the project just uncheck the unneeded folder like ".svn" in the Project Export wizard like this