java-buildpack

java-buildpack源码分析之Detect

穿精又带淫゛_ 提交于 2019-12-04 06:32:16
Detect 该buildpack的探测的内容包含:容器,JRE,框架。具体内容在components.yml中可以看到: # Configuration for components to use in the buildpack --- containers: - "JavaBuildpack::Container::DistZip" - "JavaBuildpack::Container::Groovy" - "JavaBuildpack::Container::JavaMain" - "JavaBuildpack::Container::PlayFramework" - "JavaBuildpack::Container::Ratpack" - "JavaBuildpack::Container::SpringBoot" - "JavaBuildpack::Container::SpringBootCLI" - "JavaBuildpack::Container::Tomcat" # In order to use Oracle JREs instead of OpenJDK, you must comment out the OpenJDK line and uncomment the Oracle line. # Please see the documentation

java-buildpack源码分析之Compile

萝らか妹 提交于 2019-12-04 06:31:41
bin/compile 入口是:bin/compile,该脚本和detect脚本很类似:需要一个构建目录实例化buildpack对象,并调用其compile接口。 注意:在这个脚本看似只有一个参数,但运行时实际需要第二个参数:应用缓存目录,当下载JDK, compile方法 compile mpile compile先调用component_detection,探测了对容器,JRE,framework的支持情况,并依次调用JRE的编译,每个框架的编译,和容器的编译。 Ruby代码 def compile puts BUILDPACK_MESSAGE % @buildpack_version container = component_detection( 'container' , @containers , true ).first fail 'No container can run this application' unless container component_detection( 'JRE' , @jres , true ).first.compile component_detection( 'framework' , @frameworks , false ). each (& :compile ) #调用每一个框架的编译 container.compile