Gradle artifactoryPublish is Skipped - java

I am trying to publish war files to our local artifactory server but when I run:
./gradlew clean build artifactoryPublish
I receive the following output:
:zuul-netflix-webapp:artifactoryPublish
Skipping task ':zuul-netflix-webapp:artifactoryPublish' as task onlyIf is false.
:zuul-netflix-webapp:artifactoryPublish SKIPPED
I've tried manually setting the onlyIf to true but this had no effect. I have tried similar configuration on another project and it works fine.
My environment:
17:22 $ ./gradlew --version
------------------------------------------------------------
Gradle 3.5.1
------------------------------------------------------------
Build time: 2017-06-16 14:36:27 UTC
Revision: d4c3bb4eac74bd0a3c70a0d213709e484193e251
Groovy: 2.4.10
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_141 (Oracle Corporation 25.141-b15)
OS: Mac OS X 10.11.6 x86_64
My build.gradle file looks like:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.netflix.nebula:gradle-extra-configurations-plugin:2.2.0'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:latest.release"
classpath 'org.akhikhl.gretty:gretty:2.0.0'
}
configurations.classpath {
resolutionStrategy {
cacheDynamicVersionsFo r 0, 'seconds'
cacheChangingModulesFor 0, 'seconds'
}
}
}
plugins {
id 'nebula.netflixoss' version '3.4.0'
}
ext.githubProjectName = rootProject.name
configurations.all {
// Exclude old asm 3.x versions.
exclude group: 'asm', module: 'asm'
exclude group: 'asm', module: 'asm-all'
}
allprojects {
apply plugin: 'java'
group = "com.netflix.${githubProjectName}"
version = currentVersion
//status = 'Integration'
}
artifactoryPublish.skip = true
subprojects {
artifactoryPublish.skip = false
//artifactoryPublish.onlyIf { true }
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'ivy-publish'
apply plugin: 'war'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'nebula.netflixoss'
apply plugin: 'nebula.provided-base'
dependencies {
testCompile 'junit:junit:4.7'
}
repositories {
jcenter()
}
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
sourceSets.test.java.srcDir 'src/main/java'
tasks.withType(Javadoc).each {
it.classpath = sourceSets.main.compileClasspath
}
test {
forkEvery = 1
maxParallelForks = 1
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.web
}
}
}
artifactoryPublish {
skip = false
publications(publishing.publications.mavenJava)
}
}
artifactory {
//clientConfig.setIncludeEnvVars(true)
//clientConfig.info.addEnvironmentProperty('test.adding.dynVar',new java.util.Date().toString())
contextUrl = 'https://artifactory.oss.central1.com/artifactory'
publish {
repository {
repoKey = 'libs-snapshot-local' // The Artifactory repository key to publish to
username = "${artifactory_user}" // The publisher user name
password = "${artifactory_password}" // The publisher password
ivy {
ivyLayout = '[organization]/[module]/ivy-[revision].xml'
artifactLayout = '[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]'
mavenCompatible = true //Convert any dots in an [organization] layout value to path separators, similar to Maven's groupId-to-path conversion. True if not specified
}
}
defaults {
// Reference to Gradle publications defined in the build script.
// This is how we tell the Artifactory Plugin which artifacts should be
// published to Artifactory.
publications('mavenJava')
}
}
resolve {
repoKey = 'jcenter'
}
}

Related

Web3j plugin for gradle task not found

I am beating against a wall for a whole week. I can't really see the reason why it doesn't work. I have a project where I want to run my Java project with the following build.gradle config:
plugins {
id 'java'
id 'org.springframework.boot' version '2.6.3'
id("io.spring.dependency-management") version "1.0.11.RELEASE"
id 'org.web3j' version "4.8.4"
}
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
jcenter()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
group = 'com.suplab'
sourceSets {
main {
solidity {
srcDir "contracts"
}
}
test {
solidity {
srcDir "contracts"
}
}
}
ext {
web3jVersion = '4.8.4'
}
npmInstall {
enabled false
}
dependencies {
implementation "org.web3j:core:$web3jVersion"
implementation "org.web3j:web3j-evm:$web3jVersion"
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.hibernate:hibernate-core:5.6.5.Final'
}
I use gradle version 6.8, since it was specified by developer of the plugin. When I try to build this project from the parent, root folder that is the root of the project, it fails with following error:
A problem occurred configuring project ':api'.
> Failed to notify project evaluation listener.
> Task with name 'resolveSolidity' not found in project ':api'.
> Could not create task ':api:generateTestContractWrappers'.
> Task with name 'compileTestSolidity' not found in project ':api'.
I can't figure it out. I checked it against the build that being generated with web3j-cli, and it's the same for the configuration property (both configs have it blank). So, I don't see any reason WHY it fails. Here's the webj3-cli generated build file:
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.61'
id 'application'
id "com.github.johnrengelman.shadow" version "5.2.0"
id 'org.web3j' version '4.8.4'
}
group 'org.web3j'
version '0.1.0'
sourceCompatibility = 1.8
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
jcenter()
}
web3j {
generatedPackageName = 'org.web3j.generated.contracts'
excludedContracts = ['Mortal']
}
ext {
web3jVersion = '4.8.4'
logbackVersion = '1.2.3'
}
dependencies {
implementation "org.web3j:core:$web3jVersion",
"ch.qos.logback:logback-core:$logbackVersion",
"ch.qos.logback:logback-classic:$logbackVersion"
implementation "org.web3j:web3j-unit:$web3jVersion"
implementation "org.web3j:web3j-evm:$web3jVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
}
jar {
manifest {
attributes(
'Main-Class': 'org.web3j.Web3App',
'Multi-Release':'true'
)
}
}
application {
mainClassName = 'org.web3j.Web3App'
}
test {
useJUnitPlatform()
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}

Eclipse libGDX project can't resolve gradle dependency of local repo but CLI has no problem?

I'm trying a libgdx project depending on a lib published in local repo with maven-publish:
// to publish locally:
// ~/gdx-gltf$ ./gradlew gltf:publishToMavenLocal
apply plugin: 'maven-publish'
publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'io.github.odys-z'
artifactId = 'gdx-gltf'
version = '0.1.0-SNAPSHOT'
from components.java
}
}
}
When I running the depending desktop with gradlew CLI, it's working:
./gradlew desktop:run
But in eclipse and right click the BasicTweenTest class (gradle project.ext.mainClassName) and run as java application, eclipse reported errors:
com.badlogic.gdx.utils.GdxRuntimeException: java.lang.Error: Unresolved compilation problems:
sceneAsset cannot be resolved to a variable
GLTFLoader cannot be resolved to a type
SceneModel cannot be resolved to a type
scenes cannot be resolved or is not a field
animationLoader cannot be resolved to a variable
The missing type is in the local repo dependency, gdx-gltf-0.1.0-SNAPSHOT. No matter what I cleaned projects or refreshed gradle, the error persisting appear.
Eclipse Screenshot with stacktrace report
desktop/build.gradle:
apply plugin: "java"
sourceCompatibility = 1.8
sourceSets.main.java.srcDirs = [ "src/", "test/" ]
sourceSets.main.resources.srcDirs = ["../android/assets", "test"]
// project.ext.mainClassName = "io.oz.wnw.norm.desktop.DesktopLauncher"
// project.ext.mainClassName = "io.oz.wnw.norm.desktop.PlaneStarTest"
project.ext.mainClassName = "io.oz.wnw.norm.desktop.BasicTweenTest"
project.ext.assetsDir = new File("../android/assets")
task run(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
}
task debug(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
debug = true
}
task dist(type: Jar) {
manifest {
attributes 'Main-Class': project.mainClassName
}
from {
configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
with jar
}
dist.dependsOn classes
The other two tests commented out above can run both in CLI and eclipse, which don't depend on the local published package. Any idea?
--------- parent project/build.gradle ----------
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
// jcenter()
google()
}
dependencies {
classpath 'org.wisepersist:gwt-gradle-plugin:1.0.9'
classpath 'com.android.tools.build:gradle:7.0.0-alpha08'
}
}
allprojects {
version = '1.0'
ext {
appName = "wn cloud"
gdxVersion = '1.9.14'
gltfVersion = '0.1.0-SNAPSHOT'
roboVMVersion = '2.3.8'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
}
repositories {
mavenLocal()
maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
mavenCentral()
// jcenter()
google()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
project(":desktop") {
apply plugin: "java-library"
dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
}
}
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
}
}
project(":html") {
apply plugin: "java-library"
apply plugin: "gwt"
apply plugin: "war"
dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
api "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
api "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
api "com.badlogicgames.ashley:ashley:$ashleyVersion:sources"
}
}
project(":core") {
apply plugin: "java-library"
apply plugin: 'eclipse'
eclipse {
classpath {
downloadSources=true
downloadJavadoc = true
}
}
dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
api "com.badlogicgames.ashley:ashley:$ashleyVersion"
api 'io.github.odys-z:gdx-gltf:0.1.0-SNAPSHOT'
}
}
I faced the same problem. Turns out that LibGDX works with JDK 7 and any version compiled above won't work.
You need to enforce java to compile at version 1.7 before publishing locally
apply plugin: 'java'
sourceCompatibility = 1.7
targetCompatibility = 1.7

Gradle build error on previously working program

I have a Jave 8, SpringBoot, webService which has been running fine on Eclipse 2020-06 for months. I build using Gradle. In an attempt to get the latest version of an updated jar file from Artifactory I did :
gradlew clean
gradlew eclipse
F5 (Refresh)
This indeed pulled the required jar file but my program now failed to compile. The error is:
The import org.springframework.beans.factory.annotation cannot be resolved
And all my #Autowired commands now error.
What i've tried :
gradlew cleanEclipse eclipse
close project, close eclipse, reopen eclipse, reopen project
gradle -> Refresh Gradle project
Same a 2. preceded by reboot pc. When I do this I get:
After I did:
gradlew cleanEclipse eclipse
The following jar dissapeared from my project:
spring-beans.5.3.0.RC1.jar
This is what is causing the problem.
Is this incorrect in build.gradle:
implementation "org.springframework:spring-beans:5.+"
How do I get this jar back?
Any help appreciated.
My build.gradle file is:
plugins {
id 'org.springframework.boot' version '2.2.2.RELEASE'
id 'java'
}
repositories {
maven {
url "https://repo-int.xxxxxx.io/artifactory/cc-central"
}
maven {
url "https://code.lds.org/nexus/content/groups/main-repo"
}
maven {
url "${chemaxonRepositoryUrl}/libs-release"
credentials {
username = chemaxonRepositoryUser
password = chemaxonRepositoryPassword
}
}
}
ext {
archive_basename = "dcrws"
project_description = "Chemistry Workbench DcrWs"
springStarterVersion = '2.2.2.RELEASE'
// Jenkins/Environment Information
build_tag = System.getenv('BUILD_TAG') ?: "none"
build_by = System.getenv('NODE_NAME') ?: "none"
build_date = System.getenv('BUILD_TIMESTAMP') ?: "none"
build_system = System.getenv('JENKINS_HOME') ?: "none"
build_url = System.getenv('BUILD_URL') ?: "none"
build_user = System.getenv('USER') ?: "none"
}
// standard plugins
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'io.spring.dependency-management'
def git_info = hasProperty('git_info') ? git_info : 'https://git.git/repo,00000000'
def full_version = hasProperty('app_version') ? app_version : '0.0.0'
group = 'com.clarivate.singularity.chemworkbench'
version = full_version
archivesBaseName = ext.archive_basename
sourceCompatibility = 1.8
targetCompatibility = 1.8
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
}
// if master branch, use latest version of chemcur:cwbcommon, else use 0.0+ version
ext.cwbcommon_version = '1.+'
if ( full_version =~ /^0./) { ext.cwbcommon_version = '0.0+' }
ext.pwbcommon_version = '1.+'
if ( full_version =~ /^0./) { ext.pwbcommon_version = '0.0+' }
dependencies {
implementation "org.springframework.boot:spring-boot-starter-actuator:$springStarterVersion"
implementation "org.springframework.boot:spring-boot-starter-web:$springStarterVersion"
implementation "org.springframework.boot:spring-boot-starter-cache:$springStarterVersion"
implementation "org.springframework.boot:spring-boot-starter-data-jdbc:$springStarterVersion"
implementation "org.springframework.boot:spring-boot-starter-data-jpa:$springStarterVersion"
implementation "org.springframework.boot:spring-boot-starter-tomcat:$springStarterVersion"
implementation 'com.fasterxml.jackson.core:jackson-core:2.+'
implementation "org.springframework:spring-beans:5.+"
implementation "org.springframework:spring-core:5.+"
implementation "javax.servlet:javax.servlet-api:4.+"
implementation "org.apache.commons:commons-lang3:3.9+"
implementation "commons-dbutils:commons-dbutils:1.7+"
implementation "com.oracle:ojdbc6:11.2.0.1.0"
compile 'com.chemaxon:calculations:20.+'
// homegrown libs
compile ("chemcur:cwbcommon:${cwbcommon_version}") {changing = true}
compile ("chemcur:pwbcommon:${pwbcommon_version}") {changing = true}
developmentOnly "org.springframework.boot:spring-boot-devtools:$springStarterVersion"
}
springBoot {
buildInfo {
properties {
artifact = archive_basename
version = full_version
group = group
name = project_description
additional = [
'Implementation-Title': project_description,
'Implementation-Version': full_version,
"Implementation-SCM": git_info,
"Jenkins-Build-Tag": build_tag,
"Build-By": build_by,
"Build-Date": build_date,
"Build-JDK": System.getProperty('java.version'),
"Build-Gradle-Version": project.gradle.gradleVersion,
]
}
}
}

No signature of method is applicable for argument types when trying to publish to JCenter with gradle

I'm trying to publish my project to JCenter with gradle.
I'm getting this error:
$ ./gradlew bintrayUpload
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/tomcaflisch/my-project/build.gradle' line: 32
* What went wrong:
A problem occurred evaluating root project 'my-project'.
> No signature of method: build_1izvkzzfcfkppgubyut54udzf.bintray() is applicable for argument types: (build_1izvkzzfcfkppgubyut54udzf$_run_closure3) values: [build_1izvkzzfcfkppgubyut54udzf$_run_closure3#30577a07]
* 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 1s
Here's my build.gradle file
buildscript {
repositories {
maven { url "https://repo1.maven.org/maven2" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.+'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
}
}
plugins {
id "com.jfrog.bintray" version "1.8.5"
}
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'java'
group = 'com.projectx'
version = '0.0.1'
repositories {
jcenter()
mavenCentral()
}
sourceSets {
main.java.srcDirs = ['src/main/java']
}
bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
publications = ['MyPublication']
pkg {
repo = 'maven'
name = 'project-x'
userOrg = 'myorg'
licenses = ['Proprietary']
vcsUrl = 'https://github.com/myorg/my-project.git'
version {
name = project.version
released new Date()
}
}
}
publishing {
publications {
MyPublication(MavenPublication) {
from components.java
groupId project.group
artifactId 'projectx'
version project.version
}
}
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'jacoco'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
install {
repositories.mavenInstaller {
pom.artifactId = 'projectx'
}
}
test {
finalizedBy jacocoTestReport // Report is always generated after tests run
}
jacocoTestReport {
dependsOn test // Tests are required to run before generating the report
reports {
xml.enabled true
}
}
task execute(type:JavaExec) {
main = System.getProperty('mainClass')
classpath = sourceSets.main.runtimeClasspath
}
dependencies {
compile 'io.swagger:swagger-annotations:1.5.22'
compile "com.google.code.findbugs:jsr305:3.0.2"
compile 'com.squareup.okhttp3:okhttp:3.14.2'
compile 'com.squareup.okhttp3:logging-interceptor:3.14.2'
compile 'com.google.code.gson:gson:2.8.5'
compile 'io.gsonfire:gson-fire:1.8.3'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'
testCompile 'junit:junit:4.13'
testCompile 'org.mockito:mockito-core:3.+'
testImplementation "com.google.truth:truth:1.0.1"
}
javadoc {
options.tags = [ "http.response.details:a:Http Response Details" ]
}
Bintray is dead.
But to answer the question, No signature of method: build_whatever.[method]() comes from something in the configuration of [method] being incorrect. In this case I'd guess it's caused by released new Date() which should probably be released = new Date()

How to install or publish submodules of gradle project as a jar

I want to install submodules of my project as jar to maven local repository. I searched a gradle script for publish. I found. But it install only one jar and it has not classes of submodules. How can I proceed?
my-project
|
|__subprj1
| |__src
| |__ com
| |__Abc.java
|
| |__pom.xml
|__subprj2
| |
| |__pom.xml
|
|__ build.gradle
|__ publish.gradle
build.gradle:
apply plugin: "java"
apply from : 'publish.gradle'
ext {
GROUPID = "my-project"
VERSION = "1.0.0"
robovmVersion = "1.5.0"
androidVersion = "4.4"
gwtVersion = "2.6.0"
jglfwVersion = "1.1"
lwjglVersion = "2.9.2"
jlayerVersion = "1.0.1-gdx"
jorbisVersion = "0.0.17"
junitVersion = "4.11"
}
buildscript {
repositories { mavenCentral() }
dependencies {
classpath "com.android.tools.build:gradle:1.2.3"
classpath "org.robovm:robovm-gradle-plugin:1.5.0"
}
}
configure(allprojects - project('...'')) {
apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: "java"
compileJava.options.encoding = 'UTF-8';
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
group = GROUPID
version = VERSION
// set source Java version
sourceCompatibility = 1.6
targetCompatibility = 1.6
sourceSets.main.java.srcDirs = ["src"]
sourceSets.main.resources.srcDirs = ["src"]
// create a custom configuration for local dependencies such as Android runtime
configurations {
optional
compile.extendsFrom optional
}
}
project("...) {
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption("Xdoclint:none", "-quiet")
}
}
}
task fetchNatives << {
ant.importBuild "fetch.xml"
fetch.execute()
copy.execute()
}
publish.gradle:
apply plugin: 'maven'
apply plugin: 'signing'
group = 'my-project'
version = '1.0.0'
ext.packaging = 'jar'
def isDevBuild
def isCiBuild
def isReleaseBuild
def sonatypeRepositoryUrl
//set build variables based on build type (release, continuous integration, development)
if(hasProperty("release")) {
...
} else if (hasProperty("snapshot")) {
...
} else {
isDevBuild = true
println "Performing local build"
}
repositories {
mavenCentral()
}
task artifactDocs(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from 'build/docs/javadoc'
}
task artifactSources(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
artifacts {
archives jar
archives artifactDocs
archives artifactSources
}
if(isReleaseBuild) {
signing {
sign configurations.archives
}
} else {
task signArchives {
// do nothing
}
}
uploadArchives {
repositories {
if (isDevBuild) {
mavenLocal()
}
}
}
First, your submodules must be handled as gradle subprojects. So you have to create build.gradle files for them and include them in the root project via settings.gradle file.
Second, in the build.gradle file of each subproject, you can define your deployment code. To install something in your local maven repository ($HOME/.m2), I use the gradle maven plugin. After configuring it correctly, I run install on this subproject:
gradle subproject1:install
Here an example configuration of such a subproject to install it locally:
apply plugin: 'maven'
...
group = 'com.example.subproject2'
configurations {
deployerJars
}
dependencies {
...
deployerJars "org.apache.maven.wagon:wagon-http:2.2"
}
...
def installer = install.repositories.mavenInstaller

Categories

Resources