View Javadoc

1   package org.apache.maven.settings;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
23  
24  import java.io.File;
25  import java.io.IOException;
26  
27  /**
28   * Builder for the user or global settings. By default, the settings files are located:
29   * <ul>
30   * <li>user settings: ${user.home}/settings.xml</li>
31   * <li>global settings: ${maven.home}/conf/settings.xml</li>
32   * </ul>
33   *
34   * You could also use system properties to specify the path for user and global settings:
35   * <ul>
36   * <li>user settings is defined by <code>org.apache.maven.user-settings</code></li>
37   * <li>global settings is defined by <code>org.apache.maven.global-settings</code></li>
38   * </ul>
39   *
40   * @author jdcasey
41   * @version $Id: MavenSettingsBuilder.java 638306 2008-03-18 10:20:28Z bentmann $
42   */
43  public interface MavenSettingsBuilder
44  {
45      String ROLE = MavenSettingsBuilder.class.getName();
46  
47      String ALT_USER_SETTINGS_XML_LOCATION = "org.apache.maven.user-settings";
48      String ALT_GLOBAL_SETTINGS_XML_LOCATION = "org.apache.maven.global-settings";
49      String ALT_LOCAL_REPOSITORY_LOCATION = "maven.repo.local";
50  
51      /**
52       * @return a <code>Settings</code> object from the user settings file.
53       * @throws IOException if any
54       * @throws XmlPullParserException if any
55       */
56      Settings buildSettings()
57          throws IOException, XmlPullParserException;
58  
59      /**
60       * @param useCachedSettings if true, doesn't reload the user settings
61       * @return a <code>Settings</code> object from the user settings file.
62       * @throws IOException if any
63       * @throws XmlPullParserException if any
64       */
65      Settings buildSettings( boolean useCachedSettings )
66          throws IOException, XmlPullParserException;
67  
68      /**
69       * @param userSettingsFile a given user settings file
70       * @return a <code>Settings</code> object from the user settings file.
71       * @throws IOException if any
72       * @throws XmlPullParserException if any
73       */
74      Settings buildSettings( File userSettingsFile )
75          throws IOException, XmlPullParserException;
76  
77      /**
78       * @param userSettingsFile a given user settings file
79       * @param useCachedSettings if true, doesn't reload the user settings
80       * @return a <code>Settings</code> object from the user settings file.
81       * @throws IOException if any
82       * @throws XmlPullParserException if any
83       */
84      Settings buildSettings( File userSettingsFile, boolean useCachedSettings )
85          throws IOException, XmlPullParserException;
86  }