本文整理了Java中org.apache.maven.settings.Settings.getLocalRepository()
方法的一些代码示例,展示了Settings.getLocalRepository()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.getLocalRepository()
方法的具体详情如下:
包路径:org.apache.maven.settings.Settings
类名称:Settings
方法名:getLocalRepository
[英]Get the local repository.
Default value is:${user.home}/.m2/repository
[中]获取本地存储库。
默认值为:${user.home}/.m2/repository
代码示例来源:origin: fabric8io/docker-maven-plugin
private FixedStringSearchInterpolator createRepositoryInterpolator()
{
final Properties settingsProperties = new Properties();
final MavenSession session = getMavenSession();
if (getLocalRepository() != null) {
settingsProperties.setProperty("localRepository", getLocalRepository().getBasedir());
settingsProperties.setProperty("settings.localRepository", getLocalRepository().getBasedir());
}
else if (session != null && session.getSettings() != null) {
settingsProperties.setProperty("localRepository", session.getSettings().getLocalRepository() );
settingsProperties.setProperty("settings.localRepository", getLocalRepository().getBasedir() );
}
return FixedStringSearchInterpolator.create(new PropertiesBasedValueSource(settingsProperties));
}
代码示例来源:origin: apache/maven
if ( StringUtils.isEmpty( dominant.getLocalRepository() ) )
dominant.setLocalRepository( recessive.getLocalRepository() );
代码示例来源:origin: apache/maven
@Override
public SettingsBuildingResult build( SettingsBuildingRequest request )
throws SettingsBuildingException
{
DefaultSettingsProblemCollector problems = new DefaultSettingsProblemCollector( null );
Source globalSettingsSource =
getSettingsSource( request.getGlobalSettingsFile(), request.getGlobalSettingsSource() );
Settings globalSettings = readSettings( globalSettingsSource, request, problems );
Source 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() );
}
代码示例来源:origin: apache/maven
serializer.startTag( NAMESPACE, tagName );
serializer.attribute( "", "xsi:schemaLocation", "http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" );
if ( settings.getLocalRepository() != null )
serializer.startTag( NAMESPACE, "localRepository" ).text( settings.getLocalRepository() ).endTag( NAMESPACE, "localRepository" );
代码示例来源:origin: apache/maven
request.setLocalRepositoryPath( settings.getLocalRepository() );
代码示例来源:origin: apache/maven
/**
* @param settings could be null
* @return a new instance of settings or null if settings was null.
*/
public static Settings copySettings( Settings settings )
{
if ( settings == null )
{
return null;
}
Settings clone = new Settings();
clone.setActiveProfiles( settings.getActiveProfiles() );
clone.setInteractiveMode( settings.isInteractiveMode() );
clone.setLocalRepository( settings.getLocalRepository() );
clone.setMirrors( settings.getMirrors() );
clone.setModelEncoding( settings.getModelEncoding() );
clone.setOffline( settings.isOffline() );
clone.setPluginGroups( settings.getPluginGroups() );
clone.setProfiles( settings.getProfiles() );
clone.setProxies( settings.getProxies() );
clone.setServers( settings.getServers() );
clone.setSourceLevel( settings.getSourceLevel() );
clone.setUsePluginRegistry( settings.isUsePluginRegistry() );
return clone;
}
}
代码示例来源:origin: apache/maven
request.setLocalRepositoryPath( settings.getLocalRepository() );
代码示例来源:origin: org.apache.maven/maven-settings
serializer.startTag( NAMESPACE, tagName );
serializer.attribute( "", "xsi:schemaLocation", "http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" );
if ( settings.getLocalRepository() != null )
serializer.startTag( NAMESPACE, "localRepository" ).text( settings.getLocalRepository() ).endTag( NAMESPACE, "localRepository" );
代码示例来源:origin: apache/maven-release
@Override
public File getLocalRepositoryDirectory()
{
File localRepo = localRepositoryDirectory;
if ( localRepo == null && settings != null && settings.getLocalRepository() != null )
{
localRepo = new File( settings.getLocalRepository() ).getAbsoluteFile();
}
return localRepo;
}
代码示例来源:origin: org.renjin/renjin-aether-package-loader
private static File getLocalRepositoryDir() {
Settings settings = getSettings();
if ( settings.getLocalRepository() != null )
{
return new File( settings.getLocalRepository() );
}
return new File( getMavenUserHome(), "repository" );
}
代码示例来源:origin: org.apache.continuum/continuum-buildagent-core
private ArtifactRepository getRepository( Settings settings )
{
return artifactRepositoryFactory.createArtifactRepository( "local", "file://" + settings.getLocalRepository(),
defaultRepositoryLayout, null, null );
}
代码示例来源:origin: org.jvnet.hudson/maven-embedder
public ArtifactRepository createLocalRepository( Settings settings )
throws ComponentLookupException
{
return createLocalRepository( settings.getLocalRepository(), DEFAULT_LOCAL_REPO_ID );
}
代码示例来源:origin: org.jboss.shrinkwrap.resolver/shrinkwrap-resolver-impl-maven
private Settings enrichWithLocalRepository(Settings settings) {
// set default value if not set at all
if (settings.getLocalRepository() == null || settings.getLocalRepository().length() == 0) {
settings.setLocalRepository(DEFAULT_REPOSITORY_PATH);
}
// override any value with system property based location
String altLocalRepository = SecurityActions.getProperty(ALT_LOCAL_REPOSITORY_LOCATION);
if (altLocalRepository != null && altLocalRepository.length() > 0) {
settings.setLocalRepository(altLocalRepository);
}
return settings;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-maven-embedder
public ArtifactRepository getLocalRepository() {
try {
String localRepositoryPath = getSettings().getLocalRepository();
if (localRepositoryPath != null) {
return repositorySystem.createLocalRepository(FileUtil.normalizeFile(new File(localRepositoryPath)));
}
return repositorySystem.createDefaultLocalRepository();
} catch (InvalidRepositoryException ex) {
// can't happen
throw new IllegalStateException(ex);
}
}
代码示例来源:origin: org.apache.maven/maven-artifact-ant
protected LocalRepository getDefaultLocalRepository()
{
Settings settings = getSettings();
LocalRepository localRepository = new LocalRepository();
localRepository.setId( "local" );
localRepository.setLocation( new File( settings.getLocalRepository() ) );
return localRepository;
}
代码示例来源:origin: org.apache.maven/maven-ant-tasks
protected LocalRepository getDefaultLocalRepository()
{
Settings settings = getSettings();
LocalRepository localRepository = new LocalRepository();
localRepository.setId( "local" );
localRepository.setPath( new File( settings.getLocalRepository() ) );
return localRepository;
}
代码示例来源:origin: org.uberfire/uberfire-maven-integration
private Aether( Settings settings, MavenProject mavenProject ) {
this.localRepoDir = settings.getLocalRepository();
this.offline = settings.isOffline();
system = newRepositorySystem();
session = newRepositorySystemSession( settings, system );
repositories = initRepositories( mavenProject );
}
代码示例来源:origin: org.kie.soup/kie-soup-maven-integration
public static MavenRequest createMavenRequest(boolean _offline) {
MavenRequest mavenRequest = new MavenRequest();
mavenRequest.setLocalRepositoryPath(MavenSettings.getSettings().getLocalRepository());
mavenRequest.setUserSettingsSource(MavenSettings.getUserSettingsSource());
final boolean offline = IS_FORCE_OFFLINE || _offline;
// BZ-1007894: If dependency is not resolvable and maven project builder does not complain about it,
// then a <code>java.lang.NullPointerException</code> is thrown to the client.
// So, the user will se an exception message "null", not descriptive about the real error.
mavenRequest.setResolveDependencies(!offline);
mavenRequest.setOffline(offline);
return mavenRequest;
}
代码示例来源:origin: org.uberfire/uberfire-maven-integration
public static MavenRequest createMavenRequest(boolean offline) {
MavenRequest mavenRequest = new MavenRequest();
mavenRequest.setLocalRepositoryPath( MavenSettings.getSettings().getLocalRepository() );
mavenRequest.setUserSettingsSource(MavenSettings.getUserSettingsSource());
// BZ-1007894: If dependency is not resolvable and maven project builder does not complain about it,
// then a <code>java.lang.NullPointerException</code> is thrown to the client.
// So, the user will se an exception message "null", not descriptive about the real error.
mavenRequest.setResolveDependencies( true );
mavenRequest.setOffline( offline );
return mavenRequest;
}
代码示例来源:origin: org.kie.soup/kie-soup-maven-integration
private static MavenRequest createMavenRequest(SettingsSource settingsSource) {
MavenRequest mavenRequest = new MavenRequest();
mavenRequest.setLocalRepositoryPath( MavenSettings.getSettings().getLocalRepository() );
mavenRequest.setUserSettingsSource(settingsSource != null ? settingsSource : MavenSettings.getUserSettingsSource());
mavenRequest.setResolveDependencies( true );
mavenRequest.setOffline( true );
return mavenRequest;
}
内容来源于网络,如有侵权,请联系作者删除!