In Eclipse / STS / maven, where do I define the deployed servlet name? - eclipse

I have the Eclipse (STS) with Maven installed. I've named the project ExchangeBoardRest. When I run the program from the embedded VMWare tc server it deploys to localhost:8080/ExchangeBoardRest/index.jsp, etc. I don't want it there but in localhost:8080/exchangeboard/index.jsp.
I'm not seeing where I can change this. I figured perhaps the pom.xml would do this for me (I update the maven project right afterwards). I don't have ExchangeBoardRest in any interesting text files (just in .settings, .project).
I don't want to have to edit the server.xml that VmWare tc creates. Is there something easy I'm missing?
Thanks,
Jerome.

I'm not using STS, but Eclipse and m2e with WTP. But I guess it's the same thing:
Right-click on the project in the project explorer and select Properties.
Locate Web project settings
Change Context root setting as you desire.

Related

Eclipse tomcat project context menu option

I recently upgrade to Eclipse Kepler and I loose the context menu option Tomcat project to create war file to deploy an application.
What can I do?
I am not that much familiar with this plugin.
But can you verify your installation from its official page link .
Its mentioned that you need to add a couple of other dependencies manually. Like DevLoader.jar and the Sysdeo Eclipse Tomcat Launcher plugin
Edit
If you just want to deploy the project to your tomcat, you can use the Run as option as well. Just right click on the project, select Run as and then Run on Server
And to make a war, you can simply export as war from the export option (Right click on project -> export
)

How do I mavenize a JSF 2.0 project in eclipse?

I have a JSF 2.0 project on my eclipse. I would like to mavenize the same preferably from Eclipse itself. I tried doing it from outside the eclipse manually. There are quite a few steps and I don't like the manual nature of that approach. Could someone help?
Make sure that you have the standard folder structure as recommended by Maven for web projects. Follow this link.
Now, install maven plugin in eclipse (am not sure if it is available by default or we have to download it manually). Simply right click on the project, select Configure and Convert to Maven Project. This should automatically do all that steps to takes to mavenize your current project. This will create a pom.xml file and you can modify it going forward as per your requirements. By the way, I use Eclipse Juno.

Eclipse Juno, maven project not able to run on server

I upgraded to Eclipse Juno(for Java EE developers). I installed Maven Integration for Eclipse through marketplace.
Just to test, I created a web app using maven-archetype-webapp. I cannot run on server(There's no menu Run On Server). The same happens with another maven project which runs fine using Eclipse Indigo. A tried deleting .settings, .classpath, .project then re-importing the project but nothing. I was hoping so much on Juno!
Does anyone know a real solution to this problem?
May be Dynamic Web Module in Project Facet is not selected
Go to :- Project > Properties > Project Facets > check Dynamic Web Module
How about installing the m2e-wtp plugin and trying? You would want to confirm that the maven project is of war packaging as well.
Run on server is not a maven feature, it's a "classic eclipse" feature.
In order to run a maven project on a server you must adopt a plug-in (e.g a Jetty plug-in for your webapp) and the run the proper maven goal (e.g jetty-run).
Said this, you can run a web project on a server with (right-click) > Run as > Run on server if you have the proper runtime environment configured.
Enabling "Dynamic Web Module" in Project Facets may not help here in maven projects.
Because maven projects are structured differently (target/sampleApp-1.0-SNAPSHOT.war) than the normal Dynamic Web Projects (WebContent/).
So, If you use Dynamic Web Module manually, then eclipse will try to use "WebContent" directory structure as deployment directory for Application Server which won't be the case in maven projects.
Solution is to use m2e-wtp plugin to do the deployment.
If you installed m2e-wtp plugin, it'll automatically detect your maven project type & it'll show you the "Run as Server" option in "Run as" menu in "Project".

Eclipse:Run on server option not visible for maven project

I'm running through the jboss as7 getting started guide here http://hudson.jboss.org/jenkins/job/JBoss-AS7-Docs/lastSuccessfulBuild/artifact/guides/developer-getting-started-guide/target/docbook/publish/en-US/html/helloworld.html . The tutorial has us setting up an example helloworld quickstart maven project.
I'm able to deploy this project from the command line successfully
mvn package jboss-as:deploy
but when I attempt to deploy the helloworld example from Eclipse - the 'run on server' option is missing from the run menu. I have Eclipse 3.7 and maven wtp installed.
Not sure how to fix, any advice appreciated.
The run on server related options only appears if your project has the Dynamic Web Moudle project facets.
You can try to configure it using the Project Facets options in your project properties
To help any other developer with this problem.
I was dealing with this issue recently. Maven projects are structured differently than Dynamic Web Projects. So when you manually add the Dynamic Web Module using Project Facets, eclipse may not register it properly as a Maven project.
To solve this, you have to install the m2e plugin and M2E Eclipse WTP plugin (this tells Eclipse how to run your maven projects).
Go to Help -> Eclipse Marketplace to search for the plugins.
After installing, you will need to restart Eclipse then you will be able to use "run on server" for your Maven projects.
Note: You may need to remove/delete the previous project then import/create it again after the restart.
You have to add maven eclipse pluginin your pom.xml file..
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
</plugin>
According to Red Hat's site, The M2E Eclipse WTP plugin (m2eclipse-wtp) has been deprecated in favor of the newer m2e-wtp plugin. If you don't want to go through the marketplace, the URL for the new plugin is http://download.eclipse.org/technology/m2e/releases.
After copying the project and refreshing it, closing and reopening it, removing and re-adding it (right-click on server) and updating Maven... the option reappeared.
I think it occurs when you up the version of the Java compiler in your .pom file, when you up the compiler in project properties or it has to do with using the newer Jersey (2) version or when you both include local libraries and maven dependencies, it may also be a consequence of a combination of these. It's pretty unclear.
Note though, that you can still add/remove projects by right-clicking on the server in the servers tab.

on save compile and deploy with maven eclipse and weblogic

I just started maven in general and m2eclipse in specific.
What I have been doing before is follow:
1)Deploy my application to tomcat.
2) make any changes to the java or jsp files.
3) save and run the application again ( no restart is neccessary unless I changed a config file).
now, everytime I make a minor change to my maven project in eclipse I have to do a "pre-clean install" to compile and deploy the application again and then restart weblogic 10 to view the changes.
Is there anyway ( or maybe I m not doing something right) that I when I modify a class or jsp file, the code will get compiled and deployed when I save the file like I was doing before with the eclipse default project builder and tomcat?
Also, When I checkout the maven project from SVN, Eclipes shows bunch of compiling errors due to some missing classes, but when I build the project using m2eclipse everything builds successfull. Why is eclipse not recognizing the classes??
I have looked at the following answer but I was not able to figure out the problem.
How do I start Maven "compile" goal on save in Eclipse?
now, everytime I make a minor change to my maven project in eclipse I have to do a "pre-clean install" to compile and deploy the application again and then restart weblogic 10 to view the changes.
You shouldn't have to do that. Are you using the Oracle Enterprise Pack for Eclipse (OEPE) (available from the market place or from an update site) and the WTP?
Is there anyway ( or maybe I m not doing something right) that I when I modify a class or jsp file, the code will get compiled and deployed when I save the file like I was doing before with the eclipse default project builder and tomcat?
See above.
Also, When I checkout the maven project from SVN, Eclipes shows bunch of compiling errors due to some missing classes, but when I build the project using m2eclipse everything builds successful. Why is eclipse not recognizing the classes??
Try the following: right-click on the project then Maven > Update Project Configuration.