...
Warning |
---|
Some dependencies, such as JavaMail and Activation, can't be downloaded automatically due to license restrictions. Fortunately, Maven gives you a nice error message showing you how to install these to your local repository. Simply download the required jar from Sun's website and then use the command supplied by the error message to install it. You can then try the build again. |
If all goes well, you should see something like:
Code Block |
---|
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] Struts Action Framework 2.0 Project ................... SUCCESS [0.688s]
[INFO] Struts Action Framework 2.0 API ....................... SUCCESS [2.125s]
[INFO] Struts Action Framework 2.0 ........................... SUCCESS [21.866s]
[INFO] Webapps ............................................... SUCCESS [0.002s]
[INFO] Blank Webapp .......................................... SUCCESS [0.982s]
[INFO] Portet Webapp ......................................... SUCCESS [2.038s]
[INFO] Shopping Cart Webapp .................................. SUCCESS [0.934s]
[INFO] Showcase Webapp ....................................... SUCCESS [3.351s]
[INFO] Starter Webapp ........................................ SUCCESS [1.013s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 33 seconds
[INFO] Finished at: Wed May 03 18:23:38 PDT 2006
[INFO] Final Memory: 11M/43M
[INFO] ------------------------------------------------------------------------
|
Other phases
There are other phases that can be useful when working with Maven. The package phase will just jar (or war) up the modules. The test phase will only run the unit tests. The compile phase will only build the source code (but not the test sources). And the clean phase will remove all artifacts, typically the entire target directory.
...
Profile | Description |
---|---|
default | Builds action-api, action, and all sample webapps |
xwork | Includes the xwork build |
thirdParty thirdparty | Includes additional modules that cannot be part of the default build due to Apache rules |
...
Code Block |
---|
> mvn -Pprofile ... |
Third party profile
That is, if you wanted to build all the third-party add-ons not included with the default build, you'd simply use the thirdparty profile:
Code Block |
---|
> mvn -Pthirdparty package
|
Notice that the final output is now:
Code Block |
---|
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] Struts Action Framework 2.0 Project ................... SUCCESS [0.646s]
[INFO] Struts Action Framework 2.0 API ....................... SUCCESS [2.389s]
[INFO] Struts Action Framework 2.0 ........................... SUCCESS [22.155s]
[INFO] Webapps ............................................... SUCCESS [0.002s]
[INFO] Blank Webapp .......................................... SUCCESS [0.906s]
[INFO] Portet Webapp ......................................... SUCCESS [1.661s]
[INFO] Shopping Cart Webapp .................................. SUCCESS [0.779s]
[INFO] Third Party Modules ................................... SUCCESS [0.003s]
[INFO] JasperReports ......................................... SUCCESS [0.918s]
[INFO] Showcase Webapp ....................................... SUCCESS [2.336s]
[INFO] Starter Webapp ........................................ SUCCESS [0.571s]
[INFO] JFree Chart ........................................... SUCCESS [1.972s]
[INFO] Pell File Upload ...................................... SUCCESS [0.385s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 35 seconds
[INFO] Finished at: Wed May 03 18:26:19 PDT 2006
[INFO] Final Memory: 14M/52M
[INFO] ------------------------------------------------------------------------
|
As you can see, the additional modules that aren't part of the default build were not included.
XWork profile
Besides the third party profile, another useful profile is the xwork profile. This one assumes that the latest XWork CVS code is checked out and is located at ../xwork, relative to the Struts project. You can check out XWork using these commands:
Code Block |
---|
cvs -d :pserver:guest@cvs.dev.java.net:/cvs login
cvs -d :pserver:guest@cvs.dev.java.net:/cvs co xwork
|
Note |
---|
The guest user has a blank password at java.net. If you have your own java.net account, you can use that. |
Now you can do:
Code Block |
---|
> mvn -Pxwork package
|
And you'll see that XWork is included:
Code Block |
---|
[INFO] ------------------------------------------------------------------------ [INFO] Reactor -PthirdParty package Summary: [INFO] ------------------------------------------------------------------------ [INFO] Struts Action Framework 2.0 Project ................... SUCCESS [0.774s] [INFO] Struts Action Framework 2.0 API ....................... SUCCESS [1.969s] [INFO] XWork ................................................. SUCCESS [8.757s] [INFO] Struts Action Framework 2.0 ........................... SUCCESS [24.947s] [INFO] Webapps ............................................... SUCCESS [0.002s] [INFO] Blank Webapp .......................................... SUCCESS [1.068s] [INFO] Portet Webapp ......................................... SUCCESS [1.391s] [INFO] Shopping Cart Webapp .................................. SUCCESS [0.745s] [INFO] Showcase Webapp ....................................... SUCCESS [3.064s] [INFO] Starter Webapp ........................................ SUCCESS [0.625s] [INFO] ------------------------------------------------------------------------ [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 44 seconds [INFO] Finished at: Wed May 03 18:31:49 PDT 2006 [INFO] Final Memory: 14M/46M [INFO] ------------------------------------------------------------------------ |
Notice that the build runs XWork before building the main Struts project. That is because instead of using the XWork snapshot release that is already pre-compiled, Maven is now understanding that it should build XWork and use the resulting artifact (jar) from that build to supply to Struts.
Multiple profiles
You can use multiple profiles at once. For example, this is possible and highly recommend for anyone spending a lot of time developing on Struts and XWork:
Code Block |
---|
> mvn -Pthirdparty,xwork package
|
This is especially important if you wish to use Maven to build your IDE project files, which is highly recommended.
Building IDE project files
...