Search in sources :

Example 6 with DependencyBuilder

use of com.mulesoft.tools.migration.project.model.pom.Dependency.DependencyBuilder in project mule-migration-assistant by mulesoft.

the class MUnitPomContribution method execute.

@Override
public void execute(PomModel pomModel, MigrationReport report) throws RuntimeException {
    pomModel.addDependency(new DependencyBuilder().withGroupId("com.mulesoft.munit").withArtifactId("munit-runner").withVersion(targetVersion("munit-maven-plugin")).withClassifier("mule-plugin").withScope("test").build());
    pomModel.addDependency(new DependencyBuilder().withGroupId("com.mulesoft.munit").withArtifactId("munit-tools").withVersion(targetVersion("munit-maven-plugin")).withClassifier("mule-plugin").withScope("test").build());
    if (!getMUnitPlugin(pomModel).isEmpty()) {
        Plugin munitPlugin = getMUnitPlugin(pomModel).get(0);
        munitPlugin.setVersion(targetVersion("munit-maven-plugin"));
    } else {
        pomModel.addPlugin(buildMunitPlugin());
    }
    pomModel.removeProperty(MUNIT_SUPPORT_PROPERTY);
    pomModel.removeProperty(MUNIT_PROPERTY);
    pomModel.addProperty(MUNIT_PROPERTY, targetVersion("munit-maven-plugin"));
}
Also used : DependencyBuilder(com.mulesoft.tools.migration.project.model.pom.Dependency.DependencyBuilder) Plugin(com.mulesoft.tools.migration.project.model.pom.Plugin)

Example 7 with DependencyBuilder

use of com.mulesoft.tools.migration.project.model.pom.Dependency.DependencyBuilder in project mule-migration-assistant by mulesoft.

the class DomainReferencePomContribution method execute.

@Override
public void execute(PomModel object, MigrationReport report) throws RuntimeException {
    Properties properties = new Properties();
    File file = getApplicationModel().getSourceProjectBasePath().resolve("src" + separator + "main" + separator + "app" + separator + "mule-deploy.properties").toFile();
    if (!file.exists()) {
        return;
    }
    try (FileInputStream inStream = new FileInputStream(file)) {
        properties.load(inStream);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    if (!properties.containsKey("domain")) {
        return;
    }
    String domain = properties.getProperty("domain");
    if ("default".equals(domain)) {
        return;
    }
    if (getApplicationModel().getDomainDocuments() == null || getApplicationModel().getDomainDocuments().isEmpty()) {
        throw new MigrationAbortException(format("The application to migrate references a domain '%s'. " + "Call the migrator with the 'parentDomainBasePath' parameter indicating the Mule 3 source for that domain.", domain));
    }
    object.addDependency(new DependencyBuilder().withGroupId("org.mule.migrated").withArtifactId(domain).withVersion("1.0.0-M4-SNAPSHOT").withClassifier("mule-domain").withScope("provided").build());
}
Also used : MigrationAbortException(com.mulesoft.tools.migration.exception.MigrationAbortException) DependencyBuilder(com.mulesoft.tools.migration.project.model.pom.Dependency.DependencyBuilder) IOException(java.io.IOException) Properties(java.util.Properties) File(java.io.File) FileInputStream(java.io.FileInputStream)

Example 8 with DependencyBuilder

use of com.mulesoft.tools.migration.project.model.pom.Dependency.DependencyBuilder in project mule-migration-assistant by mulesoft.

the class SocketsConfig method addSocketsModule.

public static void addSocketsModule(ApplicationModel applicationModel) {
    applicationModel.getPomModel().ifPresent(pom -> pom.addDependency(new DependencyBuilder().withGroupId("org.mule.connectors").withArtifactId("mule-sockets-connector").withVersion(targetVersion("mule-sockets-connector")).withClassifier("mule-plugin").build()));
    applicationModel.addNameSpace("sockets", "http://www.mulesoft.org/schema/mule/sockets", "http://www.mulesoft.org/schema/mule/sockets/current/mule-sockets.xsd");
}
Also used : DependencyBuilder(com.mulesoft.tools.migration.project.model.pom.Dependency.DependencyBuilder)

Example 9 with DependencyBuilder

use of com.mulesoft.tools.migration.project.model.pom.Dependency.DependencyBuilder in project mule-migration-assistant by mulesoft.

the class SpringPomContribution method execute.

@Override
public void execute(PomModel object, MigrationReport report) throws RuntimeException {
    object.addDependency(new DependencyBuilder().withGroupId("org.mule.modules").withArtifactId("mule-spring-module").withVersion(targetVersion("mule-spring-module")).withClassifier("mule-plugin").build());
    Dependency springCore = new DependencyBuilder().withGroupId("org.springframework").withArtifactId("spring-core").withVersion(SPRING_VERSION).build();
    object.addDependency(springCore);
    Dependency springBeans = new DependencyBuilder().withGroupId("org.springframework").withArtifactId("spring-beans").withVersion(SPRING_VERSION).build();
    object.addDependency(springBeans);
    Dependency springContext = new DependencyBuilder().withGroupId("org.springframework").withArtifactId("spring-context").withVersion(SPRING_VERSION).build();
    object.addDependency(springContext);
    Dependency springAop = new DependencyBuilder().withGroupId("org.springframework").withArtifactId("spring-aop").withVersion(SPRING_VERSION).build();
    object.addDependency(springAop);
    Dependency springSecurityCore = new DependencyBuilder().withGroupId("org.springframework.security").withArtifactId("spring-security-core").withVersion(SPRING_SECURITY_VERSION).build();
    object.addDependency(springSecurityCore);
    Dependency springSecurityConfig = new DependencyBuilder().withGroupId("org.springframework.security").withArtifactId("spring-security-config").withVersion(SPRING_SECURITY_VERSION).build();
    object.addDependency(springSecurityConfig);
    addSharedLibs(object, springCore, springBeans, springContext, springAop, springSecurityCore, springSecurityConfig);
}
Also used : DependencyBuilder(com.mulesoft.tools.migration.project.model.pom.Dependency.DependencyBuilder) Dependency(com.mulesoft.tools.migration.project.model.pom.Dependency)

Example 10 with DependencyBuilder

use of com.mulesoft.tools.migration.project.model.pom.Dependency.DependencyBuilder in project mule-migration-assistant by mulesoft.

the class SecurePropertiesPomContribution method execute.

@Override
public void execute(PomModel object, MigrationReport report) throws RuntimeException {
    object.addDependency(new DependencyBuilder().withGroupId("com.mulesoft.modules").withArtifactId("mule-secure-configuration-property-module").withVersion(targetVersion("mule-secure-configuration-property-module")).withClassifier("mule-plugin").build());
    object.removeDependency(new DependencyBuilder().withGroupId("com.mulesoft.security").withArtifactId("mule-module-security-property-placeholder").withVersion("*").build());
}
Also used : DependencyBuilder(com.mulesoft.tools.migration.project.model.pom.Dependency.DependencyBuilder)

Aggregations

DependencyBuilder (com.mulesoft.tools.migration.project.model.pom.Dependency.DependencyBuilder)10 Dependency (com.mulesoft.tools.migration.project.model.pom.Dependency)2 MigrationAbortException (com.mulesoft.tools.migration.exception.MigrationAbortException)1 HttpTransformPomContributionMigrationStep (com.mulesoft.tools.migration.library.gateway.steps.policy.mule.HttpTransformPomContributionMigrationStep)1 Plugin (com.mulesoft.tools.migration.project.model.pom.Plugin)1 XmlDslUtils.addTopLevelElement (com.mulesoft.tools.migration.step.util.XmlDslUtils.addTopLevelElement)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 Properties (java.util.Properties)1 Element (org.jdom2.Element)1