I'm in situation similar with this
(bug between JodaTime and versions of Java greater then 1.8u60).
So what I need is:
Upgrading to JodaTime version 2.8.1 or later.
The problem is: JodaTime is a transitive dependency in my project.
Build automation tool used in it is gradle. Need help to handle it.
buildscript:
buildscript {
ext {
springBootVersion = '1.2.4.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE")
classpath("org.flywaydb:flyway-gradle-plugin:3.2.1")
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'org.flywaydb.flyway'
jar {
baseName = 'xxxx'
version = 'alpha'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-data-jpa:1.2.4.RELEASE")
compile("org.springframework.boot:spring-boot-starter-aop:1.2.4.RELEASE")
compile("org.springframework.boot:spring-boot-starter-web:1.2.4.RELEASE")
compile("org.springframework.boot:spring-boot-starter-freemarker:1.2.4.RELEASE")
compile("com.amazonaws:aws-java-sdk:1.10.2")
compile("com.stripe:stripe-java:1.33.0")
compile("org.flywaydb:flyway-core:3.2.1")
compile("com.jolbox:bonecp:0.8.0.RELEASE")
runtime("org.postgresql:postgresql:9.4-1201-jdbc41")
testCompile("org.springframework.boot:spring-boot-starter-test:1.2.4.RELEASE")
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-starter-parent:1.0.2.RELEASE"
}
}
eclipse {
classpath {
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
You need to change the following piece of code in dependencies block:
compile("com.amazonaws:aws-java-sdk:1.10.2") {
exclude group: 'joda-time', module: 'joda-time'
}
compile("joda-time:joda-time:2.8.1")
put transitive false, and set between your dependencies the packages that you need rather that the ones in the transitive download.
Related
I have this gradle config:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group 'mygroup'
version '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
...
}
bootJar {
mainClassName = 'mypakeg.Application'
archiveName = 'my-server.jar'
}
sourceSets.configureEach { sourceSet ->
tasks.named(sourceSet.compileJavaTaskName).configure {
options.annotationProcessorGeneratedSourcesDirectory = file("$projectDir/generated/sources/java")
}
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-data-jpa")
implementation ('org.hibernate:hibernate-jpamodelgen')
annotationProcessor ('org.hibernate:hibernate-jpamodelgen')
implementation('org.projectlombok:lombok')
annotationProcessor 'org.projectlombok:lombok'
}
After build I have folder generated/sources/java with generated files. But Intellij IDE not see this classes. I try click rigth button and marck this folder as root generated classes. But It not helpet becaus:
I have separated module my_server and my_server_main and all classes generated in my_server but my code in my_server_main and if I add dependency to my_server_main I have circular dependency.
How can I generate classes and set path to them?
When I build a project in console I have no service of type styled text output factory available in project scope service. I have also a file pom.xml .I don't know what I do it wrong
This is my build.gradle :
import java.sql.Wrapper
buildscript {
ext {
springBootVersion = '1.2.5.RELEASE'
}
repositories {
maven { url "http://repo.spring.io/libs-milestone" }
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'war'
war {
baseName = 'springboot'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories {
mavenCentral()
maven { url "http://repo.spring.io/libs-milestone" }
}
configurations {
providedRuntime
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("javax.servlet:jstl:1.2")
runtime("mysql:mysql-connector-java")
compile("org.springframework.boot:spring-boot-starter-jdbc")
// https://mvnrepository.com/artifact/javax.el/el-api
compile group: 'javax.el', name: 'el-api', version: '2.2.1-b04'
compile ("org.springframework.boot:spring-boot-starter-web")
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
providedRuntime 'org.apache.tomcat.embed:tomcat-embed-jasper'
}
eclipse {
classpath {
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7'
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
I believe the problem is a function of the versions of Gradle and Spring's dependency-management-plugin that are in use.
See the original report from the Spring guys in this Bug in Gradle 2.14-rc1 - No service of type StyledTextOutputFactory report. Gradle moved the StyledTextOutputFactory to an internal package at some point (for the 3.0 release), which broke dependency-management-plugin 0.5.x.
This dependency-management-plugin issue details their making changes to address this in their 0.6.0 release.
I see your build script references Gradle 2.3...but I'm wondering if that is accurate.
I think it boils down to either use Gradle 2.x with dependency-management-plugin 0.5.x or use Gradle 3.x with dependency-management-plugin 0.6.x.
Good luck.
I found some help in this question. So I know that I must use JDK7 in order for unit testing to work.. So I came up with a build sript like this:
buildscript
{
repositories
{
jcenter()
}
dependencies
{
classpath 'org.javafxports:jfxmobile-plugin:1.0.8'
}
}
retrolambda.oldjdk = 'C:/Program Files/Java/jdk1.7.0_79'
apply plugin: 'org.javafxports.jfxmobile'
apply plugin: 'java'
sourceCompatibility = '1.8'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
repositories {
jcenter()
}
dependencies
{
testCompile 'junit:junit:4.12'
}
mainClassName = 'AppMain'
jfxmobile
{
javafxportsVersion = '8.60.7'
android
{
applicationPackage = 'com.somename.someapplication'
androidSdk = 'C:/Program Files (x86)/Android/android-sdk' //
}
}
But i keep getting this exception:
Could not get unknown property 'retrolambda' for root project
Any ideas as to how I can fix this?
You have to apply the jfxmobile plugin first, which in turn will add the retrolambda dependency. Then you can configure the retrolambda oldJdk variable.
(Pay attention for the camelCase spelling)
buildscript
{
repositories
{
jcenter()
}
dependencies
{
classpath 'org.javafxports:jfxmobile-plugin:1.0.8'
}
}
apply plugin: 'org.javafxports.jfxmobile'
apply plugin: 'java'
retrolambda.oldJdk = 'C:/Program Files/Java/jdk1.7.0_79'
I am new to gradle.
I am building a project using gradle.
It build successfully without any error. While running the build jar file it is giving classNotFoundException.
I am building a simple spring project from spring.io
However question look similar to this but, could not find a solution. Please help.
edit: This is how my build.gradle looks
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.5.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
jar {
baseName = 'gs-rest-service'
version = '0.1.0'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("junit:junit")
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
startScripts {
mainClassName = 'Application'
}
springBoot {
mainClass = "Application"
}
You'll need to start the application with the generated start scripts. They will automatically take care of setting up the proper classpath.
I am trying to download and add JaxRS libraries with gradle. Here is the build script:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.3.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
apply plugin: 'jetty'
jar {
baseName = 'rest-service'
version = '0.1.0'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
dependencies {
compile('javax.ws.rs:jsr311-api:1.1.1')
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("junit:junit")
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
try with --debug and see the URL it is using to retrieve the dependency. Then use curl or similar tool and see if it is available. If you can't get to it through your browser or curl then networking issue.
Check maven central too, maybe they don't have that version anymore. Just to validate.