Search in sources :

Example 1 with MavenConversionException

use of org.gradleinternal.buildinit.plugins.internal.maven.MavenConversionException in project gradle by gradle.

the class PomProjectInitDescriptor method generate.

@Override
public void generate(InitSettings initSettings) {
    IncubationLogger.incubatingFeatureUsed("Maven to Gradle conversion");
    try {
        Settings settings = settingsProvider.buildSettings();
        executor.classLoaderIsolation(config -> config.getClasspath().from(mavenClasspath)).submit(Maven2GradleWorkAction.class, params -> {
            params.getWorkingDir().set(initSettings.getTarget());
            params.getDsl().set(initSettings.getDsl());
            params.getUseIncubatingAPIs().set(initSettings.isUseIncubatingAPIs());
            params.getMavenSettings().set(settings);
            params.getInsecureProtocolOption().set(initSettings.getInsecureProtocolOption());
        });
    } catch (SettingsBuildingException exception) {
        throw new MavenConversionException(String.format("Could not convert Maven POM %s to a Gradle build.", initSettings.getTarget().file("pom.xml").getAsFile()), exception);
    }
}
Also used : MavenSettingsProvider(org.gradle.api.internal.artifacts.mvnsettings.MavenSettingsProvider) Arrays(java.util.Arrays) BuildInitTestFramework(org.gradle.buildinit.plugins.internal.modifiers.BuildInitTestFramework) InitSettings(org.gradle.buildinit.plugins.internal.InitSettings) BuildConverter(org.gradle.buildinit.plugins.internal.BuildConverter) SettingsBuildingException(org.apache.maven.settings.building.SettingsBuildingException) Settings(org.apache.maven.settings.Settings) FileCollection(org.gradle.api.file.FileCollection) TreeSet(java.util.TreeSet) Configuration(org.gradle.api.artifacts.Configuration) DependencyHandler(org.gradle.api.artifacts.dsl.DependencyHandler) IncubationLogger(org.gradle.util.internal.IncubationLogger) ProjectInternal(org.gradle.api.internal.project.ProjectInternal) ComponentType(org.gradle.buildinit.plugins.internal.modifiers.ComponentType) Directory(org.gradle.api.file.Directory) Maven2GradleWorkAction(org.gradleinternal.buildinit.plugins.internal.maven.Maven2GradleWorkAction) Usage(org.gradle.api.attributes.Usage) MavenConversionException(org.gradleinternal.buildinit.plugins.internal.maven.MavenConversionException) Set(java.util.Set) DocumentationRegistry(org.gradle.api.internal.DocumentationRegistry) Language(org.gradle.buildinit.plugins.internal.modifiers.Language) ModularizationOption(org.gradle.buildinit.plugins.internal.modifiers.ModularizationOption) WorkerExecutor(org.gradle.workers.WorkerExecutor) ObjectFactory(org.gradle.api.model.ObjectFactory) Optional(java.util.Optional) Collections(java.util.Collections) BuildInitDsl(org.gradle.buildinit.plugins.internal.modifiers.BuildInitDsl) SettingsBuildingException(org.apache.maven.settings.building.SettingsBuildingException) MavenConversionException(org.gradleinternal.buildinit.plugins.internal.maven.MavenConversionException) InitSettings(org.gradle.buildinit.plugins.internal.InitSettings) Settings(org.apache.maven.settings.Settings)

Aggregations

Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 Optional (java.util.Optional)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 Settings (org.apache.maven.settings.Settings)1 SettingsBuildingException (org.apache.maven.settings.building.SettingsBuildingException)1 Configuration (org.gradle.api.artifacts.Configuration)1 DependencyHandler (org.gradle.api.artifacts.dsl.DependencyHandler)1 Usage (org.gradle.api.attributes.Usage)1 Directory (org.gradle.api.file.Directory)1 FileCollection (org.gradle.api.file.FileCollection)1 DocumentationRegistry (org.gradle.api.internal.DocumentationRegistry)1 MavenSettingsProvider (org.gradle.api.internal.artifacts.mvnsettings.MavenSettingsProvider)1 ProjectInternal (org.gradle.api.internal.project.ProjectInternal)1 ObjectFactory (org.gradle.api.model.ObjectFactory)1 BuildConverter (org.gradle.buildinit.plugins.internal.BuildConverter)1 InitSettings (org.gradle.buildinit.plugins.internal.InitSettings)1 BuildInitDsl (org.gradle.buildinit.plugins.internal.modifiers.BuildInitDsl)1 BuildInitTestFramework (org.gradle.buildinit.plugins.internal.modifiers.BuildInitTestFramework)1