The default compile stage executes maven with clean deploy -B -U
and
(of course) the default defines and settings provided by the pipeline
(ManagedFiles)
auto lookup mechanism
and the arg
- Step sequence
- Extension options
- Configuration options
- [RdefaultAnalyzeStage.md#maven-optional()
This step calls the
getDefaultMavenDefines
step first to enable
defines like
-Dcontinuous-integration=true
or-Dnodejs.directory=${WORKSPACE}/target/.nodejs
(when a nodejspackage.json
was found in the project)
The step then merges the default defines and the maven defaults with the incoming configuration.
After the configuration merge the
execMaven
step is called with the configuration
After the maven execution the fingerprints of the artifacts are recorded.
Used pattern: **/target/**/*.jar,**/target/**/*.zip
If enabled the step will stash the current workspace files under the
name compileFiles
so you will be able to use these files later in your
build on another node.
💡 The files will be then available by using unstash
the name compileFiles
(ConfigConstants.STASH_COMPILE_FILES
).
This step supports the extension mechanism, so you are able to extend the step by executing code before and/or after the step is executed or even replacing the whole functionality.
💡 See _extend
for an example.
All configuration options must be inside the compile
(ConfigConstants.STAGE_COMPILE
)
map element to be evaluated and used by the step.
import static de.provision.devops.jenkins.pipeline.utils.ConfigConstants.*
import static io.wcm.devops.jenkins.pipeline.utils.ConfigConstants.*
defaultCompileStage(
(STAGE_COMPILE) : [
(MAVEN) : [
// config from execMaven step
],
(STAGE_COMPILE_EXTEND) : null,
(STASH) : false
]
)
Constant | ConfigConstants.STAGE_COMPILE_EXTEND |
Type | Closure with signature (Map config, superImpl) |
Default | null |
Use this configuration option to overwrite or extend the
defaultCompileStage
step.
Example:
import static de.provision.devops.jenkins.pipeline.utils.ConfigConstants.*
import static io.wcm.devops.jenkins.pipeline.utils.ConfigConstants.*
def customCompileStage(Map config, superImpl) {
echo "before defaultCompileStage stage"
superImpl(config)
echo "after defaultCompileStage stage"
}
defaultCompileStage(
(STAGE_COMPILE) : [
(STAGE_COMPILE_EXTEND) : this.&customCompileStage
]
)
Constant | ConfigConstants.MAVEN |
Type | Map |
Default | null |
Since the configuration is calculated inside the step the default would be
[
(MAVEN_GOALS) : ["clean", "deploy"],
(MAVEN_ARGUMENTS) : ["-B", "-U"],
(MAVEN_DEFINES) : ["continuous-integration" : true]
]
💡 Please have a look at
execMaven
for a complete list of configuration options.
💡 When running in buildFeature
then the goals
are clean install
per default.
Constant | ConfigConstants.STASH |
Type | Boolean |
Default | false |
Controls if the workspace files will be stashed after the maven build.
💡 Use the available constant from
ConfigConstants