Search in sources :

Example 56 with Xpp3Dom

use of org.codehaus.plexus.util.xml.Xpp3Dom in project tesb-studio-se by Talend.

the class CreateMavenBundlePom method addSkipMavenCleanPlugin.

/**
 * Skip clean control-bundle file in target folde, in case of using mvn clean + package goal
 *
 * @return plugin
 */
private Plugin addSkipMavenCleanPlugin() {
    Plugin plugin = new Plugin();
    plugin.setGroupId("org.apache.maven.plugins");
    plugin.setArtifactId("maven-clean-plugin");
    plugin.setVersion("3.0.0");
    Xpp3Dom configuration = new Xpp3Dom("configuration");
    Xpp3Dom skipClean = new Xpp3Dom("skip");
    skipClean.setValue("true");
    configuration.addChild(skipClean);
    plugin.setConfiguration(configuration);
    return plugin;
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) Plugin(org.apache.maven.model.Plugin) CorePlugin(org.talend.core.CorePlugin)

Example 57 with Xpp3Dom

use of org.codehaus.plexus.util.xml.Xpp3Dom in project tesb-studio-se by Talend.

the class CreateMavenBundlePom method addSkipDeployFeatureMavenPlugin.

private Plugin addSkipDeployFeatureMavenPlugin() {
    Plugin plugin = new Plugin();
    plugin.setGroupId("org.apache.maven.plugins");
    plugin.setArtifactId("maven-deploy-plugin");
    plugin.setVersion("2.7");
    Xpp3Dom configuration = new Xpp3Dom("configuration");
    Xpp3Dom skip = new Xpp3Dom("skip");
    skip.setValue("true");
    configuration.addChild(skip);
    plugin.setConfiguration(configuration);
    return plugin;
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) Plugin(org.apache.maven.model.Plugin) CorePlugin(org.talend.core.CorePlugin)

Example 58 with Xpp3Dom

use of org.codehaus.plexus.util.xml.Xpp3Dom in project tesb-studio-se by Talend.

the class CreateMavenBundlePom method createInstallFileElement.

private Xpp3Dom createInstallFileElement(JobInfo job) {
    Xpp3Dom file = null;
    if (getJobProcessor() != null && getProcessor(job) != null) {
        IPath currentProjectRootDir = getTalendJobJavaProject(getJobProcessor()).getProject().getLocation();
        IPath targetDir = getTalendJobJavaProject(getProcessor(job)).getTargetFolder().getLocation();
        String relativeTargetDir = targetDir.makeRelativeTo(currentProjectRootDir).toString();
        if (!ProjectManager.getInstance().isInCurrentMainProject(job.getProcessItem().getProperty())) {
            // this job/routelet is from a reference project
            currentProjectRootDir = new Path(currentProjectRootDir.getDevice(), currentProjectRootDir.toString().replaceAll("/\\d+/", "/"));
            targetDir = new Path(targetDir.getDevice(), targetDir.toString().replaceAll("/\\d+/", "/"));
            relativeTargetDir = targetDir.makeRelativeTo(currentProjectRootDir).toString();
        }
        IFile jobPom = AggregatorPomsHelper.getItemPomFolder(job.getProcessItem().getProperty()).getFile(TalendMavenConstants.POM_FILE_NAME);
        if (jobPom.exists()) {
            try {
                Model jobModel = MODEL_MANAGER.readMavenModel(jobPom);
                String resolvedFinalName = null;
                if (jobModel.getProperties().getProperty(JOB_FINAL_NAME) != null) {
                    resolvedFinalName = resolveJobFinalName(jobModel.getProperties().getProperty(JOB_FINAL_NAME), jobModel);
                } else {
                    for (String modelName : jobModel.getModules()) {
                        IFile subPom = AggregatorPomsHelper.getItemPomFolder(job.getProcessItem().getProperty()).getFile(modelName);
                        if (subPom.exists()) {
                            Model subModel = MODEL_MANAGER.readMavenModel(subPom);
                            if (subModel.getProperties().getProperty(JOB_FINAL_NAME) != null) {
                                resolvedFinalName = resolveJobFinalName(subModel.getProperties().getProperty(JOB_FINAL_NAME), subModel);
                                break;
                            }
                        }
                    }
                }
                if (resolvedFinalName == null) {
                    resolvedFinalName = job.getJobName().toLowerCase() + "_" + PomIdsHelper.getJobVersion(job).replaceAll("\\.", "_");
                }
                String pathToJar = relativeTargetDir + Path.SEPARATOR + resolvedFinalName + ".jar";
                file = new Xpp3Dom("file");
                file.setValue(pathToJar);
            } catch (CoreException e) {
                e.printStackTrace();
            }
        }
    }
    return file;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) IFile(org.eclipse.core.resources.IFile) IPath(org.eclipse.core.runtime.IPath) CoreException(org.eclipse.core.runtime.CoreException) Model(org.apache.maven.model.Model)

Example 59 with Xpp3Dom

use of org.codehaus.plexus.util.xml.Xpp3Dom in project tesb-studio-se by Talend.

the class CreateMavenDataServicePom method addControlBundleMavenPlugin.

private Plugin addControlBundleMavenPlugin() {
    Plugin plugin = new Plugin();
    plugin.setGroupId("org.apache.maven.plugins");
    plugin.setArtifactId("maven-jar-plugin");
    plugin.setVersion("3.0.2");
    plugin.setExtensions(true);
    Xpp3Dom configuration = new Xpp3Dom("configuration");
    Xpp3Dom archive = new Xpp3Dom("archive");
    Xpp3Dom manifest = new Xpp3Dom("manifestFile");
    manifest.setValue("${project.build.outputDirectory}/META-INF/MANIFEST.MF");
    archive.addChild(manifest);
    configuration.addChild(archive);
    plugin.setConfiguration(configuration);
    return plugin;
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) Plugin(org.apache.maven.model.Plugin)

Example 60 with Xpp3Dom

use of org.codehaus.plexus.util.xml.Xpp3Dom in project tesb-studio-se by Talend.

the class CreateMavenDataServicePom method addSkipDeployFeatureMavenPlugin.

private Plugin addSkipDeployFeatureMavenPlugin() {
    Plugin plugin = new Plugin();
    plugin.setGroupId("org.apache.maven.plugins");
    plugin.setArtifactId("maven-deploy-plugin");
    plugin.setVersion("2.7");
    Xpp3Dom configuration = new Xpp3Dom("configuration");
    Xpp3Dom skip = new Xpp3Dom("skip");
    skip.setValue("true");
    configuration.addChild(skip);
    plugin.setConfiguration(configuration);
    return plugin;
}
Also used : Xpp3Dom(org.codehaus.plexus.util.xml.Xpp3Dom) Plugin(org.apache.maven.model.Plugin)

Aggregations

Xpp3Dom (org.codehaus.plexus.util.xml.Xpp3Dom)156 Plugin (org.apache.maven.model.Plugin)39 File (java.io.File)26 ArrayList (java.util.ArrayList)18 PluginExecution (org.apache.maven.model.PluginExecution)18 IOException (java.io.IOException)13 HashMap (java.util.HashMap)11 Test (org.junit.Test)11 MavenSession (org.apache.maven.execution.MavenSession)10 MavenProject (org.apache.maven.project.MavenProject)10 Model (org.apache.maven.model.Model)9 Reader (java.io.Reader)8 Build (org.apache.maven.model.Build)8 TargetPlatformConfiguration (org.eclipse.tycho.core.TargetPlatformConfiguration)8 BuildFailureException (org.eclipse.tycho.core.shared.BuildFailureException)8 MojoExecution (org.apache.maven.plugin.MojoExecution)7 XmlPullParserException (org.codehaus.plexus.util.xml.pull.XmlPullParserException)7 Map (java.util.Map)6 Dependency (org.apache.maven.model.Dependency)6 StringReader (java.io.StringReader)5