deployment.setAutoStart(true);
OSGiDeploymentAttachment.attachDeployment(deploymentUnit, deployment);
}
// Check for attached OSGiMetaData
OSGiMetaData metadata = OSGiMetaDataAttachment.getOSGiMetaData(deploymentUnit);
if (deployment == null && metadata != null) {
String symbolicName = metadata.getBundleSymbolicName();
Version version = metadata.getBundleVersion();
VirtualFile virtualFile = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
deployment = DeploymentFactory.createDeployment(AbstractVFS.adapt(virtualFile), contextName, symbolicName, version);
deployment.setAutoStart(true);
deployment.addAttachment(OSGiMetaData.class, metadata);
OSGiDeploymentAttachment.attachDeployment(deploymentUnit, deployment);