use of com.mulesoft.tools.migration.engine.project.structure.mule.MuleProject in project mule-migration-assistant by mulesoft.
the class ApplicationPersister method persistMuleAppProperties.
private void persistMuleAppProperties() throws Exception {
projectType = projectFactory.getProjectType(appModel.getProjectBasePath());
if (projectType.equals(MULE_THREE_APPLICATION) || projectType.equals(MULE_THREE_MAVEN_APPLICATION)) {
MuleThreeApplication project = new MuleThreeApplication(appModel.getProjectBasePath());
Path source = project.appProperties();
if (source.toFile().exists()) {
Path resources = ((MuleProject) projectOutput).srcMainResources();
resources.toFile().mkdirs();
Files.copy(source, resources.resolve("mule-app.properties"));
}
}
}
use of com.mulesoft.tools.migration.engine.project.structure.mule.MuleProject in project mule-migration-assistant by mulesoft.
the class ApplicationPersister method persistGitIgnoreFile.
/**
* persist a .gitIgnore File from gitignore-maven-template
*
* @throws FileNotFoundException in case of a FileNotFoundException
* @throws IOException in case of a IOException
*/
private void persistGitIgnoreFile() throws FileNotFoundException, IOException {
if (projectOutput instanceof MuleProject) {
MuleProject muleProject = (MuleProject) projectOutput;
Path baseFolder = muleProject.baseFolder;
if (baseFolder.toFile().exists()) {
InputStream gitignoreResourceStream = null;
OutputStream outputStream = null;
try {
gitignoreResourceStream = getClass().getClassLoader().getResourceAsStream("gitignore-maven-template");
File gitIgnore = new File(baseFolder.toFile(), ".gitignore");
outputStream = new FileOutputStream(gitIgnore);
IOUtils.copy(gitignoreResourceStream, outputStream);
} finally {
IOUtils.closeQuietly(gitignoreResourceStream);
IOUtils.closeQuietly(outputStream);
}
}
}
}
use of com.mulesoft.tools.migration.engine.project.structure.mule.MuleProject in project mule-migration-assistant by mulesoft.
the class ApplicationPersister method createSourcesFolders.
private void createSourcesFolders() {
File app;
MuleProject project = (MuleProject) projectOutput;
if (!exists(project.srcMainConfiguration())) {
app = project.srcMainConfiguration().toFile();
app.mkdirs();
}
if (!(project instanceof MuleFourDomain || project instanceof MuleFourPolicy)) {
if (!exists(project.srcTestConfiguration())) {
app = project.srcTestConfiguration().toFile();
app.mkdirs();
}
}
}
use of com.mulesoft.tools.migration.engine.project.structure.mule.MuleProject in project mule-migration-assistant by mulesoft.
the class MigrationJob method generateSourceApplicationModel.
private ApplicationModel generateSourceApplicationModel(Path project) throws Exception {
ProjectTypeFactory projectFactory = new ProjectTypeFactory();
ProjectType type = projectFactory.getProjectType(project);
MuleProject muleProject = getMuleProject(project, type);
ApplicationModelBuilder builder = new ApplicationModelBuilder().withConfigurationFiles(getFiles(muleProject.srcMainConfiguration(), "xml")).withProjectType(type).withMuleVersion(muleVersion).withPom(muleProject.pom()).withProjectPomGAV(projectGAV).withProjectBasePath(muleProject.getBaseFolder()).withSupportedNamespaces(getTasksDeclaredNamespaces(migrationTasks));
if (muleProject.srcTestConfiguration().toFile().exists()) {
builder.withTestConfigurationFiles(getFiles(muleProject.srcTestConfiguration(), "xml"));
}
return builder.build();
}
Aggregations