Could not create task ':GluonApplicationApp:debug' - gradle

I am trying to run simply the Gluon single scene example. Here is my gradle output:
Configuration on demand is an incubating feature.
> Configure project :GluonApplicationApp
Project :GluonApplicationApp => no module-info.java found
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':GluonApplicationApp'.
> Could not create task ':GluonApplicationApp:debug'.
> Unnecessarily replacing a task that does not exist is not supported. Use create() or register() directly instead. You attempted to replace a task named 'debug', but there is no existing task with that name.
* 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
My build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.17'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'com.gluonapplication.GluonApplication'
dependencies {
compile 'com.gluonhq:charm:5.0.2'
}
jfxmobile {
downConfig {
version = '3.8.6'
// Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
plugins 'display', 'lifecycle', 'statusbar', 'storage'
}
android {
manifest = 'src/android/AndroidManifest.xml'
}
}
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'org.openjfx:javafx-plugin:0.0.9'
}
}
apply plugin: 'org.openjfx.javafxplugin'
The JDK version i'm using is JDK 11, and I have tried various gradle versions. For my IDE I use netbeans.
I have been trying to fix this all day. Please help

I was using the old Gluon IDE plugin
Gluon build 0.1.29-SNAPSHOT fixes the rest of the problems
More details on comments of the question!

Related

What exactly is "The plugins {} block must not be used here. If you need to apply a plugin imperatively"?

I have a gradle project that uses kotlin dsl:
plugins {
base
kotlin("jvm") version "1.3.70" apply false
}
//val scalaV: String by project
//val ext = SpikeExt(this)
allprojects {
apply(plugin = "java")
apply(plugin = "scala")
group = "com.tribbloids.scalaspike"
version = "1.0.0-SNAPSHOT"
repositories {
mavenCentral()
jcenter()
maven("https://dl.bintray.com/kotlin/kotlin-dev")
}
dependencies {
}
}
when I run gradlew build I encounter the following error:
FAILURE: Build failed with an exception.
* Where:
Script '/home/peng/git/scalaspike/build.gradle.kts' line: 1
* What went wrong:
The plugins {} block must not be used here. If you need to apply a plugin imperatively, please use apply<PluginType>() or apply(plugin = "id") instead.
* 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
BUILD FAILED in 870ms
In the mean time, the exact identical line 1 works normal in the other project:
https://github.com/gradle/kotlin-dsl-samples/tree/master/samples/multi-kotlin-project
plugins {
base
kotlin("jvm") version "1.3.70" apply false
}
allprojects {
group = "org.gradle.kotlin.dsl.samples.multiproject"
version = "1.0"
repositories {
jcenter()
}
}
dependencies {
// Make the root project archives configuration depend on every sub-project
subprojects.forEach {
archives(it)
}
}
So I have 2 questions:
what does this mean?
why the same thing works in the second project but fails on the first project? What is the difference?

How can I disable cache-redirector of `org.jetbrains.intellij` for some dependencies?

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()
}

JavaxPorts jfxmobile-plugin: Failure if classes more than 65535

When I do a
gradle android
with the jfxmobile-plugin on my JavaFX-application I get
...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':mergeClassesIntoJar'.
> archive contains more than 65535 entries.
To build this archive, please enable the zip64 extension.
See: https://docs.gradle.org/3.2.1/dsl/org.gradle.api.tasks.bundling.Zip.html#org.gradle.api.tasks.bundling.Zip:zip64
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
The gradle file looks like this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.2'
}
}
apply plugin: 'org.javafxports.jfxmobile'
mainClassName = 'de.package.of.application.ClientApp'
dependencies {
compile 'com.annimon:stream:1.0.1'
compile 'com.jakewharton.threetenabp:threetenabp:1.0.4'
compile 'com.gluonhq:charm:3.0.0'
androidRuntime 'com.gluonhq:charm-android:3.0.0'
iosRuntime 'com.gluonhq:charm-ios:3.0.0'
desktopRuntime 'com.gluonhq:charm-desktop:3.0.0'
compile fileTree(dir: 'target/dependencies', include: '*.jar')
runtime fileTree(dir: 'target/dependencies', include: '*.jar')
}
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
jfxmobile {
ios {
forceLinkClasses = ['ensemble.**.*']
}
android {
applicationPackage = 'org.javafxports.ensemble'
compileSdkVersion = '21'
androidSdk='C:/Tools/android-sdk-windows'
}
}
Over the last years since Javafx exists the application has become, I would say, a 'bigger' one; a fat-client with many own classes but also many third-party dependencies.
I found an article about the jfxmobile-plugin and thought 'Why not give it a try?'. The current issue is the one described in this question.
I already stripped down the application to reduce classes to a minimum so the application still makes some sense in some way but it does not help.
Does anyone have a suggestions how to solve it?

Trouble getting started with SpringBoot and Gradle

I am a new to Java, Gradle and Spring.
I setup a new project with the following gradle script:
buildscript {
repositories {
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.0.BUILD-SNAPSHOT")
}
}
apply plugin: 'java'
apply plugin: 'spring-boot'
repositories {
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("org.springframework.boot:spring-boot-starter-test")
}
When trying to build with the above script, I get the following errors:
E:\Projects\SpringAppTutorial>gradlew
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'SpringAppTutorial'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:1.3.0.BUILD-SNAPSHOT.
Required by:
:SpringAppTutorial:unspecified
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:1.3.0.BUILD-SNAPSHOT.
> Could not parse POM http://repo.spring.io/snapshot/org/springframework/boot/spring-boot-gradle-plugin/1.3.0.BUILD-SNAPSHOT/spring-boot-gradle-plugin-1.3.0.BUILD-20150531.081700-179.pom
> Could not resolve org.springframework.boot:spring-boot-tools:1.3.0.BUILD-SNAPSHOT.
> Could not resolve org.springframework.boot:spring-boot-tools:1.3.0.BUILD-SNAPSHOT.
> Could not parse POM http://repo.spring.io/snapshot/org/springframework/boot/spring-boot-tools/1.3.0.BUILD-SNAPSHOT/spring-boot-tools-1.3.0.BUILD-20150531.081700-180.pom
> Could not resolve org.springframework.boot:spring-boot-parent:1.3.0.BUILD-SNAPSHOT.
> Could not resolve org.springframework.boot:spring-boot-parent:1.3.0.BUILD-SNAPSHOT.
> Could not parse POM http://repo.spring.io/snapshot/org/springframework/boot/spring-boot-parent/1.3.0.BUILD-SNAPSHOT/spring-boot-parent-1.3.0.BUILD-20150531.081700-180.pom
> Could not resolve org.springframework.boot:spring-boot-dependencies:1.3.0.BUILD-SNAPSHOT.
> Could not resolve org.springframework.boot:spring-boot-dependencies:1.3.0.BUILD-SNAPSHOT.
> Could not parse POM http://repo.spring.io/snapshot/org/springframework/boot/spring-boot-dependencies/1.3.0.BUILD-SNAPSHOT/spring-boot-dependencies-1.3.0.BUILD-20150531.081700-181.pom
> Could not find org.springframework.data:spring-data-releasetrain:Fowler-RELEASE.
Searched in the following locations:
http://repo.spring.io/snapshot/org/springframework/data/spring-data-releasetrain/Fowler-RELEASE/spring-data-releasetrain-Fowler-RELEASE.pom
http://repo.spring.io/snapshot/org/springframework/data/spring-data-releasetrain/Fowler-RELEASE/spring-data-releasetrain-Fowler-RELEASE.jar
http://repo.spring.io/milestone/org/springframework/data/spring-data-releasetrain/Fowler-RELEASE/spring-data-releasetrain-Fowler-RELEASE.pom
http://repo.spring.io/milestone/org/springframework/data/spring-data-releasetrain/Fowler-RELEASE/spring-data-releasetrain-Fowler-RELEASE.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 15.726 secs
E:\Projects\SpringAppTutorial>
What am I doing wrong here?
You should be using a release version of the spring-boot gradle plugin - your script is using a development snapshot version string of some kind.
i.e. try
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.3.RELEASE")
}
(from http://docs.spring.io/spring-boot/docs/current/reference/html/build-tool-plugins-gradle-plugin.html)
Assuming that works, you should be able to get rid of this section also:
repositories {
maven { url "http://repo.spring.io/snapshot" }
maven { url "http://repo.spring.io/milestone" }
}
I have faced the same problem and as #skaffman suggests, I added version to my dependencies, it resolved.
implementation('org.springframework.session:spring-session:1.3.4.RELEASE')
runtimeOnly('com.okta.spring:okta-spring-boot-starter:0.6.1')
runtimeOnly('org.springframework.security.oauth:spring-security-oauth2:2.3.4.RELEASE')

custom gradle plugin causes: Cannot configure the 'publishing' extension

I have a custom gradle plugin in which custom task types and gradle configurations are added. When I apply this plugin before maven-publish it works perfectly fine. But when I add it after apply plugin: 'maven-publish', it fails with error message :
FAILURE: Build failed with an exception.
* Where:
Build file '/scratch/skgupta/git_storage/emdi/integtest/build.gradle' line: 38
* What went wrong:
A problem occurred evaluating root project 'integtest'.
> Cannot configure the 'publishing' extension after it has been accessed.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 7.6 secs
Here is the build.gradle file.
buildscript {
repositories {
maven {
url = "${artifactory_contextUrl}/repo"
}
}
dependencies {
classpath group: 'com.mycomp.proj', name: 'MyCustomPlugin', version: "${pluginVersion}", transitive: true
}
}
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'MyCustomPlugin' // WHen this line is moved above maven-publish, build works fine.
// add jar name and version
jar.archiveName='lrgemaas_small_deploy_3n.jar'
group = 'com.mycom.proj.test'
version = '1.0.3'
dependencies {
compile group: 'eaas.platform', name: 'registry-lookup-client', version: '0.1'
compile group: 'eaas.platform', name: 'registry-client', version: '0.1'
compile configurations.lrgConfig // This configuration is added by MyCustomPlugin
compile configurations.webdriver // This configuration is added by MyCustomPlugin
}
repositories {
maven {
url = "${artifactory_contextUrl}/repo"
}
}
publishing {
publications {
myPublicationName(MavenPublication) {
artifactId 'lrgemaas_small_deploy_3n'
artifact jar.archivePath
}
}
repositories {
maven {
url = "${artifactory_contextUrl}/${artifactory_repoName}"
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
}
}
// workflow for build
defaultTasks 'clean','build','publish'
PS: I tried doing nothing in the custom plugin (i.e., simply return from apply method), but it still gives same error.
Simply replacing:
publishing {
publications {
...
}
}
with following:
publishing.publications {
...
}
worked for me!
Gradle is brittle regarding the order of the plugins. There is a discussion about this exact issue at
https://discuss.gradle.org/t/apply-maven-publish-plugin-from-init-script/2460
"Cool, so this is what happens.
DefaultPublishingExtension which is backing the 'publishing {}' block is a DeferredConfigurable. It's a mechanism that allows to register a configuration block to be executed when an extension is accessed. Unfortunately sometimes it causes unexpected behaviour if you access this kind of extension unawares. This is exactly the case when for example you try to get all the properties of a project (as the release plugin does here: https://github.com/townsfolk/gradle-release/blob/master/src/main/groovy/release/PluginHelper.groovy#L230"
FYI, I use a dynamic version and found that I had to define version prior to apply of my plugins. Probably because java or maven-publish sets the publication details upon application.
I upgraded gradle version from 2.1 to 2.12 and it solved this problem, fwiw.

Resources