I created a free artifactory server on Google Cloud and I'm trying to deploy it, but I have the following error:
Execution failed for task ':artifactoryDeploy'.
java.io.IOException: Could not publish build-info: This plugin is compatible with version 2.2.3 of Artifactory and above. Please upgrade
your Artifactory server!
My Gradle config
import groovy.lang.GroovyObject
import org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig
plugins {
kotlin("jvm") version "1.4.10"
id("com.jfrog.artifactory") version "4.17.2"
`maven-publish`
}
group = "com.rjdesenvolvimento"
version = "0.0.1"
repositories {
jcenter()
maven { url = uri("https://kotlin.bintray.com/ktor") }
}
dependencies {
implementation(kotlin("stdlib"))
api("org.junit.jupiter:junit-jupiter-engine:5.7.0")
api("org.jetbrains.kotlin:kotlin-test-junit5:1.4.10")
api("io.mockk:mockk:1.10.2")
}
tasks {
compileKotlin { kotlinOptions.jvmTarget = "11" }
compileTestKotlin { kotlinOptions.jvmTarget = "11" }
}
publishing {
publications {
create<MavenPublication>("kotlin") {
from(components["kotlin"])
}
}
}
artifactory {
setContextUrl("https://some-addressjfrog.io/artifactory/artifact/")
publish(delegateClosureOf<PublisherConfig> {
repository(delegateClosureOf<GroovyObject> {
setProperty("repoKey", "aries-develop")
setProperty("username", "some-user")
setProperty("password", "some=password")
setProperty("maven", true)
})
})
}
The issue is with using a wrong Artifactory URL (as indicated by #yahavi in the comments).
Please make sure that you are using the root Artifactory context, for example:
https://some-address.jfrog.io/artifactory/
The error message from the plugin is misleading and is updated in version 3.9.0 of the Jenkins Artifactory plugin.For more details see this Github issue.
Related
I'm upgrading the React Native version to the 0.69.3. And when I try to run on android. I get this error:
Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven9(http://repo.brightcove.com/releases)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols.
I tried the following solutions:
Add the allowInsecureProtocol = true param.
Just add the s on the http.
But still throw me this error.
This is my code in that part:
allprojects {
repositories {
mavenLocal()
maven {
url("$rootDir/../node_modules/react-native/android")
}
maven {
url("$rootDir/../node_modules/jsc-android/dist")
}
maven { url 'https://artifactory.img.ly/artifactory/imgly' }
mavenCentral {
content {
excludeGroup "com.facebook.react"
}
}
google()
jcenter()
maven { url 'https://repo.brightcove.com/releases' }
maven {
url "http://repo.brightcove.com/releases"
allowInsecureProtocol = true
}
maven { url 'https://maven.google.com' }
maven { url "https://www.jitpack.io" }
}
}
I have the following gradle file. I'm getting a Expression 'jar' cannot be invoked as a function error on the line where jar is used (jar {). How can I fix this?
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.6.21"
java
application
}
group = "me.talha"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
testImplementation(kotlin("test"))
}
tasks.test {
useJUnitPlatform()
}
tasks.withType<KotlinCompile>() {
kotlinOptions.jvmTarget = "11"
}
application {
mainClass.set("MainKt")
}
jar {
manifest {
attributes 'Main-Class': 'MainKt'
}
}
Turns out I did not need to add any of the jar stuff. I can simply use the gradle distZip task which generates the needed jars and executable scripts and all works fine.
i am getting a authorization error when using mapbox in react native
https://api.mapbox.com/downloads/v1/navigation/android/maven/com/mapbox/navigation/ui/1.5.0/ui-1.5.0.pom'. Received status code 401 from server: Unauthorized
i am using the package ( https://www.npmjs.com/package/#homee/react-native-mapbox-navigation )
according package documentation i am doing the same.
my build.gradle file is
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "29.0.3"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
ndkVersion = "20.1.5948944"
}
repositories {
google()
jcenter()
maven {
url 'https://api.mapbox.com/downloads/v1/navigation/android/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
username = "mapbox"
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
}
}
}
dependencies {
classpath("com.android.tools.build:gradle:4.1.0")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://mapbox.bintray.com/mapbox' }
maven { url 'https://www.jitpack.io' }
maven {
url 'https://api.mapbox.com/downloads/v1/navigation/android/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
username = "mapbox"
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
}
}
}
}
I recently encountered a similar issue. My first advice would be that if you're using their public Access token, create a new one from Access Tokens and make sure Downloads:Read scope is checked. Then create a gradle.properties file in "your_projects_directory.gradle" (which to me was C:\Users\USERNAME\AndroidStudioProjects\ .gradle), and paste the following line:
MAPBOX_DOWNLOADS_TOKEN=YOUR_SECRET_ACCESS_KEY
You should replace YOUR_SECRET_ACCESS_KEY with your actual access key of course. Just in case Android Studio is unable to find this newly created gradle.properties file, I would recommend adding a duplicate of the above line to your project gradle.properties file [This was what fixed my issue] although I'm not sure if this has any security implications.
Then finally your build.gradle should contain this:
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
// Do not change the username below.
// This should always be `mapbox` (not your username).
username = 'mapbox'
// Use the secret token you stored in gradle.properties as the password
password = System.getenv("MAPBOX_DOWNLOADS_TOKEN") ?: project.property("MAPBOX_DOWNLOADS_TOKEN") as String
}
}
I am all new to Kotlin and gradle and wanted to create a reddit scraper app for fun.
Cant get the guide from this page to work.
https://mattbdean.gitbooks.io/jraw/content/quickstart.html
The guide tells me to put this in the gradle file:
repositories {
jcenter()
}
dependencies {
compile "net.dean.jraw:JRAW:$jrawVersion"
}
But when i put that in my buid.gardle.kts file the ide reports an error
See image below of where the error occurs. The error message is Unexpected tokens.
Found the answer to my question, simply had to add in the variable in the gradle file...
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
var jrawVersion = "1.1.0" //needed to add this in obviously
plugins {
kotlin("jvm") version "1.4.21"
application
}
group = "me.jeppe"
version = "1.0"
repositories {
mavenCentral()
jcenter()
}
dependencies {
testImplementation(kotlin("test-junit"))
compile ("net.dean.jraw:JRAW:$jrawVersion")
}
tasks.test {
useJUnit()
}
tasks.withType<KotlinCompile>() {
kotlinOptions.jvmTarget = "1.8"
}
application {
mainClassName = "MainKt"
}
I currently have a problem with the file size of kotlin js. I have one multiplatform lib which has around 160Kb and integrate it in the kotlin js project. The kotlin js project itself does not have that much code.
After assembling (which should enable also DCE for shrinking) the Js file size is up to 2.5MB. I really don't know why it bloats up like that. I hope anybody has a clue. Following is my gradle.config, maybe I forgot something to add.
Short update:
We found out when serving the file of 2.5MB from CDN githack. The file is optimized to 500KB. How is that even possible. Does that mean that the actual DCE of kotlin isn't working at all?
plugins {
kotlin("js") version "1.4.10"
}
group = "me.at"
version = "1.0-SNAPSHOT"
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven {
url = uri("https://dl.bintray.com/kotlin/kotlinx")
}
maven {
url = uri("https://dl.bintray.com/kotlin/kotlin-js-wrappers")
}
maven {
url = uri("https://dl.bintray.com/ekito/koin")
}
}
dependencies {
implementation(kotlin("stdlib-js"))
implementation("org.jetbrains:kotlin-styled:1.0.0-pre.110-kotlin-1.4.10")
implementation(npm("styled-components", "~5.1.1"))
implementation(npm("inline-style-prefixer", "~6.0.0"))
implementation("com.mp.multi:multi:1.1")
implementation("org.koin:koin-core:3.0.0-alpha-4")
implementation(npm("html-webpack-plugin", "3.2.0"))
}
kotlin {
js {
browser {
binaries.executable()
webpackTask {
cssSupport.enabled = true
}
runTask {
cssSupport.enabled = true
}
testTask {
useKarma {
useChromeHeadless()
webpackConfig.cssSupport.enabled = true
}
}
}
}
}