My collection of Eclipse tips and tricks. I also have an Eclipse Cheat Sheet.
Change the context root in an Eclipse Dynamic Web project.
Once you do this it is necessary to clean up the deployed resources. This may be accomplished in the server view, e.g. choose Window >> Show View >> Servers.
Click OK in the confirmation dialog.
See also How to change context root of a dynamic web project in Eclipse?
Right click on Deployment Descriptor in Project Explorer.
See also web.xml is missing.
You can also get to it with the Project >> Properties >> Java EE Tools right click context menu.
Typically applications are deployed to .metadata/.plugins/org.eclipse.wst.server.core/tmp0
. You can customize this in the Tomcat server configurationby double-clicking on the Tomcat server.
See also:
To switch to a Maven-style layout of src/main/java
first remove the reference to src
by right mouse-clicking on it and selecting build path >> remove from build path. At this point src
will appear as a regular folder.
Next create the main
and java
folders under src
. Move the existing files. Finally, right mouse-click on the new java
folder and select build path >> use as source folder.
See also:
Where to put the JUnit tab?
One of the things I really hate is the little red error icons when I am working on a Maven project in Eclipse. One of the "gotchas" is using Maven-generated source code.
I added the following plugin to pom.xml in the build section.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/java/</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
Window -> Preferences -> Maven -> Discovery
I ran that and it suggested the Maven Integration for Eclipse JDT APT plugin, so I installed it too.
You will also need to:
Install the "Apt M2E Connector" from the Eclipse Marketplace. Ensure there are no plugin execution filters for the build-helper-maven-plugin (see http://wiki.eclipse.org/M2E_plugin_execution_not_covered).
I've spent some time getting Eclipse to where I like it, so I'm passing along some of the knowledge.