Java Reference
In-Depth Information
> mvn exec:java -Dexec.mainClass=mjg.RunDemo
...
Weather for Boston, MA, United States:
Condition : Cloudy
Temperature: 58
Wind Chill : 58
Humidity : 84
I can supply a command-line argument using -Dexec.args :
> mvn exec:java -Dexec.mainClass=mjg.RunDemo -Dexec.args='44418'
...
Weather for London, , United Kingdom:
Condition : Cloudy
Temperature: 54
Wind Chill : 54
Humidity : 82
A guiding principle in this topic is that Java is good at tools, libraries, and (existing) infra-
structure, and that Groovy is good at everything else. It's hard to imagine a better demon-
stration of that than the current example. The entire application was written in Groovy, at a
code savings on the order of 10 to 1. The infrastructure treated the code as though it was all
Java, and I was even able to use the Java exec task to execute the Groovy script to drive
the application.
The Groovy-Eclipse compiler plugin is a funded project, because it's used inside the IDEs
provided by SpringSource (a division of VMware). [ 8 ] The quality of the plugin, especially
for cross-compilation, is therefore quite high. Just because it has the name “Eclipse” wired
into it, there's no reason not to use it in a Maven project. There's no implication that the
plugin is exclusive to the IDE. You can use it anywhere, as I did with the Maven project in
this section.
8 Now part of Pivotal, which is owned by VMware, which is owned by EMC...
The other way to add Groovy to a project built with Maven is to use the GMaven project,
discussed in the next section.
 
Search WWH ::




Custom Search