public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final ModuleSpecification moduleSpecification = deploymentUnit . getAttachment ( Attachments . MODULE_SPECIFICATION ) ; final ModuleLoader moduleLoader = Module . getBootModuleLoader ( ) ; addDependency ( moduleSpecification , moduleLoader , JAVAX_ENTERPRISE_API ) ; addDependency ( moduleSpecification , moduleLoader , JAVAX_INJECT_API ) ; if ( ! WeldDeploymentMarker . isPartOfWeldDeployment ( deploymentUnit ) ) { return ; // Skip if there are no beans.xml files in the deployment } addDependency ( moduleSpecification , moduleLoader , JAVAX_PERSISTENCE_API_ID ) ; addDependency ( moduleSpecification , moduleLoader , WELD_CORE_ID ) ; addDependency ( moduleSpecification , moduleLoader , WELD_PROBE_ID , true ) ; addDependency ( moduleSpecification , moduleLoader , WELD_API_ID ) ; addDependency ( moduleSpecification , moduleLoader , WELD_SPI_ID ) ; ModuleDependency weldSubsystemDependency = new ModuleDependency ( moduleLoader , JBOSS_AS_WELD_ID , false , false , false , false ) ; weldSubsystemDependency . addImportFilter ( PathFilters . getMetaInfFilter ( ) , true ) ; weldSubsystemDependency . addImportFilter ( PathFilters . is ( "org/jboss/as/weld/injection" ) , true ) ; weldSubsystemDependency . addImportFilter ( PathFilters . acceptAll ( ) , false ) ; weldSubsystemDependency . addExportFilter ( PathFilters . getMetaInfFilter ( ) , true ) ; moduleSpecification . addSystemDependency ( weldSubsystemDependency ) ; // Due to serialization of EJBs ModuleDependency weldEjbDependency = new ModuleDependency ( moduleLoader , JBOSS_AS_WELD_EJB_ID , true , false , false , false ) ; weldEjbDependency . addImportFilter ( PathFilters . is ( "org/jboss/as/weld/ejb" ) , true ) ; weldEjbDependency . addImportFilter ( PathFilters . acceptAll ( ) , false ) ; moduleSpecification . addSystemDependency ( weldEjbDependency ) ; }
Add dependencies for modules required for weld deployments if managed weld configurations are attached to the deployment