classesRoot = 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.add(new BeanArchiveMetadata(beansXml, resourceRoot, parseBeansXml(beansXml,
parser, deploymentUnit), false));
}
}
}
}
if (DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) {
// look for WEB-INF/beans.xml
final VirtualFile rootBeansXml = deploymentRoot.getRoot().getChild(WEB_INF_BEANS_XML);
if (rootBeansXml.exists() && rootBeansXml.isFile() && classesRoot != null) {
WeldLogger.DEPLOYMENT_LOGGER.debugf("Found beans.xml: %s", rootBeansXml);
beanArchiveMetadata.add(new BeanArchiveMetadata(rootBeansXml, classesRoot, parseBeansXml(rootBeansXml, parser, deploymentUnit), true));
} else if (classesRoot != null) {
//look for beans.xml files in the wrong location
VirtualFile beansXml = classesRoot.getRoot().getChild(META_INF_BEANS_XML);
if (beansXml.exists() && beansXml.isFile()) {
WeldLogger.DEPLOYMENT_LOGGER.beansXmlInNonStandardLocation(beansXml.toString());
beanArchiveMetadata.add(new BeanArchiveMetadata(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.add(new BeanArchiveMetadata(rootBeansXml, deploymentRoot, parseBeansXml(rootBeansXml, parser, deploymentUnit), true));
}
}
if (!beanArchiveMetadata.isEmpty()) {
WeldDeploymentMetadata deploymentMetadata = new WeldDeploymentMetadata(beanArchiveMetadata);