java
It is written with the assumption that it is used for Java applications that use Spring Boot and a Maven or Gradle wrapper.Example (BuildByMaven)
no available example in current language
func (e *Examples) Java_BuildByMaven(dir *dagger.Directory) *dagger.File {
return dag.Java().
Init().
WithMavenCache().
WithDir(dir).
Run([]string{"./mvnw", "clean", "package"}).
File("target/dagger-maven-0.0.1-SNAPSHOT.jar")
}
no available example in current language
no available example in current language
Example (BuildByGradle)
no available example in current language
func (e *Examples) Java_BuildByGradle(dir *dagger.Directory) *dagger.File {
return dag.Java().
Init().
WithGradleCache().
WithDir(dir).
Run([]string{"./gradlew", "bootJar"}).
File("build/libs/dagger-gradle-0.0.1-SNAPSHOT.jar")
}
no available example in current language
no available example in current language
Installation
dagger install github.com/seungyeop-lee/daggerverse/java@v0.2.2
Entrypoint
Return Type
Java
Example
dagger -m github.com/seungyeop-lee/daggerverse/java@f68fd5ad99b77c58a152c173fa505f6f9388045f call \
func (m *myModule) example() *Java {
return dag.
Java()
}
@function
def example() -> dag.Java:
return (
dag.java()
)
@func()
example(): Java {
return dag
.java()
}
Types
Java 🔗
Java dagger module
init() 🔗
Initializes a JavaConfig with default settings.
Return Type
Config !
Example
dagger -m github.com/seungyeop-lee/daggerverse/java@f68fd5ad99b77c58a152c173fa505f6f9388045f call \
init
func (m *myModule) example() *JavaConfig {
return dag.
Java().
Init()
}
@function
def example() -> dag.JavaConfig:
return (
dag.java()
.init()
)
@func()
example(): JavaConfig {
return dag
.java()
.init()
}
Config 🔗
JavaConfig struct definition This struct holds the configuration for Java applications.
withImage() 🔗
Sets a custom Docker image for the Java application.
Return Type
Config !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
image | String ! | - | No description provided |
Example
dagger -m github.com/seungyeop-lee/daggerverse/java@f68fd5ad99b77c58a152c173fa505f6f9388045f call \
init \
with-image --image string
func (m *myModule) example(image string) *JavaConfig {
return dag.
Java().
Init().
WithImage(image)
}
@function
def example(image: str) -> dag.JavaConfig:
return (
dag.java()
.init()
.with_image(image)
)
@func()
example(image: string): JavaConfig {
return dag
.java()
.init()
.withImage(image)
}
withGradleCache() 🔗
Enables the Gradle cache.
Return Type
Config !
Example
dagger -m github.com/seungyeop-lee/daggerverse/java@f68fd5ad99b77c58a152c173fa505f6f9388045f call \
init \
with-gradle-cache
func (m *myModule) example() *JavaConfig {
return dag.
Java().
Init().
WithGradleCache()
}
@function
def example() -> dag.JavaConfig:
return (
dag.java()
.init()
.with_gradle_cache()
)
@func()
example(): JavaConfig {
return dag
.java()
.init()
.withGradleCache()
}
withMavenCache() 🔗
Enables the Maven cache.
Return Type
Config !
Example
dagger -m github.com/seungyeop-lee/daggerverse/java@f68fd5ad99b77c58a152c173fa505f6f9388045f call \
init \
with-maven-cache
func (m *myModule) example() *JavaConfig {
return dag.
Java().
Init().
WithMavenCache()
}
@function
def example() -> dag.JavaConfig:
return (
dag.java()
.init()
.with_maven_cache()
)
@func()
example(): JavaConfig {
return dag
.java()
.init()
.withMavenCache()
}
withDir() 🔗
Sets the directory to run the command in.
Return Type
Config !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
dir | Directory ! | - | No description provided |
Example
dagger -m github.com/seungyeop-lee/daggerverse/java@f68fd5ad99b77c58a152c173fa505f6f9388045f call \
init \
with-dir --dir DIR_PATH
func (m *myModule) example(dir *Directory) *JavaConfig {
return dag.
Java().
Init().
WithDir(dir)
}
@function
def example(dir: dagger.Directory) -> dag.JavaConfig:
return (
dag.java()
.init()
.with_dir(dir)
)
@func()
example(dir: Directory): JavaConfig {
return dag
.java()
.init()
.withDir(dir)
}
container() 🔗
Returns the conainer with the settings applied.
Return Type
Container !
Example
dagger -m github.com/seungyeop-lee/daggerverse/java@f68fd5ad99b77c58a152c173fa505f6f9388045f call \
init \
container
func (m *myModule) example() *Container {
return dag.
Java().
Init().
Container()
}
@function
def example() -> dagger.Container:
return (
dag.java()
.init()
.container()
)
@func()
example(): Container {
return dag
.java()
.init()
.container()
}
run() 🔗
Run the command in the environment you set up.
Return Type
Container !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
cmd | [String ! ] ! | - | Command to run |
Example
dagger -m github.com/seungyeop-lee/daggerverse/java@f68fd5ad99b77c58a152c173fa505f6f9388045f call \
init \
run --cmd string1 --cmd string2
func (m *myModule) example(cmd []string) *Container {
return dag.
Java().
Init().
Run(cmd)
}
@function
def example(cmd: List[str]) -> dagger.Container:
return (
dag.java()
.init()
.run(cmd)
)
@func()
example(cmd: string[]): Container {
return dag
.java()
.init()
.run(cmd)
}