deploymentUnit.putAttachment(WeldAttachments.CLASSES_RESOURCE_ROOT, resourceRoot);
} else {
VirtualFile beansXml = resourceRoot.getRoot().getChild(META_INF_BEANS_XML);
if (beansXml.exists() && beansXml.isFile()) {
WeldLogger.DEPLOYMENT_LOGGER.debugf("Found beans.xml: %s", beansXml.toString());
beanArchiveMetadata.put(resourceRoot, new ExplicitBeanArchiveMetadata(beansXml, resourceRoot, parseBeansXml(beansXml, parser, deploymentUnit), false));
}
}
}
}
if (DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) {
final VirtualFile rootBeansXml = deploymentRoot.getRoot().getChild(WEB_INF_BEANS_XML);
final boolean rootBeansXmlPresent = rootBeansXml.exists() && rootBeansXml.isFile();
VirtualFile beansXml = null;
if (classesRoot != null) {
beansXml = classesRoot.getRoot().getChild(META_INF_BEANS_XML);
}
final boolean beansXmlPresent = beansXml != null && beansXml.exists() && beansXml.isFile();
if (rootBeansXmlPresent) {
if (beansXmlPresent) {
// warn that it is not portable to use both locations at the same time
WeldLogger.DEPLOYMENT_LOGGER.duplicateBeansXml();
beanArchiveMetadata.put(deploymentRoot, new ExplicitBeanArchiveMetadata(rootBeansXml, beansXml, classesRoot, parseBeansXml(rootBeansXml, parser, deploymentUnit), true));
} else {
WeldLogger.DEPLOYMENT_LOGGER.debugf("Found beans.xml: %s", rootBeansXml);
beanArchiveMetadata.put(deploymentRoot, new ExplicitBeanArchiveMetadata(rootBeansXml, classesRoot, parseBeansXml(rootBeansXml, parser, deploymentUnit), true));
}
} else if (beansXmlPresent) {
WeldLogger.DEPLOYMENT_LOGGER.debugf("Found beans.xml: %s", beansXml);
beanArchiveMetadata.put(deploymentRoot, new ExplicitBeanArchiveMetadata(beansXml, classesRoot, parseBeansXml(beansXml, parser, deploymentUnit), true));
}
} else if (!DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) {
final VirtualFile rootBeansXml = deploymentRoot.getRoot().getChild(META_INF_BEANS_XML);
if (rootBeansXml.exists() && rootBeansXml.isFile()) {
WeldLogger.DEPLOYMENT_LOGGER.debugf("Found beans.xml: %s", rootBeansXml.toString());
beanArchiveMetadata.put(deploymentRoot, new ExplicitBeanArchiveMetadata(rootBeansXml, deploymentRoot, parseBeansXml(rootBeansXml, parser, deploymentUnit), true));
}
}
if (!beanArchiveMetadata.isEmpty()) {
ExplicitBeanArchiveMetadataContainer deploymentMetadata = new ExplicitBeanArchiveMetadataContainer(beanArchiveMetadata);