All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.openliberty.tools.maven.server.PrepareFeatureMojo Maven / Gradle / Ivy

Go to download

Liberty Maven Plugin : Install, Start/Stop, Package, Create Server, Deploy/Undeploy applications

There is a newer version: 3.11.1
Show newest version
/**
 * (C) Copyright IBM Corporation 2021, 2024.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package io.openliberty.tools.maven.server;

import java.util.List;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;

import io.openliberty.tools.common.plugins.util.InstallFeatureUtil;
import io.openliberty.tools.common.plugins.util.PluginExecutionException;
import io.openliberty.tools.common.plugins.util.PrepareFeatureUtil;
import io.openliberty.tools.common.plugins.util.InstallFeatureUtil.ProductProperties;
import io.openliberty.tools.maven.PrepareFeatureSupport;


/**
 * This mojo generates JSON files so user features can be installed
 * from a specified BOM
 */
@Mojo(name = "prepare-feature", threadSafe = true)
public class PrepareFeatureMojo extends PrepareFeatureSupport {
	    
    @Override
    public void execute() throws MojoExecutionException {
        init();

        if (skip) {
            getLog().info("\nSkipping prepare-feature goal.\n");
            return;
        }
        
        doPrepareFeatures();
    }

    private void doPrepareFeatures() throws MojoExecutionException {
        try {
            prepareFeatures();
        } catch (PluginExecutionException e) {
            throw new MojoExecutionException("Error preparing features.", e);
        }
    }
    
    private void prepareFeatures() throws PluginExecutionException {
    	List propertiesList = InstallFeatureUtil.loadProperties(installDirectory);
        String openLibertyVersion = InstallFeatureUtil.getOpenLibertyVersion(propertiesList);
        PrepareFeatureUtil util = getPrepareFeatureUtil(openLibertyVersion);
        //Get list of BOM dependencies from dependencyManagement section
        List dependencyListedBOMs = getDependencyBOMs();
        if(util != null) {
            util.prepareFeatures(dependencyListedBOMs);
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy