Class BuildSpec
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.codebuild.BuildSpec
- All Implemented Interfaces:
 software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
           date="2025-10-29T11:15:34.702Z")
@Stability(Stable)
public abstract class BuildSpec
extends software.amazon.jsii.JsiiObject
BuildSpec for CodeBuild projects.
 
Example:
 import software.amazon.awscdk.services.codebuild.*;
 Project codebuildProject = Project.Builder.create(this, "Project")
         .projectName("MyTestProject")
         .buildSpec(BuildSpec.fromObject(Map.of(
                 "version", "0.2",
                 "phases", Map.of(
                         "build", Map.of(
                                 "commands", List.of("echo \"Hello, CodeBuild!\""))))))
         .build();
 CodeBuildStartBuild task = CodeBuildStartBuild.Builder.create(this, "Task")
         .project(codebuildProject)
         .integrationPattern(IntegrationPattern.RUN_JOB)
         .environmentVariablesOverride(Map.of(
                 "ZONE", BuildEnvironmentVariable.builder()
                         .type(BuildEnvironmentVariableType.PLAINTEXT)
                         .value(JsonPath.stringAt("$.envVariables.zone"))
                         .build()))
         .build();
 - 
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic BuildSpecUse the contents of a local file as the build spec string.static BuildSpecfromObject(Map<String, ? extends Object> value) static BuildSpecfromObjectToYaml(Map<String, ? extends Object> value) Create a buildspec from an object that will be rendered as YAML in the resulting CloudFormation template.static BuildSpecfromSourceFilename(String filename) Use a file from the source as buildspec.abstract BooleanWhether the buildspec is directly available or deferred until build-time.abstract StringRender the represented BuildSpec.abstract StringtoBuildSpec(software.constructs.Construct scope) Render the represented BuildSpec.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson 
- 
Constructor Details
- 
BuildSpec
protected BuildSpec(software.amazon.jsii.JsiiObjectRef objRef)  - 
BuildSpec
protected BuildSpec(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)  - 
BuildSpec
@Stability(Stable) protected BuildSpec() 
 - 
 - 
Method Details
- 
fromAsset
Use the contents of a local file as the build spec string.Use this if you have a local .yml or .json file that you want to use as the buildspec
- Parameters:
 path- This parameter is required.
 - 
fromObject
@Stability(Stable) @NotNull public static BuildSpec fromObject(@NotNull Map<String, ? extends Object> value) - Parameters:
 value- This parameter is required.
 - 
fromObjectToYaml
@Stability(Stable) @NotNull public static BuildSpec fromObjectToYaml(@NotNull Map<String, ? extends Object> value) Create a buildspec from an object that will be rendered as YAML in the resulting CloudFormation template.- Parameters:
 value- the object containing the buildspec that will be rendered as YAML. This parameter is required.
 - 
fromSourceFilename
Use a file from the source as buildspec.Use this if you want to use a file different from 'buildspec.yml'`
- Parameters:
 filename- This parameter is required.
 - 
toBuildSpec
@Stability(Stable) @NotNull public abstract String toBuildSpec(@Nullable software.constructs.Construct scope) Render the represented BuildSpec.- Parameters:
 scope-
 - 
toBuildSpec
Render the represented BuildSpec. - 
getIsImmediate
Whether the buildspec is directly available or deferred until build-time. 
 -