Search in sources :

Example 1 with MavenPlugin

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

the class MavenProject method setModel.

private MavenProjectModifications setModel(MavenModelReaderResult readerResult, boolean clearArtifacts, boolean clearProfiles) {
    Info newInfo = info.clone();
    newInfo.problems = readerResult.getProblems();
    newInfo.activeProfiles = readerResult.getActiveProfiles();
    MavenModel model = readerResult.getMavenModel();
    newInfo.mavenKey = model.getMavenKey();
    if (model.getParent() != null) {
        newInfo.parentKey = model.getParent().getMavenKey();
    }
    newInfo.packaging = model.getPackaging();
    newInfo.name = model.getName();
    newInfo.sources = model.getBuild().getSources();
    newInfo.testSources = model.getBuild().getTestSources();
    newInfo.resources = model.getBuild().getResources();
    newInfo.testResources = model.getBuild().getTestResources();
    newInfo.properties = model.getProperties();
    newInfo.filters = model.getBuild().getFilters();
    Set<MavenRemoteRepository> remoteRepositories = new HashSet<>();
    Set<MavenArtifact> extensions = new HashSet<>();
    Set<MavenArtifact> dependencies = new HashSet<>();
    Set<MavenPlugin> plugins = new HashSet<>();
    Set<MavenKey> unresolvedArtifacts = new HashSet<>();
    if (!clearArtifacts) {
        if (info.remoteRepositories != null) {
            remoteRepositories.addAll(info.remoteRepositories);
        }
        if (info.extensions != null) {
            extensions.addAll(info.extensions);
        }
        if (info.dependencies != null) {
            dependencies.addAll(info.dependencies);
        }
        if (info.plugins != null) {
            plugins.addAll(info.plugins);
        }
        if (info.unresolvedArtifacts != null) {
            unresolvedArtifacts.addAll(info.unresolvedArtifacts);
        }
    }
    remoteRepositories.addAll(model.getRemoteRepositories());
    extensions.addAll(model.getExtensions());
    dependencies.addAll(model.getDependencies());
    plugins.addAll(model.getPlugins());
    unresolvedArtifacts.addAll(readerResult.getUnresolvedArtifacts());
    newInfo.remoteRepositories = new ArrayList<>(remoteRepositories);
    newInfo.extensions = new ArrayList<>(extensions);
    newInfo.dependencies = new ArrayList<>(dependencies);
    newInfo.plugins = new ArrayList<>(plugins);
    newInfo.unresolvedArtifacts = unresolvedArtifacts;
    newInfo.modulesNameToPath = collectModulesNameAndPath(model);
    return setInfo(newInfo);
}
Also used : MavenKey(org.eclipse.che.maven.data.MavenKey) MavenModel(org.eclipse.che.maven.data.MavenModel) MavenPlugin(org.eclipse.che.maven.data.MavenPlugin) MavenRemoteRepository(org.eclipse.che.maven.data.MavenRemoteRepository) MavenArtifact(org.eclipse.che.maven.data.MavenArtifact) HashSet(java.util.HashSet)

Example 2 with MavenPlugin

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

the class MavenModelUtil method convertPlugins.

private static List<MavenPlugin> convertPlugins(Model model) {
    List<MavenPlugin> result = new ArrayList<>();
    Build build = model.getBuild();
    if (build != null) {
        List<Plugin> plugins = build.getPlugins();
        if (plugins != null) {
            result.addAll(plugins.stream().map(MavenModelUtil::convertPlugin).collect(Collectors.toList()));
        }
    }
    return result;
}
Also used : MavenBuild(org.eclipse.che.maven.data.MavenBuild) Build(org.apache.maven.model.Build) MavenPlugin(org.eclipse.che.maven.data.MavenPlugin) ArrayList(java.util.ArrayList) MavenPlugin(org.eclipse.che.maven.data.MavenPlugin) Plugin(org.apache.maven.model.Plugin)

Aggregations

MavenPlugin (org.eclipse.che.maven.data.MavenPlugin)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Build (org.apache.maven.model.Build)1 Plugin (org.apache.maven.model.Plugin)1 MavenArtifact (org.eclipse.che.maven.data.MavenArtifact)1 MavenBuild (org.eclipse.che.maven.data.MavenBuild)1 MavenKey (org.eclipse.che.maven.data.MavenKey)1 MavenModel (org.eclipse.che.maven.data.MavenModel)1 MavenRemoteRepository (org.eclipse.che.maven.data.MavenRemoteRepository)1