Maven by Example - 7.9. Running the Simple Command |
|
The $ mvn assembly:assembly [INFO] ----------------------------------------------------- [INFO] Building Multi-spring Chapter Simple Command Line Tool [INFO]task-segment: [assembly:assembly] (aggregator-style) [INFO] ----------------------------------------------------- [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:compile] [INFO] Nothing to compile - all classes are up to date [INFO] [resources:testResources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:testCompile] [INFO] Nothing to compile - all classes are up to date [INFO] [surefire:test] ... [INFO] [jar:jar] [INFO] Building jar: .../simple-parent/simple-command/target/simple-command.jar [INFO] [assembly:assembly] [INFO] Processing DependencySet (output=) [INFO] Building jar: .../simple-parent/simple-command/target /simple-command-jar-with-dependencies.jar The build progresses through the lifecycle compiling bytecode, running
tests, and finally building a JAR for the project. Then the
Before you run the command-line tool, you will need to invoke the
$ mvn hibernate3:hbm2ddl [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'hibernate3'. [INFO] org.codehaus.mojo: checking for updates from central [INFO] ----------------------------------------------------- [INFO] Building Multi-spring Chapter Simple Command Line Tool [INFO]task-segment: [hibernate3:hbm2ddl] [INFO] ----------------------------------------------------- [INFO] Preparing hibernate3:hbm2ddl ... 10:24:56,151 INFO org.hibernate.tool.hbm2ddl.SchemaExport - export complete [INFO] ----------------------------------------------------- [INFO] BUILD SUCCESSFUL [INFO] ----------------------------------------------------- Once you run this, you should see a $ java -cp target/simple-command-jar-with-dependencies.jar \ org.sonatype.mavenbook.weather.Main 60202 2321 INFO YahooRetriever - Retrieving Weather Data 2489 INFO YahooParser - Creating XML Reader 2581 INFO YahooParser - Parsing XML Response 2875 INFO WeatherFormatter - Formatting Weather Data **************************************** Current Weather Conditions for: Evanston, IL, US **************************************** * Temperature: 75 * Condition: Partly Cloudy * Humidity: 64 * Wind Chill: 75 * Date: Wed Aug 06 09:35:30 CDT 2008 To run a history query, execute the following command: $ java -cp target/simple-command-jar-with-dependencies.jar \ org.sonatype.mavenbook.weather.Main 60202 history 2470 INFO WeatherFormatter - Formatting History Data Weather History for: Evanston, IL, US **************************************** * Temperature: 39 * Condition: Heavy Rain * Humidity: 93 * Wind Chill: 36 * Date: 2007-12-02 13:45:27.187 **************************************** * Temperature: 75 * Condition: Partly Cloudy * Humidity: 64 * Wind Chill: 75 * Date: 2008-08-06 09:24:11.725 **************************************** * Temperature: 75 * Condition: Partly Cloudy * Humidity: 64 * Wind Chill: 75 * Date: 2008-08-06 09:27:28.475 |