braincell
braincell

Reputation: 562

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?

Upvotes: 4

Views: 7511

Answers (4)

Sri
Sri

Reputation: 4853

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".

Upvotes: 0

Mohit Saluja
Mohit Saluja

Reputation: 470

May be Dynamic Web Module in Project Facet is not selected

Go to :- Project > Properties > Project Facets > check Dynamic Web Module

Upvotes: 10

Raghuram
Raghuram

Reputation: 52645

How about installing the m2e-wtp plugin and trying? You would want to confirm that the maven project is of war packaging as well.

Upvotes: 7

Andrea Colleoni
Andrea Colleoni

Reputation: 6021

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.

Upvotes: 1

Related Questions