当前位置: 首页>>代码示例>>Java>>正文


Java Settings.getLocalRepository方法代码示例

本文整理汇总了Java中org.apache.maven.settings.Settings.getLocalRepository方法的典型用法代码示例。如果您正苦于以下问题:Java Settings.getLocalRepository方法的具体用法?Java Settings.getLocalRepository怎么用?Java Settings.getLocalRepository使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.settings.Settings的用法示例。


在下文中一共展示了Settings.getLocalRepository方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
protected void initialize() throws Exception {
    basedir = getBasedir();

    File settingsFile = new File(System.getProperty("user.home"), ".m2/settings.xml");
    String localRepo = null;
    if (settingsFile.exists()) {
        Settings settings = new SettingsXpp3Reader().read(new FileReader(settingsFile));
        localRepo = settings.getLocalRepository();
    } else {
        localRepo = System.getProperty("user.home") + "/.m2/repository";
    }
    if (localRepo == null) {
        localRepo = System.getProperty("user.home") + "/.m2/repository";
    }

    localRepository = new DefaultArtifactRepository("local", "file://" + localRepo, new DefaultRepositoryLayout());

}
 
开发者ID:mulesoft,项目名称:mule-tooling-incubator,代码行数:19,代码来源:MavenArtifactResolver.java

示例2: parseLocalRepoPathFromMavenSettings

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
private synchronized String parseLocalRepoPathFromMavenSettings() throws SettingsBuildingException {
    if (localRepoPathFromMavenSettings == null) {
        Settings settings = settingsProvider.buildSettings();
        localRepoPathFromMavenSettings = settings.getLocalRepository();
    }
    return localRepoPathFromMavenSettings;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:DefaultLocalMavenRepositoryLocator.java

示例3: getRepositorySession

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
public static DefaultRepositorySystemSession getRepositorySession(RepositorySystem repoSystem, WorkspaceReader workspace) {
  
  DefaultRepositorySystemSession repoSystemSession = MavenRepositorySystemUtils.newSession();
  
  String repoLocation = System.getProperty("user.home") + File.separator
          + ".m2" + File.separator + "repository/";
  try {
    Settings effectiveSettings = loadMavenSettings();
    if(effectiveSettings.getLocalRepository() != null) {
      repoLocation = effectiveSettings.getLocalRepository();
    }
  } catch(Exception e) {
    log.warn(
            "Unable to load Maven settings, using default repository location",
            e);
  }

  LocalRepository localRepo = new LocalRepository(repoLocation);
  log.debug("Using local repository at: " + repoLocation);
  repoSystemSession.setLocalRepositoryManager(repoSystem
          .newLocalRepositoryManager(repoSystemSession, localRepo));
  
  //repoSystemSession.setWorkspaceReader(new SimpleMavenCache(new File("repo")));      
  if (workspace != null) repoSystemSession.setWorkspaceReader(workspace);

  return repoSystemSession;
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:28,代码来源:Utils.java

示例4: MavenSettings

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
/**
 * Create a new {@link MavenSettings} instance.
 * @param settings the source settings
 * @param decryptedSettings the decrypted settings
 */
public MavenSettings(Settings settings, SettingsDecryptionResult decryptedSettings) {
	this.offline = settings.isOffline();
	this.mirrorSelector = createMirrorSelector(settings);
	this.authenticationSelector = createAuthenticationSelector(decryptedSettings);
	this.proxySelector = createProxySelector(decryptedSettings);
	this.localRepository = settings.getLocalRepository();
	this.activeProfiles = determineActiveProfiles(settings);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:MavenSettings.java

示例5: buildSettings

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
private static Settings buildSettings(SettingsBuilder builder,
                                      MavenServerSettings settings,
                                      Properties systemProperties,
                                      Properties userProperties) throws RemoteException {
  SettingsBuildingRequest settingsRequest = new DefaultSettingsBuildingRequest();
  settingsRequest.setGlobalSettingsFile(settings.getGlobalSettingsFile());
  settingsRequest.setUserSettingsFile(settings.getUserSettingsFile());
  settingsRequest.setSystemProperties(systemProperties);
  settingsRequest.setUserProperties(userProperties);

  Settings result = new Settings();
  try {
    result = builder.build(settingsRequest).getEffectiveSettings();
  }
  catch (SettingsBuildingException e) {
    Maven3ServerGlobals.getLogger().info(e);
  }

  result.setOffline(settings.isOffline());

  if (settings.getLocalRepository() != null) {
    result.setLocalRepository(settings.getLocalRepository().getPath());
  }

  if (result.getLocalRepository() == null) {
    result.setLocalRepository(new File(SystemProperties.getUserHome(), ".m2/repository").getPath());
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:Maven30ServerEmbedderImpl.java

示例6: getSettings

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
private Settings getSettings(
    SettingsBuilder builder,
    MavenSettings settings,
    Properties systemProperties,
    Properties userProperties)
    throws RemoteException {
  SettingsBuildingRequest request = new DefaultSettingsBuildingRequest();
  request.setGlobalSettingsFile(settings.getGlobalSettings());
  request.setUserSettingsFile(settings.getUserSettings());
  request.setSystemProperties(systemProperties);
  request.setUserProperties(userProperties);

  Settings result = new Settings();
  try {
    result = builder.build(request).getEffectiveSettings();
  } catch (SettingsBuildingException e) {
    MavenServerContext.getLogger().info(e);
  }

  result.setOffline(settings.isOffline());
  if (settings.getLocalRepository() != null) {
    result.setLocalRepository(settings.getLocalRepository().getPath());
  }
  if (result.getLocalRepository() == null) {
    result.setLocalRepository(
        new File(System.getProperty("user.home"), ".m2/repository").getPath());
  }
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:30,代码来源:MavenServerImpl.java

示例7: setUp

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
protected void setUp() throws Exception {
	super.setUp();

	mavenProjectBuilder = (MavenProjectBuilder) getContainer().lookup(
			MavenProjectBuilder.ROLE);
	ArtifactFactory artifactFactory = (ArtifactFactory) getContainer()
			.lookup(ArtifactFactory.ROLE);

	final Map<String, Mojo> mojos = (Map<String, Mojo>) getContainer()
			.lookupMap(Mojo.ROLE);

	for (Mojo mojo : mojos.values()) {
		if (mojo instanceof Hyperjaxb3Mojo) {
			this.mojo = (Hyperjaxb3Mojo) mojo;
		}
	}

	MavenSettingsBuilder settingsBuilder = (MavenSettingsBuilder) getContainer()
			.lookup(MavenSettingsBuilder.ROLE);
	ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) getContainer()
			.lookup(ArtifactRepositoryLayout.ROLE, "default");

	Settings settings = settingsBuilder.buildSettings();

	String url = settings.getLocalRepository();

	if (!url.startsWith("file:")) {
		url = "file://" + url;
	}

	localRepository = new DefaultArtifactRepository("local", url,
			new DefaultRepositoryLayout());
}
 
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:34,代码来源:RunEpisodesBPlugin.java

示例8: buildSettings

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
private static Settings buildSettings(SettingsBuilder builder,
                                      MavenServerSettings settings,
                                      Properties systemProperties,
                                      Properties userProperties)
  throws RemoteException {
  SettingsBuildingRequest settingsRequest = new DefaultSettingsBuildingRequest();
  settingsRequest.setGlobalSettingsFile(settings.getGlobalSettingsFile());
  settingsRequest.setUserSettingsFile(settings.getUserSettingsFile());
  settingsRequest.setSystemProperties(systemProperties);
  settingsRequest.setUserProperties(userProperties);

  Settings result = new Settings();
  try {
    result = builder.build(settingsRequest).getEffectiveSettings();
  }
  catch (SettingsBuildingException e) {
    Maven3ServerGlobals.getLogger().info(e);
  }

  result.setOffline(settings.isOffline());

  if (settings.getLocalRepository() != null) {
    result.setLocalRepository(settings.getLocalRepository().getPath());
  }

  if (result.getLocalRepository() == null) {
    result.setLocalRepository(new File(SystemProperties.getUserHome(), ".m2/repository").getPath());
  }

  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:32,代码来源:Maven3ServerEmbedderImpl.java

示例9: setupRepoSession

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
public DefaultRepositorySystemSession setupRepoSession(final RepositorySystem repoSystem, final Settings settings)
{
   DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
   session.setOffline(false);

   Proxy activeProxy = settings.getActiveProxy();
   if (activeProxy != null)
   {
      DefaultProxySelector dps = new DefaultProxySelector();
      dps.add(convertFromMavenProxy(activeProxy), activeProxy.getNonProxyHosts());
      session.setProxySelector(dps);
   }

   final DefaultMirrorSelector mirrorSelector = createMirrorSelector(settings);
   final LazyAuthenticationSelector authSelector = createAuthSelector(settings, mirrorSelector);

   session.setMirrorSelector(mirrorSelector);
   session.setAuthenticationSelector(authSelector);

   LocalRepository localRepo = new LocalRepository(new File(settings.getLocalRepository()));
   session.setLocalRepositoryManager(repoSystem.newLocalRepositoryManager(session, localRepo));
   session.setChecksumPolicy(RepositoryPolicy.CHECKSUM_POLICY_IGNORE);
   session.setCache(new DefaultRepositoryCache());
   boolean cacheNotFoundArtifacts = true;
   boolean cacheTransferErrors = true;
   session.setResolutionErrorPolicy(new SimpleResolutionErrorPolicy(cacheNotFoundArtifacts, cacheTransferErrors));
   session.setWorkspaceReader(new ClasspathWorkspaceReader());
   if (Boolean.getBoolean("org.apache.maven.log_transfer"))
   {
      session.setTransferListener(new JULMavenTransferListener());
   }
   return session;
}
 
开发者ID:forge,项目名称:furnace,代码行数:34,代码来源:MavenContainer.java

示例10: build

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
public SettingsBuildingResult build( SettingsBuildingRequest request )
    throws SettingsBuildingException
{
    DefaultSettingsProblemCollector problems = new DefaultSettingsProblemCollector( null );

    SettingsSource globalSettingsSource =
        getSettingsSource( request.getGlobalSettingsFile(), request.getGlobalSettingsSource() );
    Settings globalSettings = readSettings( globalSettingsSource, request, problems );

    SettingsSource userSettingsSource =
        getSettingsSource( request.getUserSettingsFile(), request.getUserSettingsSource() );
    Settings userSettings = readSettings( userSettingsSource, request, problems );

    settingsMerger.merge( userSettings, globalSettings, TrackableBase.GLOBAL_LEVEL );

    problems.setSource( "" );

    userSettings = interpolate( userSettings, request, problems );

    // for the special case of a drive-relative Windows path, make sure it's absolute to save plugins from trouble
    String localRepository = userSettings.getLocalRepository();
    if ( localRepository != null && localRepository.length() > 0 )
    {
        File file = new File( localRepository );
        if ( !file.isAbsolute() && file.getPath().startsWith( File.separator ) )
        {
            userSettings.setLocalRepository( file.getAbsolutePath() );
        }
    }

    if ( hasErrors( problems.getProblems() ) )
    {
        throw new SettingsBuildingException( problems.getProblems() );
    }

    return new DefaultSettingsBuildingResult( userSettings, problems.getProblems() );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:38,代码来源:DefaultSettingsBuilder.java

示例11: setupRepoSession

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
public DefaultRepositorySystemSession setupRepoSession(final RepositorySystem repoSystem, final Settings settings)
{
   DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
   session.setOffline(false);

   Proxy activeProxy = settings.getActiveProxy();
   if (activeProxy != null)
   {
      DefaultProxySelector dps = new DefaultProxySelector();
      dps.add(convertFromMavenProxy(activeProxy), activeProxy.getNonProxyHosts());
      session.setProxySelector(dps);
   }

   final DefaultMirrorSelector mirrorSelector = createMirrorSelector(settings);
   final LazyAuthenticationSelector authSelector = createAuthSelector(settings, mirrorSelector);

   session.setMirrorSelector(mirrorSelector);
   session.setAuthenticationSelector(authSelector);

   LocalRepository localRepo = new LocalRepository(new File(settings.getLocalRepository()));
   session.setLocalRepositoryManager(repoSystem.newLocalRepositoryManager(session, localRepo));
   session.setChecksumPolicy(RepositoryPolicy.CHECKSUM_POLICY_IGNORE);
   session.setCache(new DefaultRepositoryCache());
   boolean cacheNotFoundArtifacts = true;
   boolean cacheTransferErrors = true;
   session.setResolutionErrorPolicy(new SimpleResolutionErrorPolicy(cacheNotFoundArtifacts, cacheTransferErrors));
   session.setWorkspaceReader(new ClasspathWorkspaceReader());
   session.setTransferListener(new LogTransferListener(System.out));
   return session;
}
 
开发者ID:koentsje,项目名称:forge-furnace,代码行数:31,代码来源:MavenContainer.java

示例12: newLocalRepository

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
protected static LocalRepository newLocalRepository(Settings settings) {
	if (settings.getLocalRepository() != null) {
		return new LocalRepository(settings.getLocalRepository());
	}
	return DEFAULT_LOCAL_REPOSITORY;
}
 
开发者ID:maenu,项目名称:kowalski,代码行数:7,代码来源:Maven.java

示例13: getSettings

import org.apache.maven.settings.Settings; //导入方法依赖的package包/类
public Settings getSettings()
{
   try
   {
      SettingsBuilder settingsBuilder = new DefaultSettingsBuilderFactory().newInstance();
      SettingsBuildingRequest settingsRequest = new DefaultSettingsBuildingRequest();
      String userSettingsLocation = System.getProperty(ALT_USER_SETTINGS_XML_LOCATION);
      // TeamCity sets the settings.xml in a different system property
      String teamCitySettingsLocation = System.getProperty("teamcity.maven.userSettings.path");
      if (userSettingsLocation != null)
      {
         settingsRequest.setUserSettingsFile(new File(userSettingsLocation));
      }
      else if (teamCitySettingsLocation != null)
      {
         settingsRequest.setUserSettingsFile(new File(teamCitySettingsLocation));
      }
      else
      {
         settingsRequest.setUserSettingsFile(new File(getUserHomeDir(), "/.m2/settings.xml"));
      }
      String globalSettingsLocation = System.getProperty(ALT_GLOBAL_SETTINGS_XML_LOCATION);
      if (globalSettingsLocation != null)
      {
         settingsRequest.setGlobalSettingsFile(new File(globalSettingsLocation));
      }
      else
      {
         if (M2_HOME != null)
         {
            settingsRequest.setGlobalSettingsFile(new File(M2_HOME, "/conf/settings.xml"));
         }
      }
      SettingsBuildingResult settingsBuildingResult = settingsBuilder.build(settingsRequest);
      Settings effectiveSettings = settingsBuildingResult.getEffectiveSettings();

      if (effectiveSettings.getLocalRepository() == null)
      {
         String userRepositoryLocation = System.getProperty(ALT_LOCAL_REPOSITORY_LOCATION);
         if (userRepositoryLocation != null)
         {
            effectiveSettings.setLocalRepository(userRepositoryLocation);
         }
         else
         {
            effectiveSettings.setLocalRepository(getUserHomePath() + "/.m2/repository");
         }
      }

      return effectiveSettings;
   }
   catch (SettingsBuildingException e)
   {
      throw new RuntimeException(e);
   }
}
 
开发者ID:forge,项目名称:furnace,代码行数:57,代码来源:MavenContainer.java


注:本文中的org.apache.maven.settings.Settings.getLocalRepository方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。