Example usage for org.apache.maven.repository RepositorySystem defaultUserLocalRepository

List of usage examples for org.apache.maven.repository RepositorySystem defaultUserLocalRepository

Introduction

In this page you can find the example usage for org.apache.maven.repository RepositorySystem defaultUserLocalRepository.

Prototype

File defaultUserLocalRepository

To view the source code for org.apache.maven.repository RepositorySystem defaultUserLocalRepository.

Click Source Link

Usage

From source file:com.bluexml.side.util.dependencies.WorkbenchPreferencePage1.java

License:Open Source License

public static String getLocationPreference() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    String locationPreference = store.getString(MAVEN_REPO_LOCATION);

    if (StringUtils.trimToNull(locationPreference) == null) {
        locationPreference = RepositorySystem.defaultUserLocalRepository.toString();
    }/*from  w w  w.ja  va 2s . co  m*/
    return locationPreference;
}

From source file:hudson.maven.MavenEmbedder.java

License:Apache License

public ArtifactRepository getLocalRepository() throws ComponentLookupException {
    try {//from   w w  w . ja v  a 2s. c o m
        String localRepositoryPath = getLocalRepositoryPath();
        if (localRepositoryPath != null) {
            return lookup(RepositorySystem.class).createLocalRepository(new File(localRepositoryPath));
        }
        return lookup(RepositorySystem.class)
                .createLocalRepository(RepositorySystem.defaultUserLocalRepository);
    } catch (InvalidRepositoryException e) {
        // never happened
        throw new IllegalStateException(e);
    }
}

From source file:hudson.maven.MavenEmbedder.java

License:Apache License

public String getLocalRepositoryPath() {
    String path = null;/* www .  j  av a  2s  . c o  m*/

    try {
        Settings settings = getSettings();
        path = settings.getLocalRepository();
    } catch (MavenEmbedderException e) {
        // ignore
    } catch (ComponentLookupException e) {
        // ignore
    }

    if (this.mavenRequest.getLocalRepositoryPath() != null) {
        path = this.mavenRequest.getLocalRepositoryPath();
    }

    if (path == null) {
        path = RepositorySystem.defaultUserLocalRepository.getAbsolutePath();
    }
    return path;
}

From source file:org.appformer.maven.integration.embedder.MavenEmbedder.java

License:Apache License

public ArtifactRepository getLocalRepository() throws ComponentLookupException {
    try {/*from   www  . j av  a  2s  .com*/
        String localRepositoryPath = getLocalRepositoryPath();
        if (localRepositoryPath != null) {
            return componentProvider.lookup(RepositorySystem.class)
                    .createLocalRepository(new File(localRepositoryPath));
        }
        return componentProvider.lookup(RepositorySystem.class)
                .createLocalRepository(RepositorySystem.defaultUserLocalRepository);
    } catch (InvalidRepositoryException e) {
        // never happened
        throw new IllegalStateException(e);
    }
}

From source file:org.eclipse.m2e.core.internal.embedder.MavenImpl.java

License:Open Source License

public String getLocalRepositoryPath() {
    String path = null;/*from  w w  w  .  jav a2s .  c o m*/
    try {
        Settings settings = getSettings();
        path = settings.getLocalRepository();
    } catch (CoreException ex) {
        // fall through
    }
    if (path == null) {
        path = RepositorySystem.defaultUserLocalRepository.getAbsolutePath();
    }
    return path;
}

From source file:org.eclipse.m2e.core.internal.embedder.MavenImpl.java

License:Open Source License

public ArtifactRepository getLocalRepository() throws CoreException {
    try {/*from   w w  w.j av  a 2s  .  co  m*/
        String localRepositoryPath = getLocalRepositoryPath();
        if (localRepositoryPath != null) {
            return lookup(RepositorySystem.class).createLocalRepository(new File(localRepositoryPath));
        }
        return lookup(RepositorySystem.class)
                .createLocalRepository(RepositorySystem.defaultUserLocalRepository);
    } catch (InvalidRepositoryException ex) {
        // can't happen
        throw new IllegalStateException(ex);
    }
}

From source file:org.eclipse.m2e.core.ui.internal.preferences.MavenSettingsPreferencePage.java

License:Open Source License

protected void updateLocalRepository() {
    final String userSettings = getUserSettings();
    String globalSettings = runtimeManager.getGlobalSettingsFile();
    try {//from   ww  w  .  j a v a2 s  .  c  o m
        Settings settings = maven.buildSettings(globalSettings, userSettings);
        String localRepository = settings.getLocalRepository();
        if (localRepository == null) {
            localRepository = RepositorySystem.defaultUserLocalRepository.getAbsolutePath();
        }
        if (!localRepositoryText.isDisposed()) {
            localRepositoryText.setText(localRepository == null ? "" : localRepository); //$NON-NLS-1$
        }
    } catch (CoreException e) {
        setMessage(e.getMessage(), IMessageProvider.ERROR);
    }
}

From source file:org.springframework.ide.vscode.commons.maven.MavenBridge.java

License:Open Source License

public String getLocalRepositoryPath() {
    String path = null;/*from   ww  w .  j a  v  a2  s  . c om*/
    try {
        Settings settings = getSettings();
        path = settings.getLocalRepository();
    } catch (MavenException ex) {
        // fall through
    }
    if (path == null) {
        path = RepositorySystem.defaultUserLocalRepository.getAbsolutePath();
    }
    return path;
}

From source file:org.springframework.ide.vscode.commons.maven.MavenBridge.java

License:Open Source License

public ArtifactRepository getLocalRepository() throws MavenException {
    try {//from w  w w .j  ava 2 s  .c  o m
        String localRepositoryPath = getLocalRepositoryPath();
        if (localRepositoryPath != null) {
            return lookup(RepositorySystem.class).createLocalRepository(new File(localRepositoryPath));
        }
        return lookup(RepositorySystem.class)
                .createLocalRepository(RepositorySystem.defaultUserLocalRepository);
    } catch (InvalidRepositoryException ex) {
        // can't happen
        throw new IllegalStateException(ex);
    }
}