Search |
||
Getting the most out of the Maven settings.xml filePosted by johnsmart on August 10, 2009 at 5:11 PM PDT
If you have ever used Maven to any extent, you will probably know about the settings.xml file. The
An example of what typically might go into a
The localRepository element, for example, is very useful if you are using a corporate environment where your home directory is sent over the network each morning when you log on. Placing the local repository in a different directory on your local hard disk will, in this case, save a lot of band width. You can also define repositories, mirrors, profiles and properties your the What is less well-known, or at least less frequently used, is the ability to use other data defined in the One common, and easy, example is to use the localRepository variable. You might need to pass this variable to a script, or use it to refer to a particular JAR file in the repository (though there are usually more elegant solutions for that particular problem). You can use the localRepository property simply by referring to ${settings.localRepository}. For example, in the following code, we invoke an Ant script and pass it the local repository path in a property called "localRepository":
However, you can do much more interesting things, particularly when you also integrate Groovy into your build. For example, suppose that during the integration tests phase, we need to ensure that certain SQL scripts have been run on the database. We have a Groovy script called
Easy as! In fact, once you know how to access not only the top-level variables, but also the collections within your If you want to learn more cool ways to use Maven, check out the new online courses from Sonatype. Or, for a more global picture, come along to a Java Power Tools bootcamp session - there are workshops coming up soon in Canberra, Sydney, Brisbane and Wellington. "Probably the best training course I've been on."..."Not just how to write Java code but the 'business end' - how to build, test, deploy, manage and monitor"..."One of the best and most useful courses I have attended. And they didn't even try to sell me anything!" - There are still some places for the courses in Wellington, Canberra, Brisbane and Sydney - Get up to speed with the latest and coolest in Java tools and best practices! Sign up on the 2009 season of the Java Power Tools Bootcamps. »
Related Topics >>
Blogs Comments
Comments are listed in date ascending order (oldest first)
|
||
|
|