My app is based on Spring Boot 2.2.5 including Vaadin 14. The project is built with Gradle 5.6.4 using the Vaadin Gradle Plugin 0.6.0.
The Jenkins build pipeline fails with the following error:
Welcome to Gradle 5.6.4!
Here are the highlights of this release:
- Incremental Groovy compilation
- Groovy compile avoidance
- Test fixtures for Java projects
- Manage plugin versions via settings script
For more details see https://docs.gradle.org/5.6.4/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :clean
> Task :nodeSetup
> Task :vaadinPrepareNode
> Task :compileJava
> Task :vaadinPrepareFrontend
> Task :processResources
> Task :classes
> Task :vaadinBuildFrontend FAILED
Command `/var/lib/jenkins/workspace/build-mokka-app/gradle/node/node /var/lib/jenkins/workspace/build-mokka-app/gradle/node/node_modules/npm/bin/npm-cli.js --no-update-notifier install` failed:
>>> Dependency ERROR. Check that all required dependencies are deployed in npm repositories.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':vaadinBuildFrontend'.
> com.vaadin.flow.server.ExecutionFailedException: Npm install has exited with non zero status. Some dependencies are not installed. Check npm command output
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Here are my artifacts…
build.gradle
plugins {
id 'org.springframework.boot' version '2.2.5.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'org.siouan.frontend' version '1.3.1'
id 'com.vaadin' version '0.6.0'
id 'java'
}
group = 'mygroup'
version = '1.4.0-rc.1'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
ext {
commonsLangVersion = '3.9'
vaadinVersion = '14.1.18'
}
repositories {
mavenCentral()
maven { url 'https://maven.vaadin.com/vaadin-addons' }
}
dependencyManagement {
imports {
mavenBom "com.vaadin:vaadin-bom:${vaadinVersion}"
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'com.vaadin:vaadin-spring-boot-starter'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
compile "org.apache.commons:commons-lang3:${commonsLangVersion}"
}
test {
useJUnitPlatform()
}
Jenkinsfile
pipeline {
agent any
triggers { pollSCM('H/5 * * * *') }
environment {
APP_NAME = 'MyApp'
// Gradle settings
GRADLE_DOCKER_IMAGE = 'gradle:5.6.4-jdk8'
GRADLE_DOCKER_ARGS = '-v ${HOME}/.m2:/maven/.m2'
GRADLE_DEPENDENCY_PATH = 'build/dependency'
}
stages {
stage('Compile') {
steps {
script {
docker.image(GRADLE_DOCKER_IMAGE).inside("${GRADLE_DOCKER_ARGS}") {
sh './gradlew clean vaadinPrepareNode build -Pvaadin.productionMode'
sh "mkdir -p ${GRADLE_DEPENDENCY_PATH} && (cd ${GRADLE_DEPENDENCY_PATH}; jar -xf ../libs/*.jar)"
}
}
}
}
}
}