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)"
}
}
}
}
}
}
Thank you, a bug report has been opened at https://github.com/vaadin/vaadin-gradle-plugin/issues/54 ; please let us continue the discussion there.
Related
i am upgrading the Spring Boot version for one of the team's smaller projects, & it seems that Gradle is not able to download this specific package org.jfrog.artifactory.client:artifactory-java-client-services:2.13.0 from our company's Artifactory website
here is the build.gradle:
buildscript {
ext {
springBootVersion = '2.6.9'
}
repositories {
maven {
url "https://artifactory.trusted.visa.com/mavenrepo/"
credentials {
username = project.artifactory_username
password = project.artifactory_apikey
}
}
}
dependencies {
classpath 'org.ajoberstar:grgit:1.7.2'
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'eclipse-wtp'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'org.springframework.boot'
if (project.hasProperty("projVersion")) {
version = project.projVersion
} else {
version = "0.0-SNAPSHOT"
}
group = 'CoreConfigBackend'
// In this section you declare where to find the dependencies of your project
repositories {
maven {
url "https://artifactory.trusted.visa.com/visacommonssecurity-maven-virtual/"
credentials {
username = project.artifactory_username
password = project.artifactory_apikey
}
}
maven {
url "https://artifactory.trusted.visa.com/mavenrepo/"
credentials {
username = project.artifactory_username
password = project.artifactory_apikey
}
}
maven {
url "https://artifactory.trusted.visa.com/coreconfig_commons-snapshots/"
credentials {
username = project.artifactory_username
password = project.artifactory_apikey
}
}
}
configurations {
all*.exclude module : 'spring-boot-starter-logging'
}
dependencies {
if (project.hasProperty("local")) {
compile project(':CommonUtility')
} else {
compile(group: 'CoreConfigBackend', name: 'CommonUtility', version: version){ changing = true }
}
compile('org.springframework.boot:spring-boot-starter-web:2.6.9')
compile('org.springframework:spring-tx:5.3.22')
compile 'org.springframework.boot:spring-boot-starter-jdbc:2.6.9'
compile('com.github.ulisesbocchio:jasypt-spring-boot:2.1.0')
compile 'org.springframework.boot:spring-boot-starter-data-mongodb:2.6.9'
compile ("commons-lang:commons-lang:2.6")
compile 'com.fasterxml.jackson.core:jackson-core:2.9.4'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.9.4'
compile 'com.fasterxml.jackson.core:jackson-databind:2.9.4'
compile 'org.jfrog.artifactory.client:artifactory-java-client-services:2.13.0'
// Log4j 2
compile ('org.apache.logging.log4j:log4j-core:2.17.1')
compile ('org.apache.logging.log4j:log4j-api:2.17.1')
compile ('org.apache.logging.log4j:log4j-slf4j-impl:2.17.1')
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
}
bootJar {
exclude ("application.properties")
exclude ("database.properties")
exclude ("artifactory.properties")
}
task setupProject {
doFirst {
File dir = new File("$buildDir/../../../coreconfig_commons")
if(!dir.exists()) {
def grgit = org.ajoberstar.grgit.Grgit.clone(dir: "$buildDir/../../../coreconfig_commons", uri: "https://stash.trusted.visa.com:7990/scm/cor1dca/coreconfig_commons.git")
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
& the contents of the gradle-wrapper.properties:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
i run the command gradlew eclipse -Plocal -Partifactory_username='username' -Partifactory_apikey='password' in the command line to pull the packages.
Oddly, it's only this artifactory-java-client-services package that is missing, not sure why but somehow Gradle can't retrieve this package?
When i import the project into Eclipse, there is an Eclipse Error message saying that the artifactory-java-client-services package is missing.
Even this missing package warning is displayed in the command line after running the gradle command.
i checked our company's Artifactory website & i can see the package listed there
After running the gradlew eclipse -Plocal -Partifactory_username='username' -Partifactory_apikey='password' command in the command line, this is the output:
> Task :eclipseClasspath
Could not resolve: org.jfrog.artifactory.client:artifactory-java-client-services:2.13.0
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 33s
10 actionable tasks: 10 executed
This is my gradle version, after running gradlew -v:
gradlew -v
------------------------------------------------------------
Gradle 6.8
------------------------------------------------------------
Build time: 2021-01-08 16:38:46 UTC
Revision: b7e82460c5373e194fb478a998c4fcfe7da53a7e
Kotlin: 1.4.20
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_361 (Oracle Corporation 25.361-b31)
OS: Windows 10 10.0 amd64
I am compile flink using gradle(v6.0.1) build tool like this, but show this error:
~ ⌚ 13:53:42
$ bash -c "$(curl https://flink.apache.org/q/gradle-quickstart.sh)" -- 1.10.0 2.11
~/quickstart ⌚ 14:08:22
$ ./gradlew clean shadowJar
> Task :shadowJar FAILED
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':shadowJar' (type 'ShadowJar').
> No value has been specified for property 'mainClassName'.
* 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.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1s
4 actionable tasks: 4 executed
this this my gradle build.gradle:
buildscript {
repositories {
jcenter() // this applies only to the Gradle 'Shadow' plugin
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4'
}
}
plugins {
id 'java'
id 'application'
// shadow plugin to produce fat JARs
id 'com.github.johnrengelman.shadow' version '2.0.4'
}
apply plugin: 'application'
// artifact properties
group = 'org.myorg.quickstart'
version = '0.1-SNAPSHOT'
mainClassName = 'org.myorg.quickstart.StreamingJob'
description = """Flink Quickstart Job"""
ext {
javaVersion = '1.8'
flinkVersion = '1.10.0'
scalaBinaryVersion = '2.11'
slf4jVersion = '1.7.7'
log4jVersion = '1.2.17'
}
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
applicationDefaultJvmArgs = ["-Dlog4j.configuration=log4j.properties"]
// declare where to find the dependencies of your project
repositories {
mavenCentral()
}
// NOTE: We cannot use "compileOnly" or "shadow" configurations since then we could not run code
// in the IDE or with "gradle run". We also cannot exclude transitive dependencies from the
// shadowJar yet (see https://github.com/johnrengelman/shadow/issues/159).
// -> Explicitly define the // libraries we want to be included in the "flinkShadowJar" configuration!
configurations {
flinkShadowJar // dependencies which go into the shadowJar
// always exclude these (also from transitive dependencies) since they are provided by Flink
flinkShadowJar.exclude group: 'org.apache.flink', module: 'force-shading'
flinkShadowJar.exclude group: 'com.google.code.findbugs', module: 'jsr305'
flinkShadowJar.exclude group: 'org.slf4j'
flinkShadowJar.exclude group: 'log4j'
}
// declare the dependencies for your production and test code
dependencies {
// --------------------------------------------------------------
// Compile-time dependencies that should NOT be part of the
// shadow jar and are provided in the lib folder of Flink
// --------------------------------------------------------------
compile "org.apache.flink:flink-java:${flinkVersion}"
compile "org.apache.flink:flink-streaming-java_${scalaBinaryVersion}:${flinkVersion}"
// --------------------------------------------------------------
// Dependencies that should be part of the shadow jar, e.g.
// connectors. These must be in the flinkShadowJar configuration!
// --------------------------------------------------------------
//flinkShadowJar "org.apache.flink:flink-connector-kafka-0.11_${scalaBinaryVersion}:${flinkVersion}"
compile "log4j:log4j:${log4jVersion}"
compile "org.slf4j:slf4j-log4j12:${slf4jVersion}"
// Add test dependencies here.
// testCompile "junit:junit:4.12"
}
// make compileOnly dependencies available for tests:
sourceSets {
main.compileClasspath += configurations.flinkShadowJar
main.runtimeClasspath += configurations.flinkShadowJar
test.compileClasspath += configurations.flinkShadowJar
test.runtimeClasspath += configurations.flinkShadowJar
javadoc.classpath += configurations.flinkShadowJar
}
run.classpath = sourceSets.main.runtimeClasspath
jar {
manifest {
attributes 'Built-By': System.getProperty('user.name'),
'Build-Jdk': System.getProperty('java.version')
}
}
shadowJar {
configurations = [project.configurations.flinkShadowJar]
}
I am read the some answer to tell that the script do dot have mainClassName,but my config contains the mainClassName config,what should I do to fix this error? I am using macOS catalina.
downgrade the gradle to 4.0.1,it works.this is the gradle-wrapper.properties config:
#Mon Jan 06 13:52:34 CST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
this is the build command:
~/quickstart ⌚ 14:48:25
$ ./gradlew clean shadowJar
Downloading https://services.gradle.org/distributions/gradle-4.0.1-all.zip
........10%.........20%........30%.........40%........50%.........60%.........70%........80%.........90%........100%
Starting a Gradle Daemon (subsequent builds will be faster)
BUILD SUCCESSFUL in 1m 46s
4 actionable tasks: 4 executed
maybe help you.
I want to introduce com.alibaba:fastjson:1.2.58 in my plugin project, but when gradle resolve dependencies, the org.jetbrains.intellij plugin redirect the download request to https://cache-redirector.jetbrains.com/www.jetbrains.com/intellij-repository/releases/com/alibaba/fastjson/1.2.58/fastjson-1.2.58.pom, which is not exists.
How can I force gradle download this dependency from mavenCentral ?
Here is my build.gradle:
buildscript {
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url 'https://dl.bintray.com/jetbrains/intellij-plugin-service'
}
}
}
plugins {
id "org.jetbrains.intellij" version "0.4.4"
}
dependencies {
implementation 'com.alibaba:fastjson:1.2.58'
}
apply plugin: 'idea'
apply plugin: 'org.jetbrains.intellij'
apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
intellij {
version ideaVersion
updateSinceUntilBuild false
plugins = [
"com.jetbrains.php:${phpPluginVersion}",
"com.jetbrains.php.blade:${bladePluginVersion}",
'CSS',
'java-i18n',
'properties',
'git4idea'
]
pluginName 'tw tools'
}
patchPluginXml {
sinceBuild '173'
}
group 'com.baiguiren'
version '1.2'
wrapper {
gradleVersion '5.4.1'
}
Output of ./gradlew clean && ./gradlew build:
BUILD SUCCESSFUL in 0s
1 actionable task: 1 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':prepareSandbox'.
> Could not resolve all files for configuration ':runtimeClasspath'.
> Could not find com.alibaba:fastjson:1.2.58.
Searched in the following locations:
https://cache-redirector.jetbrains.com/www.jetbrains.com/intellij-repository/releases/com/alibaba/fastjson/1.2.58/fastjson-1.2.58.pom
https://cache-redirector.jetbrains.com/www.jetbrains.com/intellij-repository/releases/com/alibaba/fastjson/1.2.58/fastjson-1.2.58.jar
file:/Users/ruby/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIU/2018.3.5/3abea719ce307bc4f573cba4e3d86f4e35cab07/ideaIU-2018.3.5/com.alibaba/fastjson/1.2.58/ivy-1.2.58.xml
file:/Users/ruby/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIU/2018.3.5/3abea719ce307bc4f573cba4e3d86f4e35cab07/ideaIU-2018.3.5/fastjson-1.2.58-withKotlin-withSources.xml
file:/Users/ruby/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIU/2018.3.5/3abea719ce307bc4f573cba4e3d86f4e35cab07/ideaIU-2018.3.5/com.alibaba/fastjson/1.2.58/fastjson-1.2.58.jar
file:/Users/ruby/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIU/2018.3.5/3abea719ce307bc4f573cba4e3d86f4e35cab07/ideaIU-2018.3.5/fastjson.jar
file:/Users/ruby/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIC/2018.3.5/78cbcd517ec112fbb0c7b45b00b464c1aa6371f3/fastjson-1.2.58-[classifier].jar
https://cache-redirector.jetbrains.com/plugins.jetbrains.com/maven/com/alibaba/fastjson/1.2.58/fastjson-1.2.58.pom
https://cache-redirector.jetbrains.com/plugins.jetbrains.com/maven/com/alibaba/fastjson/1.2.58/fastjson-1.2.58.jar
file:/Users/ruby/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/com.alibaba/fastjson-1.2.58.xml
file:/Users/ruby/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIU/2018.3.5/3abea719ce307bc4f573cba4e3d86f4e35cab07/ideaIU-2018.3.5/plugins/fastjson/fastjson.jar
file:/Users/ruby/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/fastjson-1.2.58/fastjson.jar
file:/Users/ruby/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIC/2018.3.5/78cbcd517ec112fbb0c7b45b00b464c1aa6371f3/fastjson-2018.3.5.jar
Required by:
project :
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
I have tried to Invalid caches and restart, but not work.
I even tried to remove org.jetbrains.intellij plugin, but it's required by the project.
There is nothing wrong with cache-redirector, it's just one of the repositories registered in the project, Gradle checks them all.
Try to add the mavenCentral repo to your build.gradle (at the moment it's defined for buildscript only):
repositories {
mavenCentral()
}
I want to create a jar file which I can upload on AWS, but every time I run the command 'gradle jar' from command prompt I get the following error.
> Task :compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* 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.
* Get more help at https://help.gradle.org
I get 'Build Successful' whenever I run 'gradle clean' in command prompt. Here is the content of build.gradle:
buildscript {
ext {
springBootVersion = '2.0.4.RELEASE'
}
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath "net.ltgt.gradle:gradle-apt-plugin:0.18"
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'net.ltgt.apt'
group = 'com.myproject.api'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = JavaVersion.VERSION_1_8
ext {
lombokVersion = '1.16.20'
mapstructVersion = '1.2.0.Final'
}
repositories {
mavenCentral()
mavenLocal()
jcenter()
flatDir {
dirs 'libs'
}
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-mail')
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
compile('org.springframework.data:spring-data-jpa')
compile('io.springfox:springfox-swagger2:2.9.2')
compile('io.springfox:springfox-swagger-ui:2.9.2')
compile group: 'commons-io', name: 'commons-io', version: '2.6'
compile group: 'org.json', name: 'json', version: '20180813'
compile files('libs/checksum_2.0.0.jar')
compileOnly("org.projectlombok:lombok:${lombokVersion}")
compileOnly("org.mapstruct:mapstruct-jdk8:${mapstructVersion}")
compileOnly("org.mapstruct:mapstruct-processor:${mapstructVersion}")
runtime('org.springframework.boot:spring-boot-devtools')
runtime('mysql:mysql-connector-java')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
eclipse {
classpath {
file.whenMerged { cp ->
cp.entries.add( new org.gradle.plugins.ide.eclipse.model.SourceFolder('build/generated/source/apt/ma
in', null) )
}
}
}
Do I need to add any plugins? Thanks in advance. Please help
Open task manger and force stop Java(TM) Platform SE binary and delete
C:\Users\{current user}\.gradle\caches\jars-9\jars-9.lock file
I was using 'gradle clean' and 'gradle build' instead of 'gradlew clean' and 'gradlew build'. gradlew commands worked for me.
I am trying follow this tutorial to set up Grails/ Cargo: https://github.com/bmuschko/gradle-cargo-plugin I wish to use this plugin to deploy wars to local tomcat instances and to start and stop them.
Here is my build.gradle
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'cargo'
sourceCompatibility = 1.5
version = '1.0'
jar {
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart', 'Implementation-Version': version
}
}
repositories {
mavenCentral()
}
dependencies {
compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
testCompile group: 'junit', name: 'junit', version: '4.+'
classpath 'org.gradle.api.plugins:gradle-cargo-plugin:0.6.1'
def cargoVersion = '1.3.3'
cargo "org.codehaus.cargo:cargo-core-uberjar:$cargoVersion",
"org.codehaus.cargo:cargo-ant:$cargoVersion"
}
cargo {
containerId = 'tomcat6x'
port = 9090
deployable {
file = file('/Users/me/Documents/gradlemucks/grails_2/hello-world/target/hello-world-0.1.war')
context = 'helloworld'
}
local {
homeDir = file('/Users/me/developer/servers/apache-tomcat-6.0.37')
output = file('build/output.log')
tomcat {
ajpPort = 9091
}
}
}
test {
systemProperties 'property': 'value'
}
uploadArchives {
repositories {
flatDir {
dirs 'repos'
}
}
}
When I do gradle tasks in the terminal I get:
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/me/Documents/workspaces/regress_test/httptests/build.gradle' line: 3
* What went wrong:
A problem occurred evaluating root project 'httptests'.
> Plugin with id 'cargo' not found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
What are my doing wrong?
The buildscript itself need the cargo dependency so adding:
buildscript {
repositories {
mavenCentral()
}
dependencies { classpath "org.gradle.api.plugins:gradle-cargo-plugin:0.6" }
}
should make it able to find the cargo plugin.