Gradle does not copy jars to Maven .m2 folder - maven

What could be missing in this build.gradle file that prevents the publishToMavenLocal not to copy files to the .m2 folder?
The script does have the 'maven-publish' plugin.
buildscript {
ext.kotlinVersion = '1.3.10'
ext.dokkaVersion = '0.9.17'
repositories { mavenLocal() }
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion"
}
}
plugins {
id 'com.github.hierynomus.license' version '0.15.0'
id 'io.codearte.nexus-staging' version '0.11.0'
id 'maven-publish'
}
group = 'org.jetbrains.xodus'
version = hasProperty('xodusVersion') ? project.xodusVersion : ''
def isSnapshot = version.endsWith('SNAPSHOT')
def isDailyBuild = hasProperty('dailyBuild') ? project.dailyBuild : false
def mavenPublishUrl = hasProperty('mavenPublishUrl') ? project.mavenPublishUrl : ''
def mavenPublishUsername = hasProperty('mavenPublishUsername') ? project.mavenPublishUsername : ''
def mavenPublishPassword = hasProperty('mavenPublishPassword') ? project.mavenPublishPassword : ''
def signingKeyId = hasProperty('signingKeyId') ? project.signingKeyId : ''
def signingPassword = hasProperty('signingPassword') ? project.signingPassword : ''
def signingSecretKeyRingFile = hasProperty('signingSecretKeyRingFile') ? project.signingSecretKeyRingFile : '../key.gpg'
static def shouldDeploy(project) {
return project.version.length() > 0 && !(project.name in ['benchmarks', 'samples'])
}
task wrapper(type: Wrapper) {
gradleVersion = '3.5.1'
}
defaultTasks 'assemble'
// Use nexus-staging-plugin to workaround https://issues.sonatype.org/browse/OSSRH-5454
nexusStaging {
username = mavenPublishUsername
password = mavenPublishPassword
delayBetweenRetriesInMillis = 30000
stagingProfileId = "89ee7caa6631c4"
}
subprojects {
apply plugin: 'license'
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'org.jetbrains.dokka'
sourceCompatibility = 1.7
compileJava.options.encoding = 'UTF-8'
group = rootProject.group
version = rootProject.version
archivesBaseName = rootProject.name + '-' + project.name
license {
header rootProject.file('license/copyright.ftl')
strictCheck true
ext.inceptionYear = 2010
ext.year = Calendar.getInstance().get(Calendar.YEAR)
ext.owner = 'JetBrains s.r.o.'
include "**/*.kt"
include "**/*.java"
mapping {
kt = 'JAVADOC_STYLE'
}
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25'
}
// tests for most of sub-projects run with database encryption turned on
if (!(project.name in ['benchmarks', 'compress', 'crypto', 'openAPI', 'samples', 'utils'])) {
test {
systemProperty 'exodus.cipherId', 'jetbrains.exodus.crypto.streamciphers.ChaChaStreamCipherProvider'
systemProperty 'exodus.cipherKey', '000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f'
systemProperty 'exodus.cipherBasicIV', '314159262718281828'
// uncomment the following line to run tests in-memory
//systemProperty 'exodus.log.readerWriterProvider', 'jetbrains.exodus.io.inMemory.MemoryDataReaderWriterProvider'
}
dependencies {
testCompile project(':crypto')
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
jar {
manifest {
attributes 'Implementation-Title': archivesBaseName, 'Implementation-Version': version
}
}
test {
minHeapSize = '1g'
maxHeapSize = '1g'
//jvmArgs = ['-ea', '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=2808']
//testLogging.showStandardStreams = true
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
duplicatesStrategy 'exclude'
includeEmptyDirs false
from javadoc.destinationDir
}
javadoc.failOnError = false
// work around for Java 8 javadoc which is too strict
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
task sourceJar(type: Jar) {
classifier = 'sources'
duplicatesStrategy 'exclude'
includeEmptyDirs false
from project.sourceSets.main.java
from project.sourceSets.main.kotlin
}
// configuring projects with Kotlin sources
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
compile 'io.github.microutils:kotlin-logging:1.5.4'
}
compileKotlin {
kotlinOptions {
languageVersion = '1.2'
apiVersion = '1.2'
}
}
compileTestKotlin {
kotlinOptions {
languageVersion = '1.2'
apiVersion = '1.2'
}
}
dokka {
jdkVersion = 7
packageOptions {
reportUndocumented = false
}
}
task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
outputFormat = 'javadoc'
outputDirectory = "$buildDir/javadoc"
}
javadocJar {
dependsOn dokkaJavadoc
from dokkaJavadoc.outputDirectory
}
artifacts {
archives jar, javadocJar, sourceJar
}
if (!isSnapshot && signingKeyId.length() > 0) {
ext.'signing.keyId' = signingKeyId
ext.'signing.password' = signingPassword
ext.'signing.secretKeyRingFile' = signingSecretKeyRingFile
}
afterEvaluate { project ->
if (shouldDeploy(project)) {
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
if (isDailyBuild) {
repository(url: "https://api.bintray.com/maven/jetbrains/xodus/" + archivesBaseName + "/;publish=1") {
authentication(userName: mavenPublishUsername, password: mavenPublishPassword)
}
} else {
repository(url: mavenPublishUrl) {
authentication(userName: mavenPublishUsername, password: mavenPublishPassword)
}
}
pom.project {
name 'Xodus'
description 'Xodus is pure Java transactional schema-less embedded database'
packaging 'jar'
url 'https://github.com/JetBrains/xodus'
scm {
url 'https://github.com/JetBrains/xodus'
connection 'scm:git:https://github.com/JetBrains/xodus.git'
developerConnection 'scm:git:https://github.com/JetBrains/xodus.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/license/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'JetBrains'
name 'JetBrains Team'
organization 'JetBrains s.r.o'
organizationUrl 'http://www.jetbrains.com'
}
}
}
}
}
}
signing {
required { !isSnapshot && signingKeyId.length() > 0 && gradle.taskGraph.hasTask('uploadArchives') }
sign configurations.archives
}
}
}
}

Your build does not configure any publications, hence the publishToMavenLocal task is a noop:
$ ./gradlew --console=verbose publishToMavenLocal
> Task :publishToMavenLocal UP-TO-DATE
BUILD SUCCESSFUL in 0s
When you configure a publication as in this example …
task buildMyArtifact(type: Zip) {
// TODO using the build script as a sample file here; use whatever makes
// sense for your project
from 'build.gradle'
archiveBaseName = 'whateverNameInBuildDir'
destinationDirectory = buildDir
}
publishing {
publications {
myPublication(MavenPublication) {
artifact buildMyArtifact
groupId 'com.example'
artifactId 'my-module'
version '1.0.0'
}
}
}
… then the publishToMavenLocal task installs the publication into the local Maven repository:
$ ./gradlew --console=verbose publishToMavenLocal
> Task :buildMyArtifact
> Task :generatePomFileForMyPublicationPublication
> Task :publishMyPublicationPublicationToMavenLocal
> Task :publishToMavenLocal
BUILD SUCCESSFUL in 1s
3 actionable tasks: 3 executed
$ tree ~/.m2/repository/com/example/my-module/
/home/chriki/.m2/repository/com/example/my-module/
├── 1.0.0
│   ├── my-module-1.0.0.pom
│   └── my-module-1.0.0.zip
└── maven-metadata-local.xml
1 directory, 3 files

Related

generateLexer/generateParser gradle tasks problem in intellij idea plugin build

I try to extend some old IntelliJ plug-in
And there is my build.gradle
buildscript {
ext.kotlin_version = '1.6.0'
repositories {
mavenCentral()
maven { url 'https://jitpack.io'}
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url 'https://dl.bintray.com/jetbrains/intellij-plugin-service'
}
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id "org.jetbrains.intellij" version "0.5.0"
id "org.jetbrains.grammarkit" version "2022.3"
}
group 'com.interfaced'
version '0.2.7'
apply plugin: 'kotlin'
apply plugin: 'org.jetbrains.intellij'
sourceSets {
all {
java.srcDirs += ['src/main/gen']
kotlin.srcDirs += ['src/main/kotlin']
resources.srcDirs = ['src/main/resources']
}
}
grammarKit {
jflexRelease = '1.7.0-2'
}
repositories {
mavenCentral()
maven {
url "https://packages.jetbrains.team/maven/p/ij/intellij-dependencies/"
}
}
dependencies {
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: '1.7.22'
implementation group: 'junit', name: 'junit', version: '4.12'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
}
intellij {
pluginName 'BrightScript'
version '2022.3'
}
patchPluginXml {
changeNotes """
<ul>
<li>Support for 2020.2</li>
</ul>
"""
}
import org.jetbrains.grammarkit.tasks.*
def GENERATE_GROUP = 'Generate'
task generateLexer(type: GenerateLexer) {
source = "src/main/grammar/BrightScript.flex"
targetDir = "src/main/gen/com/interfaced/brs/lang/lexer"
targetClass = "_BrsLexer"
skeleton = "src/main/grammar/idea-flex.skeleton"
purgeOldFiles = true
description = 'Generate Lexer Java sources for BrightScript'
group = GENERATE_GROUP
}
task generateParser(type: GenerateParser) {
source = "src/main/grammar/BrightScript.bnf"
targetRoot = 'src/main/gen'
pathToParser = 'src/main/gen/com/interfaced/brs/lang/BrsParser.java'
pathToPsiRoot = 'src/main/gen/com/interfaced/brs/lang/psi'
purgeOldFiles = true
description = 'Generate Parser Java sources for BrightScript'
group = GENERATE_GROUP
// patch up to date check
outputs.upToDateWhen { false }
}
compileKotlin {
kotlinOptions.jvmTarget = "17"
}
compileKotlin.dependsOn(generateLexer, generateParser)
When I try to run it have the following output
org.gradle.api.GradleScriptException: A problem occurred evaluating
root project 'brs-plugin'. at ... Caused by:
groovy.lang.MissingPropertyException: Could not get unknown property
'GenerateLexer' for root project 'brs-plugin' of type
org.gradle.api.Project.
But when I try to change my buildLexer/buildParser tasks as following
generateLexer {
source = "src/main/grammar/BrightScript.flex"
targetDir = "src/main/gen/com/interfaced/brs/lang/lexer"
targetClass = "_BrsLexer"
skeleton = "src/main/grammar/idea-flex.skeleton"
purgeOldFiles = true
description = 'Generate Lexer Java sources for BrightScript'
group = GENERATE_GROUP
}
generateParser {
source = "src/main/grammar/BrightScript.bnf"
targetRoot = 'src/main/gen'
pathToParser = 'src/main/gen/com/interfaced/brs/lang/BrsParser.java'
pathToPsiRoot = 'src/main/gen/com/interfaced/brs/lang/psi'
purgeOldFiles = true
description = 'Generate Parser Java sources for BrightScript'
group = GENERATE_GROUP
// patch up to date check
outputs.upToDateWhen { false }
}
have another one problem
A problem occurred evaluating root project 'brs-plugin'. ... Caused
by: java.lang.IllegalArgumentException: Cannot set the value of task
':generateLexer' property 'skeleton' of type
org.gradle.api.file.RegularFile
How to fix my problem?
Regards

Problem with import and using SwingFXUtils in gradle project

I'm very new to gradle and javaFx.
I'm working on a gradle project (not mine) and I need to import SwingFXUtils to make some operations.
Importing it into the java file:
import javafx.embed.swing.SwingFXUtils;
cause the error: "Cannot resolve symbold SwingFXUtils".
I tried to add it to java-modules.java file
requires javafx.embed.swing;
but it is not recognized and I'm having the error message: "Module not found:javafx.embed.swing"
then, I updated my build.gradle for the missing module: like this:
plugins {
id 'application'
id 'org.beryx.jlink' version '2.19.0'
id 'com.google.osdetector' version '1.6.2'
}
repositories {
flatDir {
dirs "libs"
}
jcenter()
maven { url "https://maven.geotoolkit.org/" }
mavenCentral()
}
ext {
toolName = 'my project'
toolVersion = '1.0.0'
mainModuleName = 'com.myproject'
mainClassName = 'com.myproject.DcTool'
jfxVersion = '14.0.1'
pdfboxVersion = '2.0.27'
platform = osdetector.os == 'osx'?'mac':osdetector.os =='windows'?'win':osdetector.os
fixWayland = platform == 'mac' ? '' : platform == 'win' ? '' : '-Djdk.gtk.version=2'
}
version = "$toolVersion"
// Project dependencies.
dependencies {
compileOnly "org.jetbrains:annotations:19.0.0"
implementation "org.openjfx:javafx-base:$jfxVersion:$platform"
implementation "org.openjfx:javafx-graphics:$jfxVersion:$platform"
implementation "org.openjfx:javafx-controls:$jfxVersion:$platform"
implementation "org.openjfx:javafx-fxml:$jfxVersion:$platform"
implementation "com.fazecast:jSerialComm:2.6.2"
implementation "ch.qos.logback:logback-classic:1.3.0-alpha4"
implementation "de.skuzzle:semantic-version:2.1.0"
implementation "info.picocli:picocli:4.3.2"
annotationProcessor "info.picocli:picocli-codegen:4.3.2"
implementation "org.apache.pdfbox:pdfbox:${pdfboxVersion}"
implementation "org.apache.pdfbox:preflight:${pdfboxVersion}"
implementation "com.fasterxml.jackson.jr:jackson-jr-objects:2.11.0"
implementation group: 'org.openjfx', name: 'javafx-swing', version: '11-ea+24'
}
java {
modularity.inferModulePath = true
}
application {
mainModule.set("$mainModuleName")
mainClass.set("$mainClassName")
applicationDefaultJvmArgs = [
"-Dfile.encoding=UTF-8",
]
}
tasks.withType(JavaCompile) {
doFirst {
options.compilerArgs = [
'--module-path', classpath.asPath
]
classpath = files()
}
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_14
options.encoding = "UTF-8"
options.javaModuleVersion.set("$toolVersion")
options.javaModuleMainClass.set("$mainClassName")
}
run {
doFirst {
jvmArgs = [
"--module-path", classpath.asPath,
'--patch-module', "$mainModuleName=" + files(sourceSets.main.output.resourcesDir).asPath,
"--module", "$mainModuleName/$mainClassName"
]
jvmArgs += application.applicationDefaultJvmArgs
classpath = files()
}
doLast {
args = []
}
}
jar {
manifest {
attributes(
'Main-Class': "$mainClassName"
)
}
}
JAVA_HOME=$(/usr/libexec/java_home)
jlink {
moduleName.set("$mainModuleName")
mainClass.set("$mainClassName")
addOptions(
'--bind-services',
'--no-header-files',
'--no-man-pages',
'--strip-debug',
'--compress', '2')
launcher {
name = "$toolName"
jvmArgs += application.applicationDefaultJvmArgs
}
}
I also tried to download jars of SwingFx and add them in a "libs" folder into the project but I have no result and compiler doesn't find modules I need.
What can I do to make it find this module?
Thank you for your help.

Running into Gradle build failure in intellj; it's asking for update 5.0+

Error Message:
Error:(52, 0) This version of Shadow supports Gradle 5.0+ only. Please upgrade.
Open File
build.gradle file(line 52 - apply plugin: "com.github.johnrengelman.shadow)
How can I fix this issue since I'm new to Gradle and learning?
allprojects {
apply plugin: 'idea'
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url 'http://packages.confluent.io/maven/' }
}
}
project.ext {
apacheHttpClientVersion = "4.5.6"
commonsCliVersion = '1.4'
h2Version = '1.3.175'
hamcrestVersion = '1.3'
junitVersion = '4.11'
mariadbDriverVersion = '2.4.2'
nettyVersion = '4.1.15.Final'
slf4jVersion = '1.7.25'
mockitoVersion = '1.9.5'
assertjVersion = '3.8.0'
zkToolsVersion = '0.5.0'
yamlVersion = '1.20'
riffVersion = '2.4.2'
jacksonVersion = '2.9.6'
jettyVersion = '9.4.12.v20180830'
mainClass = 'Main'
}
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.1.1'
classpath "com.github.jengelman.gradle.plugins:shadow:5.1.0"
classpath 'se.transmode.gradle:gradle-docker:1.2'
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'findbugs'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: 'maven-publish'
apply plugin: 'signing'
configurations.all {
resolutionStrategy {
force "org.hamcrest:hamcrest-all:$hamcrestVersion"
}
}
jar {
manifest {
attributes(
"Implementation-Title": "Waltz",
"Implementation-Version": version)
}
}
compileJava {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
compileTestJava {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
checkstyle {
toolVersion = "8.10"
}
checkstyleTest {
configFile = project.file ("${rootProject.projectDir}/config/checkstyle/checkstyle_test.xml")
}
// findbugs html only report
findbugsMain {
reports {
xml.enabled = false
html.enabled = true
}
}
findbugsTest {
reports {
xml.enabled = false
html.enabled = true
}
}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
}
task javadocJar(type: Jar) {
from javadoc
archiveClassifier = 'javadoc'
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = project.name
from components.java
artifact sourcesJar
artifact javadocJar
pom {
name = 'Waltz'
description = 'Waltz is a distributed/replicated write ahead log for transactions.'
url = 'https://www.github.com/wepay/waltz'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'ymatsuda'
name = 'Yasuhiro Matsuda'
}
}
scm {
connection = 'scm:git:git://github.com/wepay/waltz.git'
developerConnection = 'scm:git:ssh://github.com/wepay/waltz.git'
url = 'https://github.com/wepay/waltz'
}
}
}
}
repositories {
maven {
def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots'
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username findProperty('ossrhUsername')?: ''
password findProperty('ossrhPassword')?: ''
}
}
}
}
signing {
sign publishing.publications.mavenJava
}
task execute(type:JavaExec) {
main = mainClass
classpath = sourceSets.main.runtimeClasspath
if (project.hasProperty("commandArgs")) {
args commandArgs.split()
}
standardInput = System.in
}
}
project(':waltz-tools') {
dependencies {
compile (
project(':waltz-client'),
project(':waltz-server'),
project(':waltz-storage'),
"org.apache.httpcomponents:fluent-hc:$apacheHttpClientVersion"
)
testCompile (
// TODO remove cyclic dependency
// Not super thrilled about this, as it creates a circular dependency between
// watlz-util and waltz-test. waltz-tools needs ZK server runner for tests, and
// waltz-test needs to be able to create clusters to run smoke test and demo.
project(':waltz-test'),
"junit:junit:$junitVersion",
"org.mockito:mockito-all:$mockitoVersion"
)
}
task copyLibs(type:Copy) {
into file("$projectDir/build/libs")
from sourceSets.main.runtimeClasspath
}
}
project(':waltz-server') {
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'application'
apply plugin: 'docker'
dependencies {
compile (
project(':waltz-common'),
project(':waltz-storage'),
"com.fasterxml.jackson.core:jackson-databind:$jacksonVersion",
"com.wepay.riff:riff-config:$riffVersion",
"com.wepay.riff:riff-metrics:$riffVersion",
"com.wepay.zktools:zktools:$zkToolsVersion",
"io.netty:netty-all:$nettyVersion",
"org.slf4j:slf4j-api:$slf4jVersion",
"org.eclipse.jetty:jetty-server:$jettyVersion",
"org.eclipse.jetty:jetty-servlet:$jettyVersion",
)
testCompile (
project(':waltz-client'),
project(':waltz-test'),
"junit:junit:$junitVersion",
"org.mockito:mockito-all:$mockitoVersion"
)
}
test {
maxHeapSize = "2G"
jvmArgs '-Xmx2G'
}
distDocker {
mainClassName = 'com.wepay.waltz.server.WaltzServer'
workingDir "${rootProject.name}-${project.version}"
}
}
project(':waltz-storage') {
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'application'
apply plugin: 'docker'
dependencies {
compile (
project(':waltz-common'),
"com.fasterxml.jackson.core:jackson-databind:$jacksonVersion",
"com.wepay.riff:riff-config:$riffVersion",
"com.wepay.riff:riff-metrics:$riffVersion",
"com.wepay.zktools:zktools:$zkToolsVersion",
"io.netty:netty-all:$nettyVersion",
"org.slf4j:slf4j-api:$slf4jVersion",
"org.yaml:snakeyaml:$yamlVersion",
"org.eclipse.jetty:jetty-server:$jettyVersion",
"org.eclipse.jetty:jetty-servlet:$jettyVersion",
)
testCompile (
project(':waltz-test'),
"junit:junit:$junitVersion",
"org.mockito:mockito-all:$mockitoVersion"
)
}
distDocker {
mainClassName = 'com.wepay.waltz.storage.WaltzStorage'
workingDir "${rootProject.name}-${project.version}"
runCommand 'mkdir /waltz_storage'
}
}
project(':waltz-uber') {
dependencies {
compile(
project(':waltz-server'),
project(':waltz-tools')
)
testCompile (
project(':waltz-server')
)
runtime (
"org.slf4j:slf4j-log4j12:$slf4jVersion"
)
}
shadowJar {
baseName = project.name
classifier = null
version = version
}
}
project(':waltz-uber').build.dependsOn project(':waltz-uber').shadowJar
project(':waltz-uber').artifactoryPublish.dependsOn project(':waltz-uber').shadowJar
project(':waltz-client') {
dependencies {
compile (
project(':waltz-common'),
"com.wepay.riff:riff-config:$riffVersion",
"com.wepay.zktools:zktools:$zkToolsVersion",
"io.netty:netty-all:$nettyVersion",
"org.slf4j:slf4j-api:$slf4jVersion"
)
testCompile (
project(':waltz-test'),
"com.h2database:h2:$h2Version",
"junit:junit:$junitVersion"
)
}
}
project(':waltz-common') {
dependencies {
compile (
"com.wepay.riff:riff-config:$riffVersion",
"com.wepay.riff:riff-metrics:$riffVersion",
"com.wepay.riff:riff-networking:$riffVersion",
"com.wepay.zktools:zktools:$zkToolsVersion",
"commons-cli:commons-cli:$commonsCliVersion",
"io.netty:netty-all:$nettyVersion",
"org.slf4j:slf4j-api:$slf4jVersion",
"org.yaml:snakeyaml:$yamlVersion"
)
testCompile (
project(':waltz-test'),
"junit:junit:$junitVersion",
"org.assertj:assertj-core:$assertjVersion",
"org.mockito:mockito-all:$mockitoVersion"
)
}
}
project(':waltz-test') {
dependencies {
compile (
project(':waltz-server'),
project(':waltz-client'),
project(':waltz-storage'),
project(':waltz-tools'),
"com.wepay.zktools:zktools:$zkToolsVersion",
"io.netty:netty-all:$nettyVersion"
)
testCompile (
"junit:junit:$junitVersion"
)
}
task copyLibs(type:Copy) {
into file("$projectDir/build/libs")
from sourceSets.main.runtimeClasspath
}
}
project(':waltz-demo') {
dependencies {
compile (
project(':waltz-server'),
project(':waltz-client'),
project(':waltz-test'),
project(':waltz-tools'),
"org.mariadb.jdbc:mariadb-java-client:$mariadbDriverVersion"
)
testCompile (
"com.h2database:h2:$h2Version",
"junit:junit:$junitVersion"
)
}
shadowJar {
baseName = project.name
classifier = null
version = version
}
}
project(':waltz-demo').build.dependsOn project(':waltz-demo').shadowJar
project(':waltz-demo').artifactoryPublish.dependsOn project(':waltz-demo').shadowJar
Either upgrade your local installation of Gradle by installing a new version. Or upgrade the Gradle wrapper: https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:upgrading_wrapper
The shadow plugin you're using requires a newer gradle version. You either remove the plugin or update as francisco above suggested

Gradle publishToMavenLocal not copying jars to local Maven repository

Here's my complete build.gradle
buildscript {
ext.kotlinVersion = '1.3.10'
ext.dokkaVersion = '0.9.17'
repositories { mavenLocal() }
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion"
}
}
plugins {
id 'com.github.hierynomus.license' version '0.15.0'
id 'io.codearte.nexus-staging' version '0.11.0'
id 'maven-publish'
}
group = 'org.jetbrains.xodus'
version = hasProperty('xodusVersion') ? project.xodusVersion : ''
def isSnapshot = version.endsWith('SNAPSHOT')
def isDailyBuild = hasProperty('dailyBuild') ? project.dailyBuild : false
def mavenPublishUrl = hasProperty('mavenPublishUrl') ? project.mavenPublishUrl : ''
def mavenPublishUsername = hasProperty('mavenPublishUsername') ? project.mavenPublishUsername : ''
def mavenPublishPassword = hasProperty('mavenPublishPassword') ? project.mavenPublishPassword : ''
def signingKeyId = hasProperty('signingKeyId') ? project.signingKeyId : ''
def signingPassword = hasProperty('signingPassword') ? project.signingPassword : ''
def signingSecretKeyRingFile = hasProperty('signingSecretKeyRingFile') ? project.signingSecretKeyRingFile : '../key.gpg'
static def shouldDeploy(project) {
return project.version.length() > 0 && !(project.name in ['benchmarks', 'samples'])
}
task wrapper(type: Wrapper) {
gradleVersion = '3.5.1'
}
defaultTasks 'assemble'
// Use nexus-staging-plugin to workaround https://issues.sonatype.org/browse/OSSRH-5454
nexusStaging {
username = mavenPublishUsername
password = mavenPublishPassword
delayBetweenRetriesInMillis = 30000
stagingProfileId = "89ee7caa6631c4"
}
subprojects {
apply plugin: 'license'
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'org.jetbrains.dokka'
sourceCompatibility = 1.7
compileJava.options.encoding = 'UTF-8'
group = rootProject.group
version = rootProject.version
archivesBaseName = rootProject.name + '-' + project.name
license {
header rootProject.file('license/copyright.ftl')
strictCheck true
ext.inceptionYear = 2010
ext.year = Calendar.getInstance().get(Calendar.YEAR)
ext.owner = 'JetBrains s.r.o.'
include "**/*.kt"
include "**/*.java"
mapping {
kt = 'JAVADOC_STYLE'
}
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25'
}
// tests for most of sub-projects run with database encryption turned on
if (!(project.name in ['benchmarks', 'compress', 'crypto', 'openAPI', 'samples', 'utils'])) {
test {
systemProperty 'exodus.cipherId', 'jetbrains.exodus.crypto.streamciphers.ChaChaStreamCipherProvider'
systemProperty 'exodus.cipherKey', '000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f'
systemProperty 'exodus.cipherBasicIV', '314159262718281828'
// uncomment the following line to run tests in-memory
//systemProperty 'exodus.log.readerWriterProvider', 'jetbrains.exodus.io.inMemory.MemoryDataReaderWriterProvider'
}
dependencies {
testCompile project(':crypto')
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
jar {
manifest {
attributes 'Implementation-Title': archivesBaseName, 'Implementation-Version': version
}
}
test {
minHeapSize = '1g'
maxHeapSize = '1g'
//jvmArgs = ['-ea', '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=2808']
//testLogging.showStandardStreams = true
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
duplicatesStrategy 'exclude'
includeEmptyDirs false
from javadoc.destinationDir
}
javadoc.failOnError = false
// work around for Java 8 javadoc which is too strict
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
task sourceJar(type: Jar) {
classifier = 'sources'
duplicatesStrategy 'exclude'
includeEmptyDirs false
from project.sourceSets.main.java
from project.sourceSets.main.kotlin
}
// configuring projects with Kotlin sources
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
compile 'io.github.microutils:kotlin-logging:1.5.4'
}
compileKotlin {
kotlinOptions {
languageVersion = '1.2'
apiVersion = '1.2'
}
}
compileTestKotlin {
kotlinOptions {
languageVersion = '1.2'
apiVersion = '1.2'
}
}
dokka {
jdkVersion = 7
packageOptions {
reportUndocumented = false
}
}
task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
outputFormat = 'javadoc'
outputDirectory = "$buildDir/javadoc"
}
javadocJar {
dependsOn dokkaJavadoc
from dokkaJavadoc.outputDirectory
}
artifacts {
archives jar, javadocJar, sourceJar
}
if (!isSnapshot && signingKeyId.length() > 0) {
ext.'signing.keyId' = signingKeyId
ext.'signing.password' = signingPassword
ext.'signing.secretKeyRingFile' = signingSecretKeyRingFile
}
afterEvaluate { project ->
if (shouldDeploy(project)) {
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
if (isDailyBuild) {
repository(url: "https://api.bintray.com/maven/jetbrains/xodus/" + archivesBaseName + "/;publish=1") {
authentication(userName: mavenPublishUsername, password: mavenPublishPassword)
}
} else {
repository(url: mavenPublishUrl) {
authentication(userName: mavenPublishUsername, password: mavenPublishPassword)
}
}
pom.project {
name 'Xodus'
description 'Xodus is pure Java transactional schema-less embedded database'
packaging 'jar'
url 'https://github.com/JetBrains/xodus'
scm {
url 'https://github.com/JetBrains/xodus'
connection 'scm:git:https://github.com/JetBrains/xodus.git'
developerConnection 'scm:git:https://github.com/JetBrains/xodus.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/license/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'JetBrains'
name 'JetBrains Team'
organization 'JetBrains s.r.o'
organizationUrl 'http://www.jetbrains.com'
}
}
}
}
}
}
signing {
required { !isSnapshot && signingKeyId.length() > 0 && gradle.taskGraph.hasTask('uploadArchives') }
sign configurations.archives
}
}
}
}
What could be missing in the configuration/setting that is preventing the jars to be copied to the local Maven folder?
The build uses the maven plugin; you should use gradlew install to publish to the local repo. See the gradle.maven.plugin docs.
I tried building the xodus project from github- installing breaks on a "samples" project, probably because no jar is created from it. Anyway that module doesn't need to be installed (it only contains example code). So you can use gradlew clean install -x :samples:install

How to debug Kolin Vertx web app in IDE Intellij?

I have created a Kotlin Vertx web app which runs with Gradle. But When I try to debug it by running Intellij debug configuration, the breakpoints aren't hitting. How can I make those breakpoints work ?
buildscript {
ext {
kotlinVersion = '1.2.60'
}
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '2.0.4'
id 'org.jetbrains.kotlin.jvm' version '1.3.11'
id 'jacoco'
id 'de.jansauer.printcoverage' version '2.0.0'}
jacoco{
toolVersion = '0.8.2'
}
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.1
}
}
}
}
jacocoTestReport {
reports {
csv.enabled true
xml.enabled true
html {
enabled true
destination file("$buildDir/reports/jacoco")
}
}
executionData(test)
}
tasks.build.dependsOn(jacocoTestReport)
printcoverage {
coverageType = 'INSTRUCTION'
}
apply plugin: 'kotlin'
ext {
kotlinVersion = '1.2.60'
vertxVersion = '3.6.2'
junitJupiterEngineVersion = '5.2.0'
}
repositories {
mavenLocal()
jcenter()
}
group 'com.joyfulyell'
version '1.0-SNAPSHOT'
sourceCompatibility = '1.8'
mainClassName = 'io.vertx.core.Launcher'
def mainVerticleName = 'io.vertx.starter.MainVerticle'
def watchForChange = 'src/**/*'
def doOnChange = './gradlew classes'
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
compile "io.vertx:vertx-core:$vertxVersion"
compile "io.vertx:vertx-web:$vertxVersion"
compile "io.vertx:vertx-lang-kotlin:$vertxVersion"
compile "io.vertx:vertx-mongo-client:$vertxVersion"
implementation 'org.kodein.di:kodein-di-generic-jvm:6.0.1'
compile "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.+"
compile 'com.beust:klaxon:5.0.3'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.0'
testImplementation "io.vertx:vertx-junit5:$vertxVersion"
testRuntime("org.junit.jupiter:junit-jupiter-engine:$junitJupiterEngineVersion")
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
}
}
shadowJar {
classifier = 'fat'
manifest {
attributes 'Main-Verticle': mainVerticleName
}
mergeServiceFiles {
include 'META-INF/services/io.vertx.core.spi.VerticleFactory'
}
}
test {
useJUnitPlatform()
testLogging {
events 'PASSED', 'FAILED', 'SKIPPED'
}
reports {
junitXml.enabled = true
html.enabled = true
}
jacoco{
append = false
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
classDumpDir = file("$buildDir/jacoco/classpathdumps")
}
}
run {
args = ['run', mainVerticleName,
"--redeploy=$watchForChange",
"--launcher-class=$mainClassName",
"--on-redeploy=$doOnChange"
]
}
task wrapper(type: Wrapper) {
gradleVersion = '5.0'
}
You should be able to run debug just fine by configuring Gradle as follows:
And hitting the Debug button. Tested it using your configuration.
Just make sure that you specify the correct verticle name in your build.gradle:
def mainVerticleName = 'io.vertx.starter.MainVerticle'

Resources