Sangram Anand
Sangram Anand

Reputation: 10844

Managing Maven project in Eclipse with git repository

we recently migrated to Maven Build manager & git hub repository for our Java web-app. Also i switched to eclipse as eclipse has good set of plugins.

As a new bie, i am simply running mvn clean package from terminal at the code root directory. And then moving the compiled code i.e., /target/SNAPSHOT/* to tomcat/webapps/ROOT location. And then starting Tomcat7 server. The process is time taking especially when i do code changes in Java & configuration .xml files.

I want to do it completely in IDE environment as i did earlier in Netbeans, update code -> build and run in debug mode, -> do code changes and then commit.

Heard of egit & m2e in eclipse for maven & github integration, but not sure how to use it.

Please walk me through the steps required in doing so. I am completely new to eclipse.

-- Thanks

Upvotes: 1

Views: 967

Answers (2)

yorkw
yorkw

Reputation: 41126

We use Git for version control and Maven for dependency management and build automation. Once your project has successfully imported into Eclipse and recognized as a valid java web project, you don't need either Git or Maven in order to build/run it inside IDE. Just creat a server using you existing tomcat installation, add the project to server, then select Run as > Run on Server.

The Complete Guide:

  1. Creating a server
  2. Adding projects to a server
  3. Starting a server

For more details, check out Testing and publishing on your server.

Upvotes: 1

Kalpak Gadre
Kalpak Gadre

Reputation: 6475

You might want to consider using maven-jetty-plugin http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin for running the webapp. You will not need to copy over stuff to tomcat. After configuring this plugin, you can simply run your application by doing mvn jetty:run

I generally do not like running webapps inside Eclipse. It's a personal prefrence, but it is always nice to have an IDE neutral way of building and running your applications. If you have m2e things should work simply fine. I have seen maven-jetty-plugin having hot pluggability where if you changed your web.xml, jetty would reload your application.

Upvotes: 2

Related Questions