Search in sources :

Example 16 with IBundleProject

use of com.liferay.ide.core.IBundleProject in project liferay-ide by liferay.

the class BundlePublishFullAdd method execute.

@Override
public void execute(IProgressMonitor monitor, IAdaptable info) throws CoreException {
    for (IModule module : modules) {
        IStatus retval = Status.OK_STATUS;
        IProject project = module.getProject();
        if (project == null) {
            continue;
        }
        final IBundleProject bundleProject = LiferayCore.create(IBundleProject.class, project);
        if (bundleProject != null) {
            // TODO catch error in getOutputJar and show a popup notification instead
            monitor.subTask("Building " + module.getName() + " output bundle...");
            try {
                IPath outputJar = bundleProject.getOutputBundle(cleanBuildNeeded(), monitor);
                if (FileUtil.exists(outputJar)) {
                    if (server.getServerState() == IServer.STATE_STARTED) {
                        monitor.subTask("Remotely deploying " + module.getName() + " to Liferay module framework...");
                        retval = remoteDeploy(bundleProject.getSymbolicName(), outputJar);
                    } else {
                        retval = autoDeploy(outputJar);
                    }
                    portalServerBehavior.setModuleState2(new IModule[] { module }, IServer.STATE_STARTED);
                } else {
                    retval = LiferayServerCore.error("Could not create output jar");
                }
            } catch (Exception e) {
                retval = LiferayServerCore.error("Deploy module project error", e);
            }
        } else {
            retval = LiferayServerCore.error("Unable to get bundle project for " + module.getProject().getName());
        }
        if (retval.isOK()) {
            this.portalServerBehavior.setModulePublishState2(new IModule[] { module }, IServer.PUBLISH_STATE_NONE);
            project.deleteMarkers(LiferayServerCore.BUNDLE_OUTPUT_ERROR_MARKER_TYPE, false, 0);
        } else {
            this.portalServerBehavior.setModulePublishState2(new IModule[] { module }, IServer.PUBLISH_STATE_NONE);
            project.createMarker(LiferayServerCore.BUNDLE_OUTPUT_ERROR_MARKER_TYPE);
            LiferayServerCore.logError(retval);
        }
    }
}
Also used : IModule(org.eclipse.wst.server.core.IModule) IStatus(org.eclipse.core.runtime.IStatus) IBundleProject(com.liferay.ide.core.IBundleProject) IPath(org.eclipse.core.runtime.IPath) IProject(org.eclipse.core.resources.IProject) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) CoreException(org.eclipse.core.runtime.CoreException)

Example 17 with IBundleProject

use of com.liferay.ide.core.IBundleProject in project liferay-ide by liferay.

the class MavenModuleProjectTests method testThemeProjectComponentConfiguration.

@Test
public void testThemeProjectComponentConfiguration() throws Exception {
    NewLiferayModuleProjectOp op = NewLiferayModuleProjectOp.TYPE.instantiate();
    op.setProjectName("maven-theme-component-test");
    op.setProjectProvider("maven-module");
    op.setProjectTemplateName("theme");
    op.execute(ProgressMonitorBridge.create(new NullProgressMonitor()));
    IProject project = CoreUtil.getProject("maven-theme-component-test");
    assertNotNull(project);
    IBundleProject bundleProject = LiferayCore.create(IBundleProject.class, project);
    assertNotNull(bundleProject);
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IBundleProject(com.liferay.ide.core.IBundleProject) NewLiferayModuleProjectOp(com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 18 with IBundleProject

use of com.liferay.ide.core.IBundleProject in project liferay-ide by liferay.

the class MavenModuleProjectTests method verifyProject.

private void verifyProject(IProject project) throws Exception {
    assertNotNull(project);
    assertTrue(project.exists());
    assertFalse(project.getFile("build.gradle").exists());
    project.build(IncrementalProjectBuilder.CLEAN_BUILD, monitor);
    waitForJobsToComplete();
    project.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
    waitForJobsToComplete();
    assertNoErrors(project);
    IBundleProject bundleProject = LiferayCore.create(IBundleProject.class, project);
    assertNotNull(bundleProject);
    IPath outputBundle = bundleProject.getOutputBundle(true, monitor);
    assertNotNull(outputBundle);
    assertTrue(outputBundle.toFile().exists());
}
Also used : IBundleProject(com.liferay.ide.core.IBundleProject) IPath(org.eclipse.core.runtime.IPath)

Aggregations

IBundleProject (com.liferay.ide.core.IBundleProject)18 IProject (org.eclipse.core.resources.IProject)11 IPath (org.eclipse.core.runtime.IPath)8 Test (org.junit.Test)7 IModule (org.eclipse.wst.server.core.IModule)6 NewLiferayModuleProjectOp (com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp)5 CoreException (org.eclipse.core.runtime.CoreException)5 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)4 ArrayList (java.util.ArrayList)3 IOException (java.io.IOException)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 IStatus (org.eclipse.core.runtime.IStatus)2 IServer (org.eclipse.wst.server.core.IServer)2 IModuleResource (org.eclipse.wst.server.core.model.IModuleResource)2 ILiferayProject (com.liferay.ide.core.ILiferayProject)1 LiferayGradleProject (com.liferay.ide.gradle.core.LiferayGradleProject)1 IProjectBuilder (com.liferay.ide.project.core.IProjectBuilder)1 PluginsSDKBundleProject (com.liferay.ide.project.core.PluginsSDKBundleProject)1 SDK (com.liferay.ide.sdk.core.SDK)1 GogoBundleDeployer (com.liferay.ide.server.core.gogo.GogoBundleDeployer)1