Sunday, July 27, 2014

Re: Moving to Maven



On Sunday, July 27, 2014 8:08:21 PM UTC+2, Magnus wrote:
Hi,

I would like to move to Maven.

In former times, I used to run a Makefile to compile my stuff and everything happened at the commandline. I believe that Maven is an equivalent in today's world. I would like to do my projects with Maven.

Gradle might be closer to Make than Maven. Just saying; I'm not trying to recommend one over the other.
Maven has better integration with the IDEs (particularly Eclipse).
 
However, I started GWT development using eclipse and the eclipse plugin for GWT. This means that I do everything with the eclipse GUI:

  • create a new GWT project
  • configure a GWT project (classpath, libraries, etc.)
  • run a GWT app
  • debug a GWT app
  • ...
I know that I have to learn how to do all this with Maven, but there is a general fundamental question:
When you create and configure a project with Maven, which one is the leading system: Maven or Eclipse?
How do you work with a Maven project in eclipse? Is eclipse just a text editor then? What about all the eclipse menus about development (class path, java options, GWT compiler and so on)?

  • How do you create a new GWT project with Maven?

Have a look at https://code.google.com/p/google-web-toolkit/wiki/WorkingWithMaven, but familiarize yourself with the "Maven lifecycle" first.
Start simple, with one project containing both the client-side and server-side code. But quickly move to a multi-module project, as soon as you think you're ready for it.
 
  • How do you compile it?

Assuming you use the org.codehaus.mojo:gwt-maven-plugin, you need to run the "gwt:compile" goal. It'll generally be bound to the "prepare-package" phase so you'll generally just do a "mvn package" (or "mvn prepare-package").
 
  • How do you start it?

"mvn gwt:run" for DevMode or "mvn gwt:run-codeserver" for SuperDevMode (you then need a different command to run the server side, e.g. "mvn jetty:run", or "mvn gwt:run" and removing the gwt.codesvr= from the URL).
 
  • How do you deploy it?
"mvn package" will generally build a WAR file ready to deploy.
There are plugins to deploy to a server using Maven if you like.
 
In essence: Are there equivalents to Makefile targets?

From a far distance, yes ;-)
But the Maven build lifecycle is not a dependency graph (as in Make, Ant or Gradle), it's linear.
 
And which one is the leading system?
Maven or Eclipse or both (which would be great!)?

I'd say Maven. M2Eclipse will create and configure Eclipse projects from the Maven definition (POM file), and will use Eclipse plugins to do so (the Google Plugin for Eclipse is such a "configurator").
But you can still "Run As… → Web Application" from Eclipse (and I recommend it over "mvn gwt:run") and everything (the classpath mainly) should be configured for you.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment