Search in sources :

Example 26 with Settings

use of org.apache.maven.settings.Settings in project sling by apache.

the class BundleListUtils method createInterpolator.

public static Interpolator createInterpolator(MavenProject project, MavenSession mavenSession) {
    StringSearchInterpolator interpolator = new StringSearchInterpolator();
    final Properties props = new Properties();
    props.putAll(project.getProperties());
    props.putAll(mavenSession.getSystemProperties());
    props.putAll(mavenSession.getUserProperties());
    interpolator.addValueSource(new PropertiesBasedValueSource(props));
    // add ${project.foo}
    interpolator.addValueSource(new PrefixedObjectValueSource(Arrays.asList("project", "pom"), project, true));
    // add ${session.foo}
    interpolator.addValueSource(new PrefixedObjectValueSource("session", mavenSession));
    // add ${settings.foo}
    final Settings settings = mavenSession.getSettings();
    if (settings != null) {
        interpolator.addValueSource(new PrefixedObjectValueSource("settings", settings));
    }
    return interpolator;
}
Also used : StringSearchInterpolator(org.codehaus.plexus.interpolation.StringSearchInterpolator) Properties(java.util.Properties) PropertiesBasedValueSource(org.codehaus.plexus.interpolation.PropertiesBasedValueSource) Settings(org.apache.maven.settings.Settings) PrefixedObjectValueSource(org.codehaus.plexus.interpolation.PrefixedObjectValueSource)

Example 27 with Settings

use of org.apache.maven.settings.Settings in project gradle by gradle.

the class PomProjectInitDescriptor method generate.

@Override
public void generate(BuildInitDsl dsl, BuildInitTestFramework testFramework) {
    SingleMessageLogger.incubatingFeatureUsed("Maven to Gradle conversion");
    File pom = fileResolver.resolve("pom.xml");
    try {
        Settings settings = settingsProvider.buildSettings();
        Set<MavenProject> mavenProjects = new MavenProjectsCreator().create(settings, pom);
        new Maven2Gradle(mavenProjects, fileResolver.resolve(".")).convert();
    } catch (Exception exception) {
        throw new MavenConversionException(String.format("Could not convert Maven POM %s to a Gradle build.", pom), exception);
    }
}
Also used : MavenProject(org.apache.maven.project.MavenProject) MavenProjectsCreator(org.gradle.buildinit.plugins.internal.maven.MavenProjectsCreator) Maven2Gradle(org.gradle.buildinit.plugins.internal.maven.Maven2Gradle) File(java.io.File) MavenConversionException(org.gradle.buildinit.plugins.internal.maven.MavenConversionException) Settings(org.apache.maven.settings.Settings) MavenConversionException(org.gradle.buildinit.plugins.internal.maven.MavenConversionException)

Aggregations

Settings (org.apache.maven.settings.Settings)27 File (java.io.File)15 Proxy (org.apache.maven.settings.Proxy)6 IOException (java.io.IOException)5 DefaultSettingsBuildingRequest (org.apache.maven.settings.building.DefaultSettingsBuildingRequest)5 MavenProject (org.apache.maven.project.MavenProject)4 Server (org.apache.maven.settings.Server)4 SettingsBuildingException (org.apache.maven.settings.building.SettingsBuildingException)4 SettingsBuildingRequest (org.apache.maven.settings.building.SettingsBuildingRequest)4 Test (org.junit.Test)4 HashMap (java.util.HashMap)3 MavenSession (org.apache.maven.execution.MavenSession)3 AbstractMojo (org.apache.maven.plugin.AbstractMojo)3 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)3 SiteMavenProjectStub (org.apache.maven.plugins.site.stubs.SiteMavenProjectStub)3 SettingsDecryptionResult (org.apache.maven.settings.crypto.SettingsDecryptionResult)3 StringWriter (java.io.StringWriter)2 Properties (java.util.Properties)2 Maven2Gradle (org.gradle.buildinit.plugins.internal.maven.Maven2Gradle)2 MavenConversionException (org.gradle.buildinit.plugins.internal.maven.MavenConversionException)2