Hi Brett, Thanks for the pointers!
I found MavenSettingsBuilder the other day, but the parameterless MavenSettingsBuilder#buildSettings() had been removed in the 2.1 snapshots, so I figured it wasn't the right class to use, as DefaultMavenSettingsBuilder no longer takes care of all the global / user settings file nitty gritty. If I use the new 2.1 version of MavenSettingsBuilder, I'll need to pass it some files. Should I just hardcode these files to be ~/.m2/settings.xml? When you say "it probably needs a method to be able to save", do you mean MavenSettingsBuilder? If so, by keeping it isolated, I assume you mean make the method package protected? Just making sure we're clear :-) Again, thanks for the input. Take care, Daniel brettporter wrote: > > I think MavenSettingsBuilder should be what you want to load it, but > we don't have anything that will persist it. It will take care of > figuring out where to load it from and the hierachy. > > It probably needs a method to be able to save to the one in ~/.m2/ > settings.xml as well, which can be done by: > > SettingsXpp3Writer w = new SettingsXpp3Writer(); > w.write( settings ); > > (+ exception handling). > > That should definitely remain isolated to the settings code though so > that the location like ~/.m2 doesn't propogate out into the other > modules. > > HTH, > Brett > > On 29/08/2006, at 8:15 AM, gredler wrote: > >> >> Hi, >> >> I'm working on the license clickthough functionality in the artifact >> resolver (http://jira.codehaus.org/browse/MNG-671), and I need to >> know: >> >> - what the best way of retrieving the current Settings object is >> - what the best way of saving changes to the Settings object is >> >> I'm hoping that I can just add a line or two to a components.xml >> file and >> have Maven automagically wire the object up. >> >> I've been banging my head against MavenSettingsBuilder (recently >> refactored), MavenTools, MavenEmbedder, etc. There has to be a >> simple way to >> do this behind all the abstractions! >> >> Thanks, >> >> Daniel > > -- View this message in context: http://www.nabble.com/how-to-get-current-settings-object-tf2180267.html#a6077009 Sent from the Maven Developers forum at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]