Pregunta

I am developing some eclipse plugins which requires to run,debug custom eclipse project on server like any other dynamic web project.

Like dynamic web project in eclipse i have created a custom project nature of web project & i want to deploy and run project on server like tomcat using Run On Server wizard of eclipse.So basically i want to know how to create IModuleArtifact object from custom project and deploy it using server wizard of eclipse.

Can somebody guide me in right direction?? Thanks.

¿Fue útil?

Solución

As far i can understand you have a web project but structure different to dynamic web project. So you can add web project nature to the project using following-

 IFacetedProject facetedProject = ProjectFacetsManager.create(project, true, null);
 IFacetedProjectWorkingCopy workingCopy = facetedProject.createWorkingCopy();
 IProjectFacet webFacet = ProjectFacetsManager.getProjectFacet("jst.web"); 
 IProjectFacetVersion defaultWebFacet = webFacet.getDefaultVersion();
 workingCopy.addProjectFacet(defaultWebFacet);

And then change the deployment settings using project ->properties->Deployment Assembly to map project resources that will go into WAR file. You can also configure this programatically using following code-

IVirtualComponent rootComponent = ComponentCore
                .createComponent(project);
IFolder buildXwtFolder =//Source Folder;
        IVirtualFolder rootFolder = rootComponent.getRootFolder();
        IVirtualFolder subFolder = rootFolder.getFolder("Deploy path");
        subFolder.createLink(buildXwtFolder.getProjectRelativePath(), 0,
                null);
        if (subFolder instanceof ITaggedVirtualResource) {
            ((ITaggedVirtualResource) subFolder).tagResource(
                    buildXwtFolder.getProjectRelativePath(),
                    null, null);
        }
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top