moved publish stuff to project build file, also publish sources
check if bean definition exists before calling getBean(...)