Getting 401 Unauthorized during Gradle build for Atlassian Renderer library - spring

I think by Gradle build problem is related to this Spring article about Spring Artifactory instance repo.spring.io permissions. Pls help me correct my build.gradle which has started failing recently after upgrading to Gradle 5.0.
Snippet from build.gradle
buildscript {
ext {
springBootVersion = SPRING_BOOT_VERSION
}
repositories {
mavenCentral()
maven {
url 'https://repo.spring.io/libs-milestone'
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath('se.transmode.gradle:gradle-docker:1.2')
}
}
apply plugin: 'java'
repositories {
mavenCentral()
maven {
url 'https://repo.spring.io/libs-milestone'
}
maven { url "https://packages.atlassian.com/maven/repository/public" }
}
dependencies {
compile (group: 'com.atlassian.renderer', name: 'atlassian-renderer', version:'8.0.5') {
exclude(module: 'servlet-api')
exclude(module: 'radeox')
// https://mvnrepository.com/artifact/javax.activation/activation
compile group: 'javax.activation', name: 'activation', version: '1.1.1'
}
}
The error i get is
> Could not resolve com.atlassian.renderer:atlassian-renderer:8.0.5.
> Could not get resource 'https://repo.spring.io/libs-milestone/com/atlassian/renderer/atlassian-renderer/8.0.5/atlassian-renderer-8.0.5.pom'.
> Could not HEAD 'https://repo.spring.io/libs-milestone/com/atlassian/renderer/atlassian-renderer/8.0.5/atlassian-renderer-8.0.5.pom'. Received status code 401 from server: Unauthorized
Please help.

I added jCenter in the repositories in build.gradle and it worked for me.
jcenter()
I think the atlassian-renderer is no longer available with maven repo.

Related

Jackson Databind Issue - Gradle

I tried to deploy strom Topology written with 2.2.0 at local with below command:
./storm local ./sample.jar com.sample.processor.storm.Main config.yml
But unfortunately, I got this issue:
java.lang.NoClassDefFoundError:
Could not initialize class
com.fasterxml.jackson.databind.deser.std.JdkDeserializers
I had included this at gradle file , provided below the gradle file:
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.0.1"
}
}
repositories {
maven { url "http://clojars.org/repo"}
maven { url "https://repository.cloudera.com/artifactory/cloudera-repos/" }
jcenter { url "http://jcenter.bintray.com/" }
}
configurations {
includeInJar
}
dependencies {
includeInJar 'org.codehaus.jackson:jackson-core-asl:1.9.13'
includeInJar 'org.codehaus.jackson:jackson-mapper-asl:1.9.12'
includeInJar 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
compile ('org.apache.storm:storm-core:2.2.0') {
exclude group: 'org.slf4j'
exclude group: 'com.fasterxml.jackson.core'
}
compile 'org.codehaus.jackson:jackson-core-asl:1.9.13'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.12'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.8'
}
Compilation is successful, I was able to test at IDE at runtime, but only during local deployment, above error occurs
Any help appreciated. Thanks in Advance!
Same gradle-file worked with storm 0.10.0 but not working at 2.2.0
I removed fasterxml dependencies from gradle build as this conflicts with jackson library and it builds JAR executable fine.

Spring framework import failed

I am starting on Spring and learning its foundations. I created a project in intellij
It was giving an error stating that web cannot be imported.
so i guessed it must have been . my gradle build file which does not have web
I tried to import in manually via the build.gradle file as below but it throws me an error saying it cannot be found.
WHat am i doing wrong and how can i resolve this?
plugins {
id 'org.springframework.boot' version '2.2.2.BUILD-SNAPSHOT'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
}
group = 'io.codementor.gtommee'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
maven { url 'https://repo.spring.io/snapshot' }
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
test {
useJUnitPlatform()
}
any help?
You are missing the spring-boot-starter-web dependency in your build.gradle file.
To get started, have a look at https://start.spring.io/

Fail to upload jar file to jcenter: 405 code

I have the following build.gradle file:
apply plugin:'java'
apply plugin:'groovy'
apply plugin:'eclipse'
apply plugin:'maven'
configurations {
deployerJars
}
repositories{
jcenter()
mavenCentral()
}
version '0.1.2'
group 'io.example'
dependencies{
implementation 'org.codehaus.groovy:groovy-all:2.4.10'
testImplementation 'org.spockframework:spock-core:1.0-groovy-2.4'
}
dependencies{
deployerJars "org.apache.maven.wagon:wagon-http:2.2"
}
uploadArchives {
repositories.mavenDeployer {
configuration = configurations.deployerJars
repository( url:'https://my-private-repo.bintray.com' ){
authentication userName:'myName', password:'secret' }
}
}
If I run the task, I'm getting an exception:
Execution failed for task ':uploadArchives'.
Could not publish configuration 'archives'
Failed to deploy artifacts: Could not transfer artifact ...... Return code is: 405, ReasonPhrase: Method Not Allowed.
I tried using maven-publish plugin with no luck either.
What am I missing?

Deploy my Gradle (Spring Boot) app in Heroku

I have a gradle + spring boot application with the following build.gradle file:
buildscript {
ext {
springBootVersion = '2.0.0.BUILD-SNAPSHOT'
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
jar {
baseName = 'teambuilting'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-actuator-docs')
compile('org.springframework.boot:spring-boot-starter-data-rest')
compile('org.springframework.data:spring-data-rest-hal-browser')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-web-services')
compile('org.springframework.boot:spring-boot-starter-data-mongodb')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
But, when I am trying to deploy my master branch in Heroku, I get the following error:
-----> Failed to detect set buildpack https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/gradle.tgz
More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
! Push failed
I added in the Buildpacks, heroku/gradle. What else am I missing?
you have to define in the dashboard that the project use the buildpack for Gradle. In the build.gradle, has to add this task:
task stage {
dependsOn build
}
and create a Procfile to indicate the next steps once heroku build your software.
Juan Antonio

build.gradle - error deploying artifact

I'm having issues with publishing to local nexus maven repository.
I admit, I don't have much experience with using gradle.
I will say that I have tried understanding the documentation and examples that are given through the gradle website (along with a few stackoverflow questions).
I am getting the following error when I try to publish:
Execution failed for task ':publishMavenPublicationToMavenRepository'.
> Failed to publish publication 'maven' to repository 'maven'
> Error deploying artifact 'com.myproject:myproject-sdk:jar': Error deploying artifact: Resource to deploy not found: File: http://git.site.com:8081/nexus/content/repositories/releases/com/myproject/myproject-sdk/3.0.0/myproject-sdk-3.0.0.jar does not exist
the entire build.gradle file looks like this:
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'build-version'
buildscript {
repositories {
maven { url "http://git.site.com:8081/nexus/content/groups/public" }
maven { url 'https://geonet.artifactoryonline.com/geonet/public-releases' }
mavenCentral()
}
dependencies {
classpath 'nz.org.geonet:gradle-build-version-plugin:1.+'
}
}
repositories {
maven {
url "http://git.site.com:8081/nexus/content/groups/public"
}
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
compile 'com.google.code.gson:gson:2.2.4'
compile 'commons-codec:commons-codec:1.9'
}
task sourceJar(type: Jar) {
from sourceSets.main.allJava
}
publishing {
publications {
maven(MavenPublication) {
artifactId = 'myproject-sdk'
groupId = 'com.myproject'
version '3.0.0'
from components.java
artifact sourceJar {
classifier "sources"
}
}
}
repositories {
maven {
// nexus maven credentials
credentials {
username "MY_USERNAME"
password ""MY_PASSWORD"
}
if(version.endsWith('-SNAPSHOT')) {
url "http://git.site.com:8081/nexus/content/repositories/snapshots"
} else {
url "http://git.site.com:8081/nexus/content/repositories/releases"
}
}
}
}
I am using Android Studio and this project is a Java project.
I don't understand the message because it says "Resource to deploy not found" and it points to a url at nexus.
I would expect a message like "Resource to deploy not found: File: c:/directory_that_doesn't_exist/whatever.jar"
Additional Information -
The gradle tasks listed under 'All tasks' are:
assemble
build
buildDependents
buildNeeded
check
classes
clean
compileJava
compileTestJava
generatePomFileForMavenPublication
jar
javadoc
processResources
processTestResources
publish
publishMavenPublicationToMavenLocal
publishMavenPublicationToMavenRepository
publishToMavenLocal
sourceJar
test
testClasses

Resources