plugins/org.wso2.developerstudio.eclipse.docker.distribution/src/org/wso2/developerstudio/eclipse/docker/distribution/action/DockerBuildActionUtil.java
/**
     * Method of creating maven launcher profile in ILaunchManager.
     * 
     * @param launchManager launcher
     * @param project selected IProject
     * @throws CoreException Error occurred while running the maven job
     */
Method of creating maven launcher profile in ILaunchManager.

@param launchManager launcher
@param project selected IProject
@throws CoreException Error occurred while running the maven job
Method of creating maven launcher profile in ILaunchManager . @param launchManager launcher @param project selected IProject @throws CoreException Error occurred while running the maven job
public static void runDockerBuildWithMavenProfile(IProject project, String mavenGoal, DockerHubAuth configuration)
            throws CoreException {
        ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
        if (findLaunchConfigurationByName(launchManager, MAVEN_DOCKER_BUILD) != null) {
            findLaunchConfigurationByName(launchManager, MAVEN_DOCKER_BUILD).delete();
        }
        ILaunchConfigurationType mavenTestLaunchType = launchManager
                .getLaunchConfigurationType(MAVEN_CONFIGURATION_TYPE);
        ILaunchConfigurationWorkingCopy mavenTestLaunchConfig = mavenTestLaunchType.newInstance(null,
                DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(MAVEN_DOCKER_BUILD));
        String containerMavenBuildGoal = mavenGoal;
        mavenTestLaunchConfig.setAttribute(MAVEN_GOAL_KEY, containerMavenBuildGoal);
        mavenTestLaunchConfig.setAttribute(MAVEN_WORKING_DIR_KEY, "${workspace_loc:/" + project.getName() + "}");
        String javaHomePath = getJavaHomePath();
        Map<String, String> environmentVariableMap = new HashMap<>();
        environmentVariableMap.put(JAVA_HOME_KEY, javaHomePath);
        mavenTestLaunchConfig.setAttribute(MAVEN_ENVIRONMENT_KEY, environmentVariableMap);
        mavenTestLaunchConfig.doSave();
        for (ILaunchConfiguration launchConfig : launchManager.getLaunchConfigurations()) {
            if (launchConfig.getName().equals(MAVEN_DOCKER_BUILD)) {
                ILaunch launch = launchConfig.launch(LAUNCHER_RUN, null);
                boolean isBuildOver = false;
                MavenJobThread mvnTread = new MavenJobThread(isBuildOver, launch, project, configuration);
                Thread newThread = new Thread(mvnTread);
                newThread.start();
                break;
            }
        }
    }
public static void runDockerBuildWithMavenProfile ( IProject project , String mavenGoal , DockerHubAuth configuration ) throws CoreException { ILaunchManager launchManager = DebugPlugin . getDefault ( ) . getLaunchManager ( ) ; if ( findLaunchConfigurationByName ( launchManager , MAVEN_DOCKER_BUILD ) != null ) { findLaunchConfigurationByName ( launchManager , MAVEN_DOCKER_BUILD ) . delete ( ) ; } ILaunchConfigurationType mavenTestLaunchType = launchManager . getLaunchConfigurationType ( MAVEN_CONFIGURATION_TYPE ) ; ILaunchConfigurationWorkingCopy mavenTestLaunchConfig = mavenTestLaunchType . newInstance ( null , DebugPlugin . getDefault ( ) . getLaunchManager ( ) . generateLaunchConfigurationName ( MAVEN_DOCKER_BUILD ) ) ; String containerMavenBuildGoal = mavenGoal ; mavenTestLaunchConfig . setAttribute ( MAVEN_GOAL_KEY , containerMavenBuildGoal ) ; mavenTestLaunchConfig . setAttribute ( MAVEN_WORKING_DIR_KEY , "${workspace_loc:/" + project . getName ( ) + "}" ) ; String javaHomePath = getJavaHomePath ( ) ; Map < String , String > environmentVariableMap = new HashMap < > ( ) ; environmentVariableMap . put ( JAVA_HOME_KEY , javaHomePath ) ; mavenTestLaunchConfig . setAttribute ( MAVEN_ENVIRONMENT_KEY , environmentVariableMap ) ; mavenTestLaunchConfig . doSave ( ) ; for ( ILaunchConfiguration launchConfig : launchManager . getLaunchConfigurations ( ) ) { if ( launchConfig . getName ( ) . equals ( MAVEN_DOCKER_BUILD ) ) { ILaunch launch = launchConfig . launch ( LAUNCHER_RUN , null ) ; boolean isBuildOver = false ; MavenJobThread mvnTread = new MavenJobThread ( isBuildOver , launch , project , configuration ) ; Thread newThread = new Thread ( mvnTread ) ; newThread . start ( ) ; break ; } } }
Method of creating maven launcher profile in ILaunchManager.
Method of creating maven launcher profile in ILaunchManager .
// remove existing maven launcher for docker build // creating a new Launcher for docker build // set maven properties for the created launcher // save the launcher with configuration data // Select the maven launcher and run it // execute build and push maven jobs using a another java thread