org.gradle.api.internal.LocationAwareException from gradle - gradle

I have a gradle build error from the following gradle file. But I am clueless why it failed.
Please advise.
Thanks,
buildscript {
repositories {
maven { url "http://repo.spring.io/libs-snapshot" }
mavenLocal()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.0.0.RC4")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot' <== This is line 14
jar {
baseName = 'gs-spring-boot'
version = '0.1.0'
}
repositories {
mavenCentral()
maven { url "http://repo.spring.io/libs-snapshot" }
}
dependencies {
// tag::jetty[]
compile("org.springframework.boot:spring-boot-starter-web") {
exclude module: "spring-boot-starter-tomcat"
}
compile("org.springframework.boot:spring-boot-starter-jetty")
// end::jetty[]
// tag::actuator[]
compile("org.springframework.boot:spring-boot-starter-actuator")
// end::actuator[]
testCompile("junit:junit")
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}
#localhost hello]$ gradle
org.gradle.api.internal.LocationAwareException: Build file '/home/xxx/dev/src/main/java/hello/build.gradle' line: 14
A problem occurred evaluating root project 'hello'.
at org.gradle.initialization.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:85)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:78)
at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)
at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:31)
at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:20)
at org.gradle.launcher.Main.doAction(Main.java:48)
at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.Main.main(Main.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:24)
Caused by: org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'hello'.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:127)
at org.gradle.configuration.BuildScriptProcessor.evaluate(BuildScriptProcessor.java:38)
at org.gradle.configuration.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:43)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:462)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:74)
at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:23)
at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:21)
at org.gradle.configuration.DefaultBuildConfigurer$1.execute(DefaultBuildConfigurer.java:38)
at org.gradle.configuration.DefaultBuildConfigurer$1.execute(DefaultBuildConfigurer.java:35)
at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:438)
at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractProject.java:433)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:139)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:110)
... 19 more
Caused by: java.lang.NoSuchMethodError: org.gradle.api.tasks.TaskContainer.create(Ljava/lang/String;Ljava/lang/Class;)Lorg/gradle/api/Task;
at org.springframework.boot.gradle.SpringBootPlugin.addRepackageTask(SpringBootPlugin.java:94)
at org.springframework.boot.gradle.SpringBootPlugin.applyRepackage(SpringBootPlugin.java:60)
at org.springframework.boot.gradle.SpringBootPlugin.apply(SpringBootPlugin.java:48)
at org.springframework.boot.gradle.SpringBootPlugin.apply(SpringBootPlugin.java:1)
at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.providePlugin(DefaultProjectsPluginContainer.java:107)
at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.addPluginInternal(DefaultProjectsPluginContainer.java:71)
at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.apply(DefaultProjectsPluginContainer.java:37)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:101)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:32)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:72)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:114)
at org.gradle.api.internal.project.AbstractProject.apply(AbstractProject.java:840)

That method create(String,Class<?>) was introduced in Gradle 1.6, so I suspect you have a mouldy Gradle wrapper (or some other messed up Gradle environment). The configuration says the wrapper generated is 1.11, but I think maybe you are running with an older version?

Related

Apache Flink + Spring boot + Gradle

I have a Flink application that runs inside Spring Boot application.
The application fails to run as a jar in a Flink cluster.
I am able to run the application on my local windows machine(mini-cluster) as a jar.
The exception stack trace look like this:
org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: null
at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:546)
at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:421)
at org.apache.flink.client.program.OptimizerPlanEnvironment.getOptimizedPlan(OptimizerPlanEnvironment.java:83)
at org.apache.flink.client.program.PackagedProgramUtils.createJobGraph(PackagedProgramUtils.java:80)
at org.apache.flink.runtime.webmonitor.handlers.utils.JarHandlerUtils$JarHandlerContext.toJobGraph(JarHandlerUtils.java:126)
at org.apache.flink.runtime.webmonitor.handlers.JarRunHandler.lambda$getJobGraphAsync$6(JarRunHandler.java:142)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:529)
... 9 more
Caused by: org.apache.flink.client.program.OptimizerPlanEnvironment$ProgramAbortException
at org.apache.flink.streaming.api.environment.StreamPlanEnvironment.execute(StreamPlanEnvironment.java:70)
at org.apache.flink.streaming.api.environment.StreamPlanEnvironment.execute(StreamPlanEnvironment.java:53)
at cdc.il.cdm.application.IngestionJob.execute(IngestionJob.java:61)
at cdc.il.cdm.application.CdmApplication.run(CdmApplication.java:28)
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:813)
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:797)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:324)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
I am using Gradle and spring-boot-gradle-plugin to build the artifact. It seems that the artifact that is built does not match what Flink's runtime expects.
Does anyone has an example of a good recipe to create an artifact using Gradle ?
EDIT :
I have found a solution using shadow plugin - https://imperceptiblethoughts.com/shadow/
The following gradle build file works for me on a Flink machine. The jar was built by the shadow plugin
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.6.RELEASE")
classpath 'com.github.jengelman.gradle.plugins:shadow:5.1.0'
}
}
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
ext {
javaVersion = '1.8'
flinkVersion = '1.8.0'
scalaBinaryVersion = '2.11'
slf4jVersion = '1.7.7'
log4jVersion = '1.2.17'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-starter-web')
compile project(':common')
compile project(':ingestion')
compile project(':enrichment')
compile project(':filter')
compile "org.apache.flink:flink-java:${flinkVersion}"
compile "org.apache.flink:flink-connector-kafka_2.11:${flinkVersion}"
compile "org.apache.flink:flink-streaming-java_${scalaBinaryVersion}:${flinkVersion}"
compile "log4j:log4j:${log4jVersion}"
compile "org.slf4j:slf4j-log4j12:${slf4jVersion}"
compile group: 'org.apache.flink', name: 'flink-connector-kafka_2.12', version: '1.8.0'
}
configurations {
all*.exclude module : 'spring-boot-starter-logging'
}
bootJar {
enabled false
}
import com.github.jengelman.gradle.plugins.shadow.transformers.*
//def timestamp = new Date().format('yyyy-MM-dd-HHmm')
shadowJar {
zip64 true
mergeServiceFiles()
baseName = 'cdm-flink-app'
classifier=null
//version = timestamp
manifest {
attributes 'Main-Class': 'cdc.il.cdm.application.CdmApplication'
}
append 'META-INF/spring.handlers'
append 'META-INF/spring.schemas'
append 'META-INF/spring.tooling'
transform(PropertiesFileTransformer) {
paths = ['META-INF/spring.factories' ]
mergeStrategy = "append"
}
}
Looks to me like you probably aren't defining mainClassName, as in
mainClassName = 'org.myorg.quickstart.StreamingJob'
Take a look at Flink's Gradle quickstart docs for more info: https://ci.apache.org/projects/flink/flink-docs-stable/dev/projectsetup/java_api_quickstart.html#gradle.

ArtifactoryPublish fails with null pointer exception

I have a java library which I want to upload to jfrog artifactory. But no matter what I do I get a null pointer exception:
Execution failed for task :util-lib-java:artifactoryPublish.
java.lang.NullPointerException (no error message)
It worked perfectly fine on the 3rd October this year, and failed on the 10th. We then referenced version: classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.*" and what I can see jfrog updated their library from 4.4.5 to 4.47 between these dates. But now when I'm trying with various versions I only get the error specified above.
My build.gradle looks like:
buildscript {
repositories {
jcenter()
maven {
url "${artifactory_contextUrl}/plugins-release"
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
}
dependencies {
//Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.4.2"
}
}
apply plugin: 'java'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
repositories
{
mavenCentral()
maven {
url "${artifactory_contextUrl}/libs-release-local"
}
maven {
url "${artifactory_contextUrl}/libs-snapshot-local"
}
}
// Android project is also using this library, so java version cannot be 1.8
sourceCompatibility = 1.7
targetCompatibility = 1.7
publishing {
publications {
mavenJava(MavenPublication) {
// Set the base name of the artifacts
artifactId 'util-lib-java'
groupId group
version version
from components.java
}
}
}
artifactory {
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
if ( project.version.endsWith('-SNAPSHOT') ) {
repoKey = 'libs-snapshot-local'
} else {
repoKey = 'libs-release-local'
}
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
defaults {
publications ('mavenJava')
}
}
}
and the top-level build.gradle looks like:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
version = '1.0'
group = 'com.companyname'
repositories {
jcenter()
}
}
We're using gradle-2.14.1-bin.zip wrapper.
Stacktrace from build:
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':util-lib-java:artifactoryPublish'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:66)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: java.lang.NullPointerException
at org.jfrog.gradle.plugin.artifactory.task.BuildInfoBaseTask.prepareAndDeploy(BuildInfoBaseTask.java:346)
at org.jfrog.gradle.plugin.artifactory.task.BuildInfoBaseTask.collectProjectBuildInfo(BuildInfoBaseTask.java:132)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:228)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:221)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:621)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:604)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
What am I missing here? This issue don't help me
Should be noted for folks stumbling across this issue that it should be resolved with the latest release: 4.4.10
https://github.com/JFrogDev/build-info/issues/101
For publishing you have to remove this lines in you gradle.properties or local.properties:
org.gradle.configureondemand=true
org.gradle.daemon=true
Also you have to add this in the main build.gradle file.
allprojects {
apply plugin: 'com.jfrog.artifactory'
...
}
After that the publishing should be work.

Failing to run .WAR using java -jar

On an early stage of development of my Spring Boot project I was used to run the application using java -jar build\libs\online_store-0.1.0.jar. Now I need to deliver a WAR. I followed the links below to build a deployable WAR file with Gradle. After that I was able to deploy the resulting built file on Tomcat 8 webapp directory and it is working fine. But I also need to run the embedded server using java -jar. Every time I try to do it (java -jar build\libs\online_store-0.1.0.war) I get a FileNotFoundException related to some missing dependency JAR (please see the stack trace below). After I add the corresponding dependency to the requiresUnpack option the error message changes but I am afraid I will never finish adding dependencies. What am I missing to get the WAR file both deployable and runnable by java -jar? Thanks in advance.
requiresUnpack = [ "org.webjars:less", "org.webjars:jshint", "org.webjars:emberjs",
"org.webjars:handlebars", "org.webjars:coffee-script", "org.webjars:jslint", "org.webjars:json2",
"org.webjars:jquery", "org.webjars:handlebars", "org.slf4j:slf4j-api"
]
http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file
http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#build-tool-plugins-gradle-packaging
Snippet of stack trace:
Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: C:\Users\hcorzo\workspace\online_mvp\online_store\build\libs\online_store-0.1.0.war!\WEB-INF\lib\validate.js-0.8.0.jar (The system cannot find the path specified)
at org.webjars.urlprotocols.JarUrlProtocolHandler.getAssetPaths(JarUrlProtocolHandler.java:54)
at org.webjars.WebJarAssetLocator.getAssetPaths(WebJarAssetLocator.java:91)
at org.webjars.WebJarAssetLocator.getFullPathIndex(WebJarAssetLocator.java:121)
at org.webjars.WebJarAssetLocator.<init>(WebJarAssetLocator.java:152)
at org.springframework.web.servlet.resource.WebJarsResourceResolver.<init>(WebJarsResourceResolver.java:52)
at org.springframework.web.servlet.config.annotation.ResourceChainRegistration.getResourceResolvers(ResourceChainRegistration.java:108)
at org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration.getRequestHandler(ResourceHandlerRegistration.java:164)
at org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry.getHandlerMapping(ResourceHandlerRegistry.java:113)
at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.resourceHandlerMapping(WebMvcConfigurationSupport.java:409)
at org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration$$EnhancerBySpringCGLIB$$7c82d476.CGLIB$resourceHandlerMapping$33(<generated>)
at org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration$$EnhancerBySpringCGLIB$$7c82d476$$FastClassBySpringCGLIB$$7c23c9ca.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
at org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration$$EnhancerBySpringCGLIB$$7c82d476.resourceHandlerMapping(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 25 more
Caused by: java.io.FileNotFoundException: C:\Users\hcorzo\workspace\online_mvp\online_store\build\libs\online_store-0.1.0.war!\WEB-INF\lib\validate.js-0.8.0.jar (The system cannot find the path specified)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
at org.webjars.urlprotocols.JarUrlProtocolHandler.getAssetPaths(JarUrlProtocolHandler.java:36)
... 43 more
And this is my build.gradle file:
buildscript {
repositories {
mavenCentral()
jcenter()
maven { url 'http://dl.bintray.com/sbuettner/maven' }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE")
classpath 'ro.isdc.wro4j.gradle:wro4j-gradle-plugin:1.8.0.Beta3'
classpath "io.spring.gradle:dependency-management-plugin:0.5.6.RELEASE"
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'wro4j'
apply plugin: "io.spring.dependency-management"
apply plugin: 'war'
dependencyManagement {
imports {
mavenBom 'org.springframework.cloud:spring-cloud-netflix:1.1.0.RELEASE'
}
}
jar {
baseName = 'online_store'
version = '0.1.0'
}
war {
baseName = 'online_store'
version = '0.1.0'
}
repositories {
mavenCentral()
maven { url 'http://dl.bintray.com/sbuettner/maven' }
maven { url "http://repo.spring.io/libs-snapshot" }
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
ext {
versionJQuery = '2.1.1'
versionBootstrap = '3.2.0'
versionAngular = '1.3.8'
}
springBoot {
mainClass = "com.grupomedicus.store.server.UiApplication"
executable = true
requiresUnpack = [ "org.webjars:less", "org.webjars:jshint", "org.webjars:emberjs",
"org.webjars:handlebars", "org.webjars:coffee-script", "org.webjars:jslint", "org.webjars:json2",
"org.webjars:jquery", "org.webjars:handlebars", "org.slf4j:slf4j-api"
]
}
bootRepackage {
mainClass = "com.grupomedicus.store.server.UiApplication"
}
bootRun {
addResources = true
}
configurations {
providedRuntime
}
webResources {
bundle ('core') {
js 'js/**/*.js'
preProcessor 'jsMin'
}
bundle ('angular-bootstrap') {
js "webjars/jquery/$versionJQuery/jquery.min.js"
js "webjars/angularjs/$versionAngular/angular.min.js"
js "webjars/angularjs/$versionAngular/angular-route.min.js"
}
bundle ('angular-bootstrap') {
css "webjars/bootstrap/$versionBootstrap/css/bootstrap.min.css"
css 'themes/default/main.css'
cssRewriteUrl()
}
assets {
include 'themes/default/images/**'
}
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-security')
compile("org.springframework.boot:spring-boot-starter-web")
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("org.springframework.security:spring-security-core")
compile 'org.apache.commons:commons-lang3'
compile(group: 'de.infinit', name: 'spring-boot-autoconfigure-wro4j', version: '0.0.6')
compile "org.springframework.boot:spring-boot-starter-redis"
compile "org.springframework.session:spring-session"
compile "org.springframework.cloud:spring-cloud-starter-zuul"
webjars "org.webjars:jquery:$versionJQuery"
webjars "org.webjars:angularjs:$versionAngular"
webjars "org.webjars:bootstrap:$versionBootstrap"
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("junit:junit")
runtime('mysql:mysql-connector-java:5.1.6')
}
task wrapper(type: Wrapper) {
gradleVersion = '2.13'
}

How do I use Spring IO Platform BOM and Spring Boot with Gradle?

So this build.gradle seems to work ok
buildscript {
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
dependencies {
classpath('org.springframework.boot:spring-boot-gradle-plugin:1.2.6.RELEASE')
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'spring-boot'
jar {
baseName = 'entity-api'
version = '0.1.0-SNAPSHOT'
}
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
dependencies {
compile('org.springframework.data:spring-data-commons')
testCompile('junit:junit')
testCompile('org.mockito:mockito-core')
testCompile('nl.jqno.equalsverifier:equalsverifier:1.7.5')
}
I've tried adding what's documented like this
buildscript {
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
dependencies {
classpath('org.springframework.boot:spring-boot-gradle-plugin:1.2.6.RELEASE')
classpath( 'io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE')
}
}
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'spring-boot'
jar {
baseName = 'entity-api'
version = '0.1.0-SNAPSHOT'
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
dependencyManagement {
imports {
mavenBom 'io.spring.platform:platform-bom:1.1.3.RELEASE'
}
}
dependencies {
compile('org.springframework.data:spring-data-commons')
testCompile('junit:junit')
testCompile('org.mockito:mockito-core')
testCompile('nl.jqno.equalsverifier:equalsverifier:1.7.5')
}
but when I do this gradle outputs the following? it's worth saying the auto-conversion from maven doesn't work for me, so I'm learning how to manually convert. How can I fix my gradle build to make use of the spring platform bom?
gradle build --stacktrace slave-vi
FAILURE: Build failed with an exception.
* Where:
Build file '/home/xenoterracide/IdeaProjects/entity-api/build.gradle' line: 13
* What went wrong:
A problem occurred evaluating root project 'entity-api'.
> org/gradle/mvn3/org/apache/maven/model/building/ModelBuildingException
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'entity-api'.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$1.run(DefaultScriptPluginFactory.java:148)
at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:72)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:153)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:38)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:25)
at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:491)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:89)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:42)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.java:126)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:123)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:33)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:100)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:94)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:94)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:77)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:47)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: java.lang.NoClassDefFoundError: org/gradle/mvn3/org/apache/maven/model/building/ModelBuildingException
at io.spring.gradle.dependencymanagement.DependencyManagementPlugin.class$(DependencyManagementPlugin.groovy)
at io.spring.gradle.dependencymanagement.DependencyManagementPlugin.$get$$class$io$spring$gradle$dependencymanagement$maven$EffectiveModelBuilder(DependencyManagementPlugin.groovy)
at io.spring.gradle.dependencymanagement.DependencyManagementPlugin.apply(DependencyManagementPlugin.groovy:79)
at io.spring.gradle.dependencymanagement.DependencyManagementPlugin.apply(DependencyManagementPlugin.groovy)
at org.gradle.api.internal.plugins.ImperativeOnlyPluginApplicator.applyImperative(ImperativeOnlyPluginApplicator.java:35)
at org.gradle.api.internal.plugins.RuleBasedPluginApplicator.applyImperative(RuleBasedPluginApplicator.java:43)
at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:144)
at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:112)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyType(DefaultObjectConfigurationAction.java:112)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:35)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:79)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:135)
at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:46)
at org.gradle.api.plugins.PluginAware$apply.call(Unknown Source)
at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34)
at org.gradle.api.Script$apply$0.callCurrent(Unknown Source)
at build_99h9uwt24qv8u37y4ugf5nxl6.run(/home/xenoterracide/IdeaProjects/entity-api/build.gradle:13)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91)
... 47 more
Caused by: java.lang.ClassNotFoundException: org.gradle.mvn3.org.apache.maven.model.building.ModelBuildingException
... 65 more
BUILD FAILED
Total time: 11.328 secs
There was a breaking API change in Gradle 2.5 that affects the dependency management plugin. Upgrade to the latest version, 0.5.3.RELEASE, which works around the problem.
I've opened an issue to update the Platform's documentation. Thank you for bringing the problem to my attention.

Gradle build,ojdbc6-11.2.0.3

My demo has a Maven-Dependencies ,it contains an ojdbc6.jar.
I want to build a runnable jar with Gradle.
When i run:gradle build in command line.It works well,and create a Test.jar
In build/libs folder.when i run with:java -jar Test.jar. it shows: Unable to load class: oracle.jdbc.OracleDriverclass not found.
Any one can help me out?Thanks a lot!
Caused by: java.lang.ClassNotFoundException: Unable to load class: oracle.jdbc.OracleDriver from ClassLoader:org.springframework.boot.loader.LaunchedURLClass
ssLoader:org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$TcclSafeAggregatedClassLoader#60cbbfcd
at org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:56)
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:268)
... 46 common frames omitted
Caused by: java.lang.ClassNotFoundException: Could not load requested class : oracle.jdbc.OracleDriver
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:230)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$TcclSafeAggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:456)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:38)
I have resolved it!
Download the ojdbc7.jar in F:\
please visit oracle.com to download!
Run "cmd",then input below command:
mvn install:install-file -Dfile=f:\ojdbc7.jar -DgroupId=com.oracle.weblogic -DartifactId=ojdbc7 -
Dversion=12.1.0.2.0 -Dpackaging=jar
If setup success,you will see ojdbc7 in the bellow path:
C:\Users\Administrator.m2\repository\com\oracle\weblogic\ojdbc7\12.1.0.2.0
Here is my build.gradle:
buildscript {
repositories {
mavenCentral()
maven { url "http://repo.spring.io/libs-release" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-
plugin:1.2.4.RELEASE")
}
}
apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: "spring-boot"
jar {
baseName = "Test"
version = "0.1.0"
}
repositories {
mavenCentral()
mavenLocal();
maven { url "http://repo.spring.io/libs-release" }
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("org.springframework.flex:spring-flex-core:1.6.0.RC1")
compile("com.oracle.weblogic:ojdbc7:12.1.0.2.0")
testCompile("org.springframework.boot:spring-boot-starter-test")
}
task wrapper(type: Wrapper) {
gradleVersion = "2.4"
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
The most important is add mavenLocal() to repositories

Resources