Reputation: 1737
I been programming Spring/Web projects for sometime using eclipse and tomcat but now that I am getting into Maven I am also thinking about using jetty for my workstation testing.
I made a sample web app and if I run it on tomcat from eclipse I goto http://localhost:8080/TestJetty/ but if I do a mvn jetty:run I have to access it from http://localhost:8080/
Why is that?
Also can I setup eclipse to run jetty? whats the pros and cons of both
Upvotes: 0
Views: 1169
Reputation: 49915
Normally with "jetty:run" goal of maven jetty plugin the context path is /
, unless it is overridden with a contextPath configuration entry:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>Your version..</version>
<configuration>
<webApp>
<contextPath>/mycontextpath</contextPath>
</webApp>
</configuration>
</plugin>
From within Eclipse probably it is your project name that is being used as the context path.
Regarding pros and cons, it simply is your level of comfort, I prefer command line and so would normally run it outside of eclipse using "mvn jetty:run"
Upvotes: 1