Gradle 6.1 isn't finding the com.moowork.gulp plugin - gradle

Upgrading from Gradle 4.0 to 6.1, the com.moowork.glup plugin seems to have vanished. Yet, the https://plugins.gradle.org/plugin/com.moowork.gulp page show that the plugin does exist. The sample code works with the com.moowork.gulp line commented out.
plugins {
id 'java'
id 'maven'
id "com.moowork.gulp" version "1.3.0"
id "nebula.ospackage" version "8.0.3"
}
task testAgain {
println 'Configuration stage'
doLast {
println 'Execution stage'
}
}
Once the offending line is uncommented, the Gradle example fails.
$ ./gradlew -q testAgain
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'example'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find com.moowork.gradle:gradle-node-plugin:1.3.0.
Searched in the following locations:
- https://plugins.gradle.org/m2/com/moowork/gradle/gradle-node-plugin/1.3.0/gradle-node-plugin-1.3.0.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project : > com.moowork.gulp:com.moowork.gulp.gradle.plugin:1.3.0
[...]
BUILD FAILED in 1s
What am I missing?

Related

Gradle: Invalid publication 'maven': artifact file does not exist

Java 11 and Gradle 7.2 here. I am trying to build a reusable library that I can (eventually) publish to a Maven repository and pull into other projects. But first I just want to get it publishing to my local m2 repo.
The project directory structure looks like:
mylib/
lib/
src/
build.gradle
Where build.gradle is:
plugins {
id 'java-library'
id 'maven-publish'
id 'io.freefair.lombok' version "6.5.0-rc1"
}
sourceCompatibility = 1.11
targetCompatibility = 1.11
archivesBaseName = 'mylib'
version = '1.0.0-RC1'
group = 'org.example'
repositories {
mavenCentral()
}
dependencies {
// omitted for brevity
)
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
}
publishing {
publications {
maven(MavenPublication) {
artifact("build/libs/${archivesBaseName}-${version}.jar") {
extension 'jar'
}
}
}
}
tasks.named('test') {
useJUnitPlatform()
}
publishToMavenLocal.configure {
mustRunAfter build
}
When I run gradle publishToMavenLocal I get:
% ./gradlew clean build publishToMavenLocal
> Task :lib:publishMavenPublicationToMavenLocal FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':lib:publishMavenPublicationToMavenLocal'.
> Failed to publish publication 'maven' to repository 'mavenLocal'
> Invalid publication 'maven': artifact file does not exist: '/Users/myuser/workspace/mylib/lib/build/libs/mylib-1.0.0-RC1.jar'
* 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 833ms
6 actionable tasks: 6 executed
So it looks like even though I'm specifying (on the command line) to run clean then build then publishToMavenLocal, and even though I'm even specifying (in build.gradle) that publishToMavenLocal must run after build, it seems what is happening is:
publishToMavenLocal insists on running first (before clean or build)
Since the JAR hasn't been built yet, no JAR file exists at the location specified ("build/libs/${archivesBaseName}-${version}.jar")
The build fails because the artifact doesn't exist
So I think I just need to get build to run before publishToMavenLocal but I'm out of ideas.
You're mixing the plugins DSL (plugins { }) with legacy plugin application (apply plugin). That's not a big deal, but you should go with #sean's answer and use the plugins DSL instead which will solve your issue.
To your problem at hand
Could not get unknown property 'plugin'
That happens because you missed the : in apply plugin
apply plugin: 'maven-publish'
Try placing your plugins in this way. Not sure if that resolves your issue though.
plugins {
id 'java-library'
id 'maven-publish'
}

Switch a Gradle-based Vaadin 22 app to Vaadin 23 beta

I am a Gradle newbie, having used Maven in the past.
I successfully established a Vaadin 22.0.5 project using the Vaadin Latest - Gradle starter project downloaded from Hello World Starters page. The project successfully builds and runs using gretty > apprun in IntelliJ 2021.1 EAP Ultimate edition.
👉 How do I alter the project to use the current beta version of the next version, Vaadin 23.0.0.beta2, as listed on the Vaadin releases page?
First attempt
I changed the gradle.properties file which consists of this single line:
vaadinVersion=22.0.5
… to this:
vaadinVersion=23.0.0.beta2
I clicked the floating windoid, Load Gradle Changes.
I immediately see this error appear in the IDE’s Build pane:
Build file '/Users/my_user/IdeaProjects/GetJava/build.gradle' line: 11
Plugin [id: 'com.vaadin', version: '23.0.0.beta2'] was not found in any of the following sources:
* 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.
Second attempt
After receiving Answer by cfrick, I did the following.
If found this at the top of the build.gradle file:
buildscript {
repositories {
maven { setUrl("https://maven.vaadin.com/vaadin-prereleases") }
maven { url "https://plugins.gradle.org/m2/" }
}
}
So I made no edits there, as seemed to be accomplishing the same thing as the first part of the Answer.
I changed the entirety of the settings.gradle file from this:
pluginManagement {
plugins {
id 'com.vaadin' version "${vaadinVersion}"
}
}
… to this:
pluginManagement {
repositories {
gradlePluginPortal()
maven {
url = "https://maven.vaadin.com/vaadin-prereleases"
}
}
plugins {
id 'com.vaadin' version "${vaadinVersion}"
}
}
I changed the gradle.properties file which consists of this single line:
vaadinVersion=22.0.5
… to this, using beta1 rather than beta2 seen above.
vaadinVersion=23.0.0.beta1
After executing Tasks > build > clean, I get a BUILD SUCCESSFUL message.
But when I execute Gretty > apprun, I get the following error message.
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
> Could not find com.vaadin:vaadin-bom:23.0.0.beta1.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/vaadin/vaadin-bom/23.0.0.beta1/vaadin-bom-23.0.0.beta1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project :
> Could not find com.vaadin:vaadin-core:.
Required by:
project :
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
Pre-release versions are released first in Vaadins own pre-release
repository. You would have to add the repository if you need access to
releases, that have not yet hit the public repos:
In build.gradle expand repositories by:
repositories {
// ...
maven {
url = "https://maven.vaadin.com/vaadin-prereleases"
}
}
In the settings.gradle add a repositories block too:
pluginManagement {
repositories {
gradlePluginPortal()
maven {
url = "https://maven.vaadin.com/vaadin-prereleases"
}
}
plugins {
id 'com.vaadin' version "${vaadinVersion}"
}
}

Failed to apply plugin 'no.nils.wsdl2java'. Configuration with name 'compile' not found

when migrating to gradle 7.x getting below error
* What went wrong:
An exception occurred applying plugin request [id: 'no.nils.wsdl2java', version: '0.12']
> Failed to apply plugin 'no.nils.wsdl2java'.
> Configuration with name 'compile' not found.
Below is wsdl2java added in build.gradle
plugins {
id("no.nils.wsdl2java") version "0.12"
`java-library`
}
buildscript {
dependencies {
classpath("no.nils:wsdl2java:0.12")
}
}
how to fix this?
no.nils.wsdl2java is not compatible with Gradle 7 and is no longer maintained. See the README in the project. The compile configuration has long been deprecated and was finally removed in Gradle 7.
You can use io.mateo.cxf-codegen in place of no.nils.wsdl2java. It is a Gradle port of the Maven CXF codegen plugin.
plugins {
id "io.mateo.cxf-codegen" version "1.0.1"
}
https://github.com/ciscoo/cxf-codegen-gradle
https://ciscoo.github.io/cxf-codegen-gradle/docs/current/user-guide/
Note, I am the author of the plugin.

PhoneGap - Could not resolve com.android.tools.build:gradle:3.0.1

I am trying to building an android-app with Cordova (PhoneGap) but during building I got an exception:
BUILD FAILED in 11s
cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.0.1.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.0.1.
> Could not get resource 'https://maven.google.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.
> Could not HEAD 'https://maven.google.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.
> maven.google.com
> Could not resolve com.android.tools.build:gradle:3.0.1.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.
> Could not HEAD 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.
> jcenter.bintray.com
* 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
gradle-file
buildscript {
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
google()
}
dependencies {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
}
//This replaces project.properties w.r.t. build settings
project.ext {
defaultBuildToolsVersion="27.0.1" //String
defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
defaultTargetSdkVersion=27 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=27 //Integer - We ALWAYS compile with the latest by default
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
What causes this exception and how do I fix it? It seems like Cordova is looking for an older version of gradle - could I change it somwhere?
Try creating a new project and see if you get the same error.
If that also fails, try updating your cordova version.
npm update -g cordova

gradle - add clover params to each subproject

I have a gradle based project with numerous subprojects. I want to run clover on all of these but my config seems insistent on having the clover.license file in every subproject folder and a specific clover section in every subproject build file.
How would I specify the clover parama in the main project and have these applied to each subproject?
snip from build.gradle:
apply plugin: 'com.bmuschko.clover'
clover {
licenseLocation = new File(rootDir, 'clover.license')
report {
html = true
}
}
dependencies {
clover 'com.cenqua.clover:clover:3.2.0'
}
Error message from ./gradlew cloverGenerateReport:
service_name:cloverAggregateDatabases FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':service_name:cloverAggregateDatabases'.
java.lang.RuntimeException: Invalid or missing License.. Please visit http://my.atlassian.com to obtain a valid license.
Include this in the buildscript section of the subproject build.gradle files:
dependencies {
classpath 'com.bmuschko:gradle-clover-plugin:2.0.1'
}

Resources