Monday, December 19, 2005

Maven 2 - How To: Where to put the properties?

1) The properties, in Maven 1 in build.properties and project.properties, are stored in settings.xml

2) Create the settings.xml in your user directory

Under Windows XP, this is:

C:\Documents and Settings\<user>\.m2\settings.xml

If you have to configure a proxy, it would look like this:

<?xml version="1.0" encoding="UTF-8"?>
<settings>
<proxies>
<proxy>
<active/>
<protocol>http</protocol>
<username>user</username>
<password>passwd</password>
<port>8080</port>
<host>proxy-url</host>
<id/>
</proxy>
</proxies>
</settings>

3) Since settings.xml is not part of your workspace and won't be stored in the project repository, you don't have it within your development environment. I'm using Eclipse for my development and I included the settings.xml in my project as a linked resource to the file system.

This approach gives you the advantage, that you can edit settings.xml easily within Eclipse and you don't have to leave your development environment :)

* * *

Reference:

http://maven.apache.org/maven-settings/settings.html

No comments: