Search in sources :

Example 1 with MavenBuild

use of org.eclipse.che.maven.data.MavenBuild in project che by eclipse.

the class MavenModelUtil method convertToMavenModel.

public static Model convertToMavenModel(MavenModel model) {
    Model result = new Model();
    result.setArtifactId(model.getMavenKey().getArtifactId());
    result.setGroupId(model.getMavenKey().getGroupId());
    result.setVersion(model.getMavenKey().getVersion());
    result.setPackaging(model.getPackaging());
    result.setName(model.getName());
    if (model.getParent() != null) {
        Parent parent = new Parent();
        MavenKey parentKey = model.getParent().getMavenKey();
        parent.setArtifactId(parentKey.getArtifactId());
        parent.setGroupId(parentKey.getGroupId());
        parent.setVersion(parentKey.getVersion());
        parent.setRelativePath(model.getParent().getRelativePath());
        result.setParent(parent);
    }
    result.setProperties(model.getProperties());
    result.setModules(model.getModules());
    result.setBuild(new Build());
    MavenBuild modelBuild = model.getBuild();
    convertToMavenBuildBase(modelBuild, result.getBuild());
    result.getBuild().setSourceDirectory(modelBuild.getSources().get(0));
    result.getBuild().setTestSourceDirectory(modelBuild.getTestSources().get(0));
    result.setProfiles(convertToMavenProfiles(model.getProfiles()));
    return result;
}
Also used : MavenBuild(org.eclipse.che.maven.data.MavenBuild) MavenKey(org.eclipse.che.maven.data.MavenKey) Parent(org.apache.maven.model.Parent) MavenParent(org.eclipse.che.maven.data.MavenParent) MavenBuild(org.eclipse.che.maven.data.MavenBuild) Build(org.apache.maven.model.Build) MavenModel(org.eclipse.che.maven.data.MavenModel) Model(org.apache.maven.model.Model)

Example 2 with MavenBuild

use of org.eclipse.che.maven.data.MavenBuild in project che by eclipse.

the class MavenModelReader method fillModelByDefaults.

private void fillModelByDefaults(MavenModel model) {
    model.setMavenKey(new MavenKey("unknown", "unknown", "unknown"));
    final MavenKey parentKey = new MavenKey("unknown", "unknown", "unknown");
    model.setParent(new MavenParent(parentKey, "../pom.xml"));
    model.setPackaging("jar");
    model.setModules(emptyList());
    final MavenBuild build = model.getBuild();
    build.setSources(singletonList(DEFAULT_SOURCE_FOLDER));
    build.setTestSources(singletonList(DEFAULT_TEST_SOURCE_FOLDER));
    build.setResources(singletonList(new MavenResource(DEFAULT_RESOURCES_FOLDER, false, null, Collections.emptyList(), Collections.emptyList())));
    build.setTestResources(singletonList(new MavenResource(DEFAULT_TEST_RESOURCES_FOLDER, false, null, Collections.emptyList(), Collections.emptyList())));
}
Also used : MavenBuild(org.eclipse.che.maven.data.MavenBuild) MavenKey(org.eclipse.che.maven.data.MavenKey) MavenResource(org.eclipse.che.maven.data.MavenResource) MavenParent(org.eclipse.che.maven.data.MavenParent)

Aggregations

MavenBuild (org.eclipse.che.maven.data.MavenBuild)2 MavenKey (org.eclipse.che.maven.data.MavenKey)2 MavenParent (org.eclipse.che.maven.data.MavenParent)2 Build (org.apache.maven.model.Build)1 Model (org.apache.maven.model.Model)1 Parent (org.apache.maven.model.Parent)1 MavenModel (org.eclipse.che.maven.data.MavenModel)1 MavenResource (org.eclipse.che.maven.data.MavenResource)1