Package org.apache.maven.settings

Examples of org.apache.maven.settings.Settings


         {
            dep = CoordinateBuilder.create(dep).setVersion("[" + version + "]");
         }

         RepositorySystem maven = container.getRepositorySystem();
         Settings settings = container.getSettings();

         DefaultRepositorySystemSession session = container.setupRepoSession(maven, settings);
         Artifact artifact = MavenConvertUtils.coordinateToMavenArtifact(dep);

         List<RemoteRepository> remoteRepos = MavenRepositories.getRemoteRepositories(container, settings, query);
View Full Code Here


   @Override
   public Dependency resolveArtifact(DependencyQuery query)
   {
      RepositorySystem system = container.getRepositorySystem();
      Settings settings = container.getSettings();

      List<RemoteRepository> remoteRepos = MavenRepositories.getRemoteRepositories(container, settings, query);

      DefaultRepositorySystemSession session = container.setupRepoSession(system, settings);
      Artifact queryArtifact = MavenConvertUtils.coordinateToMavenArtifact(query.getCoordinate());
View Full Code Here

   public org.jboss.forge.addon.dependencies.DependencyNode resolveDependencyHierarchy(final DependencyQuery query)
   {
      try
      {
         RepositorySystem system = container.getRepositorySystem();
         Settings settings = container.getSettings();
         DefaultRepositorySystemSession session = container.setupRepoSession(system, settings);
         session.setDependencyTraverser(new DependencyTraverser()
         {
            @Override
            public boolean traverseDependency(org.eclipse.aether.graph.Dependency dependency)
View Full Code Here

         {
            throw new IllegalArgumentException("Dependency query coordinate version must be specified.");
         }

         RepositorySystem system = container.getRepositorySystem();
         Settings settings = container.getSettings();

         DefaultRepositorySystemSession session = container.setupRepoSession(system, settings);
         Artifact artifact = MavenConvertUtils.coordinateToMavenArtifact(query.getCoordinate());

         List<RemoteRepository> mavenRepositories = MavenRepositories.getRemoteRepositories(container, settings, query);
View Full Code Here

   private MavenRepositorySystemSession setupRepoSession(final RepositorySystem repoSystem)
   {
      MavenRepositorySystemSession session = new MavenRepositorySystemSession();
      session.setOffline(!environment.isOnline());
      Settings settings = container.getSettings();

      LocalRepository localRepo = new LocalRepository(new File(settings.getLocalRepository()), "");
      session.setLocalRepositoryManager(repoSystem.newLocalRepositoryManager(localRepo));
      session.setTransferErrorCachingEnabled(false);
      session.setNotFoundCachingEnabled(false);

      return session;
View Full Code Here

   }

   private RemoteRepository convertToMavenRepo(final DependencyRepository repo)
   {
      RemoteRepository remoteRepository = new RemoteRepository(repo.getId(), "default", repo.getUrl());
      Settings settings = container.getSettings();
      Proxy activeProxy = settings.getActiveProxy();
      if (activeProxy != null)
      {
         remoteRepository.setProxy(RepositoryUtils.convertFromMavenProxy(activeProxy));
      }
      return remoteRepository;
View Full Code Here

        return new ArtifactRepositoryPolicy( enabled, updatePolicy, checksumPolicy );
    }

    protected LocalRepository getDefaultLocalRepository()
    {
        Settings settings = getSettings();
        LocalRepository localRepository = new LocalRepository();
        localRepository.setId( "local" );
        localRepository.setPath( new File( settings.getLocalRepository() ) );
        return localRepository;
    }
View Full Code Here

                    }
                }
            }
        }

        Settings userSettings = loadSettings( userSettingsFile );
        Settings globalSettings = loadSettings( globalSettingsFile );

        SettingsUtils.merge( userSettings, globalSettings, TrackableBase.GLOBAL_LEVEL );
        settings = userSettings;

        if ( StringUtils.isEmpty( settings.getLocalRepository() ) )
View Full Code Here

        }
    }

    private Settings loadSettings( File settingsFile )
    {
        Settings settings = null;
        try
        {
            if ( settingsFile != null )
            {
                log( "Loading Maven settings file: " + settingsFile.getPath(), Project.MSG_VERBOSE );
                settings = readSettings( settingsFile );
            }
        }
        catch ( IOException e )
        {
            log( "Error reading settings file '" + settingsFile + "' - ignoring. Error was: " + e.getMessage(),
                 Project.MSG_WARN );
        }
        catch ( XmlPullParserException e )
        {
            log( "Error parsing settings file '" + settingsFile + "' - ignoring. Error was: " + e.getMessage(),
                 Project.MSG_WARN );
        }

        if ( settings == null )
        {
            settings = new Settings();
            RuntimeInfo rtInfo = new RuntimeInfo(settings);
            settings.setRuntimeInfo(rtInfo);
        }

        return settings;
    }
View Full Code Here

     * @see org.apache.maven.settings.DefaultMavenSettingsBuilder#readSettings
     */
    private Settings readSettings( File settingsFile )
        throws IOException, XmlPullParserException
    {
        Settings settings = null;
        Reader reader = null;
        try
        {
            reader = ReaderFactory.newXmlReader( settingsFile );
            StringWriter sWriter = new StringWriter();

            IOUtil.copy( reader, sWriter );

            String rawInput = sWriter.toString();

            try
            {
                RegexBasedInterpolator interpolator = new RegexBasedInterpolator();
                interpolator.addValueSource( new EnvarBasedValueSource() );

                rawInput = interpolator.interpolate( rawInput, "settings" );
            }
            catch ( Exception e )
            {
                log( "Failed to initialize environment variable resolver. Skipping environment substitution in settings." );
            }

            StringReader sReader = new StringReader( rawInput );

            SettingsXpp3Reader modelReader = new SettingsXpp3Reader();

            settings = modelReader.read( sReader );

            RuntimeInfo rtInfo = new RuntimeInfo( settings );

            rtInfo.setFile( settingsFile );

            settings.setRuntimeInfo( rtInfo );
        }
        finally
        {
            IOUtil.close( reader );
        }
View Full Code Here

TOP

Related Classes of org.apache.maven.settings.Settings

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.