Creating a stand-alone client:
missing dependencies:
thufir#dur:~/NetBeansProjects/ejbClient$
thufir#dur:~/NetBeansProjects/ejbClient$ gradle runShadow
> Task :runShadow
Nov 06, 2017 11:16:38 AM net.bounceme.dur.ejb.client.App run
INFO: running..
Nov 06, 2017 11:16:38 AM net.bounceme.dur.ejb.client.App run
INFO: {org.omg.CORBA.ORBInitialPort=3700, java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory, Context.SECURITY_CREDENTIALS=pass123, org.omg.CORBA.ORBInitialHost=localhost, Context.SECURITY_PRINCIPAL=user1, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
Nov 06, 2017 11:16:38 AM net.bounceme.dur.ejb.client.App lookup
INFO: looking up jndi
Nov 06, 2017 11:16:38 AM net.bounceme.dur.ejb.client.App lookup
SEVERE: null
javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.enterprise.naming.SerialInitContextFactory [Root exception is java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
at javax.naming.InitialContext.init(InitialContext.java:244)
at javax.naming.InitialContext.<init>(InitialContext.java:192)
at net.bounceme.dur.ejb.client.App.lookup(App.java:30)
at net.bounceme.dur.ejb.client.App.run(App.java:19)
at net.bounceme.dur.ejb.client.App.main(App.java:23)
Caused by: java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:72)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:61)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:672)
... 6 more
BUILD SUCCESSFUL in 1s
6 actionable tasks: 1 executed, 5 up-to-date
thufir#dur:~/NetBeansProjects/ejbClient$
adding erroneous (?) dependencies:
thufir#dur:~/NetBeansProjects/ejbClient$
thufir#dur:~/NetBeansProjects/ejbClient$ gradle clean build
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':compileClasspath'.
> Could not find org.glassfish.external:asm-all:3.3.
Searched in the following locations:
https://repo1.maven.org/maven2/org/glassfish/external/asm-all/3.3/asm-all-3.3.pom
https://repo1.maven.org/maven2/org/glassfish/external/asm-all/3.3/asm-all-3.3.jar
Required by:
project : > org.glassfish.main.appclient:gf-client:4.1 > org.glassfish.main.appclient:gf-client-module:4.1 > org.glassfish.main.ejb:ejb-full-container:4.1 > org.glassfish.main.ejb:ejb-container:4.1
project : > org.glassfish.main.appclient:gf-client:4.1 > org.glassfish.main.appclient:gf-client-module:4.1 > org.glassfish.main.deployment:dol:4.1 > org.glassfish.main.deployment:deployment-common:4.1
project : > org.glassfish.main.appclient:gf-client:4.1 > org.glassfish.main.appclient:gf-client-module:4.1 > org.glassfish.main.security:webservices.security:4.1 > org.glassfish.main.core:kernel:4.1 > org.glassfish.main.flashlight:flashlight-framework:4.1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
2 actionable tasks: 1 executed, 1 up-to-date
thufir#dur:~/NetBeansProjects/ejbClient$
the build.gradle file:
plugins {
id 'com.gradle.build-scan' version '1.8'
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '2.0.1'
}
buildScan {
licenseAgreementUrl = 'https://gradle.com/terms-of-service'
licenseAgree = 'yes'
//publishAlways()
}
configurations {
provided
}
shadowJar {
baseName = 'ejbClient'
classifier = null
version = null
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
mainClassName = 'net.bounceme.dur.ejb.client.App'
repositories {
// jcenter()
mavenCentral()
}
configurations {
provided
}
dependencies {
provided 'javax:javaee-api:7.0'
compile group: 'org.glassfish', name: 'javax.json', version: '1.0.4'
// compile group: 'org.glassfish.main.appclient', name: 'gf-client', version: '4.1'
// compile group: 'org.glassfish.hk2.external', name: 'asm-all-repackaged', version: '2.1.88'
}
what are the dependencies to instantiate javax.name.Context objects? And, how are those depenendencies resolved in gradle?
Finally, trying to get javax.naming:
thufir#dur:~/NetBeansProjects/ejbClient$
thufir#dur:~/NetBeansProjects/ejbClient$ gradle clean runShadow
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':compileClasspath'.
> Could not find org.glassfish:javax.naming:1.0.4.
Searched in the following locations:
https://repo1.maven.org/maven2/org/glassfish/javax.naming/1.0.4/javax.naming-1.0.4.pom
https://repo1.maven.org/maven2/org/glassfish/javax.naming/1.0.4/javax.naming-1.0.4.jar
Required by:
project :
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
2 actionable tasks: 2 executed
thufir#dur:~/NetBeansProjects/ejbClient$
with gradle dependencies as:
dependencies {
provided 'javax:javaee-api:7.0'
compile group: 'org.glassfish', name: 'javax.naming', version: '1.0.4'
}
sorta kinda works:
thufir#dur:~$
thufir#dur:~$ appclient -client NetBeansProjects/ejbClient/build/libs/ejbClient.jar
Nov 06, 2017 12:10:08 PM net.bounceme.dur.ejb.client.App run
INFO: running..
Nov 06, 2017 12:10:08 PM net.bounceme.dur.ejb.client.App run
INFO: {java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
Nov 06, 2017 12:10:08 PM net.bounceme.dur.ejb.client.App lookup
INFO: looking up jndi
thufir#dur:~$
thufir#dur:~$ alias appclient
alias appclient='/home/thufir/GlassFish_Server/glassfish/bin/appclient '
thufir#dur:~$
meh.
Related
with Gradle 6.7 and spotbugs toolVersion 4.1.4. I am getting following error.
looks like I have to exclude some unwanted version, any help?
stack trace
Caused by: org.gradle.api.tasks.TaskInstantiationException: Could not create task of type 'SpotBugsTask'.
at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:97)
at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:84)
at org.gradle.util.GUtil.uncheckedCall(GUtil.java:442)
at org.gradle.api.internal.AbstractTask.injectIntoNewInstance(AbstractTask.java:201)
at org.gradle.api.internal.project.taskfactory.TaskFactory.create(TaskFactory.java:84)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory.create(AnnotationProcessingTaskFactory.java:48)
at org.gradle.api.internal.tasks.DefaultTaskContainer.createTask(DefaultTaskContainer.java:326)
at org.gradle.api.internal.tasks.DefaultTaskContainer.access$200(DefaultTaskContainer.java:77)
at org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreatingProvider.createDomainObject(DefaultTaskContainer.java:701)
at org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreatingProvider.createDomainObject(DefaultTaskContainer.java:658)
at org.gradle.api.internal.DefaultNamedDomainObjectCollection$AbstractDomainObjectCreatingProvider.tryCreate(DefaultNamedDomainObjectCollection.java:941)
... 180 more
Caused by: java.lang.NoSuchMethodError: 'java.lang.Object org.gradle.util.DeprecationLogger.whileDisabled(org.gradle.internal.Factory)'
at com.github.spotbugs.SpotBugsTask.createReports(SpotBugsTask.java:102)
at com.github.spotbugs.SpotBugsTask.<init>(SpotBugsTask.java:98)
at com.github.spotbugs.SpotBugsTask_Decorated.<init>(Unknown Source)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at org.gradle.internal.instantiation.generator.AsmBackedClassGenerator$InvokeConstructorStrategy.newInstance(AsmBackedClassGenerator.java:1969)
at org.gradle.internal.instantiation.generator.AbstractClassGenerator$GeneratedClassImpl$GeneratedConstructorImpl.newInstance(AbstractClassGenerator.java:468)
at org.gradle.internal.instantiation.generator.DependencyInjectingInstantiator.doCreate(DependencyInjectingInstantiator.java:64)
at org.gradle.internal.instantiation.generator.DependencyInjectingInstantiator.newInstanceWithDisplayName(DependencyInjectingInstantiator.java:50)
at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:90)
... 190 more
my build.gradle
buildscript {
dependencies {
..
classpath 'gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.6.0'
..
}
}
apply plugin: 'com.github.spotbugs'
spotbugs {
toolVersion = "4.1.4"
}
tasks.withType(SpotBugsTask) {
xml.enabled = true
html.enabled = false
}
gradel.wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
gradle --version
------------------------------------------------------------
Gradle 6.7
------------------------------------------------------------
Build time: 2020-10-14 16:13:12 UTC
Revision: 312ba9e0f4f8a02d01854d1ed743b79ed996dfd3
Kotlin: 1.3.72
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.8 compiled on May 10 2020
JVM: 15.0.1 (Oracle Corporation 15.0.1+9)
OS: Mac OS X 10.15.7 x86_64
well, i think you should show your build.gradle, otherwise no one can help you.
my build.gradle:
plugins {
id "com.github.spotbugs" version "4.6.0"
}
// To generate an HTML report instead of XML
spotbugsMain {
reports {
xml.enabled = false
html.enabled = true
}
}
for:
------------------------------------------------------------
Gradle 6.6
------------------------------------------------------------
Build time: 2020-08-10 22:06:19 UTC
Revision: d119144684a0c301aea027b79857815659e431b9
Kotlin: 1.3.72
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.8 compiled on May 10 2020
JVM: 14.0.1 (Oracle Corporation 14.0.1+7)
OS: Mac OS X 10.15.7 x86_64
I have clean installed the latest version on IntelliJ and Gradle, ensuring Gradle is correctly set up in my Windows environment (I can run Gradle and build my project successfully through the command line in Windows and IntelliJ).
My issue arrises when I try to get IntelliJ to update the project when I make changes to my build.gradle file (see below). I get the following error and I cannot figure out what's gone wrong. This is a fresh project and fresh install of everything.
Error:
FAILURE: Build failed with an exception.
* Where:
Initialization script 'C:\Users\Kris\AppData\Local\Temp\ijinit.gradle' line: 41
* What went wrong:
A problem occurred evaluating initialization script.
> org/gradle/internal/impldep/com/google/common/collect/Lists
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating initialization script.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$2.run(DefaultScriptPluginFactory.java:237)
at org.gradle.configuration.DefaultScriptTarget.addConfiguration(DefaultScriptTarget.java:74)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:242)
at org.gradle.configuration.BuildOperationScriptPlugin$1$1.run(BuildOperationScriptPlugin.java:69)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
...
Caused by: java.lang.NoClassDefFoundError: org/gradle/internal/impldep/com/google/common/collect/Lists
at org.jetbrains.plugins.gradle.tooling.internal.ExtraModelBuilder.<init>(ExtraModelBuilder.java:55)
at org.jetbrains.plugins.gradle.tooling.internal.ExtraModelBuilder.<init>(ExtraModelBuilder.java:49)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
...
* Get more help at https://help.gradle.org
BUILD FAILED in 104ms
build.gradle:
plugins {
id 'java'
id 'application'
}
sourceCompatibility = 1.8
mainClassName = 'Main'
group 'com.ritcat.cinder'
version '1.0'
jar {
manifest {
attributes 'Main-Class': mainClassName
}
}
repositories {
flatDir {
dirs 'libs'
}
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
compile fileTree(include: ['*.jar'], dir: 'libs')
}
Updated Question
gradle is loading my project's dependency guice-3.0.jar, but guice's dependencies are NOT being loaded by gradle.
guice-3.0.jar > META-INF > DEPENDENCIES (file) has the following content:
// ------------------------------------------------------------------
// Transitive dependencies of this project determined from the
// maven pom organized by organization.
// ------------------------------------------------------------------
Google Guice - Core Library
From: 'an unknown organization'
- AOP alliance (http://aopalliance.sourceforge.net) aopalliance:aopalliance:jar:1.0
License: Public Domain
- javax.inject (http://code.google.com/p/atinject/) javax.inject:javax.inject:jar:1
License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
- CGLIB (http://sourceforge.net/projects/cglib/) org.sonatype.sisu.inject:cglib:jar:2.2.1-v20090111
License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
From: 'ObjectWeb' (http://www.objectweb.org/)
- ASM Core (http://asm.objectweb.org/asm/) asm:asm:jar:3.1
gradle seems to be failing in loading javax.inject. So, I get the error mentioned below.
Work-around
I added guice's dependencies direct into build.gradle of my project.
compile group: 'aopalliance', name: 'aopalliance', version: 1.0
compile group: 'javax.inject', name: 'javax.inject', version: 1
compile group: 'org.sonatype.sisu.inject', name: 'cglib', version: '2.2.1-v20090111'
compile group: 'asm', name: 'asm', version: 3.1
Questions
It works as a hack, but any genuine fixes are required.
Looking at other jars required by my project, they have dependencies defined in META-INF > maven > lib-name-folder-hierarchy > pom.xml, but this guice-3.0.jar has dependencies defined in META-INF > DEPENDENCIES file. Can this different convention cause any issues?
Original Question
For one of my java projects, I performed gradlew --refresh-dependencies, and the project build compileJava task started throwing the following error:
:myproject:compileJava
/<path-to-my-project/MyProvider.java:24: error: cannot access Provider
public class MyProvider<T> implements Provider<T> {
^
class file for javax.inject.Provider not found
An exception has occurred in the compiler (1.8.0_181). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.NullPointerException
at com.sun.tools.javac.comp.Attr.visitTypeParameter(Attr.java:4016)
at com.sun.tools.javac.tree.JCTree$JCTypeParameter.accept(JCTree.java:2224)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:645)
at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:661)
at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4296)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4272)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4201)
at com.sun.tools.javac.comp.Attr.attrib(Attr.java:4176)
at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1248)
at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
at com.sun.tools.javac.main.Main.compile(Main.java:523)
at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:46)
at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:33)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:104)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:53)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:38)
at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:35)
at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:25)
at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:163)
at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:145)
at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:93)
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.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:245)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:221)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:232)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
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)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
:myproject:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':myproject:compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
------------------------------------------------------------
Gradle 2.14.1
------------------------------------------------------------
Build time: 2016-07-18 06:38:37 UTC
Revision: d9e2113d9fb05a5caabba61798bdb8dfdca83719
Groovy: 2.4.4
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_181 (Oracle Corporation 25.181-b13)
OS: Mac OS X 10.12.6 x86_64
It's openJDK.
Well, my team-mates, who haven't performed gradlew --refresh-dependencies are facing no such issues. I don't think it's java compiler issue, but it seems to be gradle issue.
When I check using eclipse, the MyProvider.java refers to com.google.inject.Provider from guice-3.0.jar.
com.google.inject.Provider refers to javax.inject.Provider, and that seems to be not included in the dependencies.
Any solutions to resovle the issue?
Any ways to rollback the refresh-dependencies command?
Any work-arounds?
I performed cleanEclipse, eclipse, upgraded gradle to 3.5, and then downgraded to 2.14.1, but no luck.
The similar issue was reported to java but it was closed as Cannot Reproduce: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8222198 .
Hi I'm new to gradle and java and IJ idea. I am trying to build some java project using gradle. When I run command:
C:\Users\xxx\IdeaProjects\example2>gradle build
The build fails.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileTestJava'.
> Could not resolve all files for configuration ':testCompileClasspath'.
> Could not resolve org.testng:testng:6.14.3.
Required by:
project :
> Could not resolve org.testng:testng:6.14.3.
> Could not get resource 'https://repo.maven.apache.org/maven2/org/testng/testng/6.14.3/testng-6.14.3.pom'.
> Could not GET 'https://repo.maven.apache.org/maven2/org/testng/testng/6.14.3/testng-6.14.3.pom'.
> Received fatal alert: access_denied
Folder IdeaProjects/example2 has fully accesible for all users. When I run the command with --stacktrace option, the last "caused by" is:
... 106 more
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: access_denied
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:396)
Could it be problem with SSL certificate? I'm using proxy to connect to the web.
This is build.gradle file I'm using
plugins {
id 'java'
id 'idea'
}
group 'jetbrains'
version '1.0'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
//testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.testng', name: 'testng', version: '6.14.3'
// https://mvnrepository.com/artifact/io.rest-assured/rest-assured
//compile group: 'io.rest-assured', name: 'rest-assured', version: '3.1.0'
//testCompile group: 'io.rest-assured', name: 'rest-assured', version: '3.1.0'
}
Problem solved, thanks to stackoverflow.com/a/22666646/2987755. Following variables/properties must be set in gradle.properties file.
systemProp.http.proxyHost=$proxy
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=$proxy
systemProp.https.proxyPort=8080
Building a model with gradle in eclipse 4.4.1 (luna) gives me an error:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project '10-VideoServiceWithMongoDB'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:1.0.2.RELEASE.
Required by:
:10-VideoServiceWithMongoDB:unspecified
> org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3.454 secs
running it through a command line through jettyRun I can get more information
* Exception is:
org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':classpath'.
at org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration.rethrowFailure(DefaultLenientConfiguration.java:52)
at org.gradle.api.internal.artifacts.ivyservice.DefaultResolvedConfiguration.rethrowFailure(DefaultResolvedConfiguration.java:36)
at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver$FilesAggregatingResolvedConfiguration.rethrowFailure(SelfResolvingDependencyResolver.java:104)
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver$ErrorHandlingResolvedConfiguration.rethrowFailure(ErrorHandlingArtifactDependencyResolver.java:72)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:461)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getFiles(DefaultConfiguration.java:202)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getFiles(Unknown Source)
at org.gradle.api.internal.initialization.DefaultScriptHandler.updateClassPath(DefaultScriptHandler.java:36)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:118)
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:466)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:77)
at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:23)
at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:21)
at org.gradle.api.internal.Actions$CompositeAction.execute(Actions.java:78)
at org.gradle.api.internal.Actions$TransformingActionAdapter.execute(Actions.java:130)
at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:442)
at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractProject.java:437)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:40)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:38)
at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:39)
at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:25)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
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.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:48)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.Main.main(Main.java:39)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
Caused by: org.gradle.api.internal.artifacts.ivyservice.ModuleVersionResolveException: Could not resolve org.springframework.boot:spring-boot-gradle-plugin:1.0.2.RELEASE.
Required by:
:10-VideoServiceWithMongoDB:unspecified
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain.resolve(UserResolverChain.java:65)
at org.gradle.api.internal.artifacts.ivyservice.clientmodule.ClientModuleResolver.resolve(ClientModuleResolver.java:36)
at org.gradle.api.internal.artifacts.ivyservice.projectmodule.ProjectDependencyResolver.resolve(ProjectDependencyResolver.java:45)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependencyToModuleResolver$StaticVersionResolveResult.resolve(LazyDependencyToModuleResolver.java:91)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$ModuleVersionSelectorResolveState.resolve(DependencyGraphBuilder.java:939)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$DefaultModuleRevisionResolveState.getDescriptor(DependencyGraphBuilder.java:645)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$DependencyEdge.calculateTargetConfigurations(DependencyGraphBuilder.java:329)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$DependencyEdge.attachToTargetConfigurations(DependencyGraphBuilder.java:305)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder.traverseGraph(DependencyGraphBuilder.java:128)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder.resolve(DependencyGraphBuilder.java:64)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver.resolve(DefaultDependencyResolver.java:69)
at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.create(CacheLockingArtifactDependencyResolver.java:36)
at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.create(CacheLockingArtifactDependencyResolver.java:34)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:124)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:130)
at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.useCache(DefaultCacheLockingManager.java:53)
at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver.resolve(CacheLockingArtifactDependencyResolver.java:34)
at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver.resolve(SelfResolvingDependencyResolver.java:39)
at org.gradle.api.internal.artifacts.ivyservice.ShortcircuitEmptyConfigsArtifactDependencyResolver.resolve(ShortcircuitEmptyConfigsArtifactDependencyResolver.java:44)
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.resolve(ErrorHandlingArtifactDependencyResolver.java:37)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveNow(DefaultConfiguration.java:240)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getResolvedConfiguration(DefaultConfiguration.java:230)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getResolvedConfiguration(Unknown Source)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:459)
... 35 more
Caused by: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.debug(SLF4JLocationAwareLog.java:133)
at org.apache.http.client.protocol.RequestAuthCache.process(RequestAuthCache.java:75)
at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:131)
at org.apache.http.protocol.HttpRequestExecutor.preProcess(HttpRequestExecutor.java:165)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:485)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:158)
at org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:139)
at org.gradle.api.internal.externalresource.transport.http.HttpClientHelper.performHttpRequest(HttpClientHelper.java:111)
at org.gradle.api.internal.externalresource.transport.http.HttpClientHelper.executeGetOrHead(HttpClientHelper.java:87)
at org.gradle.api.internal.externalresource.transport.http.HttpClientHelper.performRequest(HttpClientHelper.java:78)
at org.gradle.api.internal.externalresource.transport.http.HttpClientHelper.performRawGet(HttpClientHelper.java:66)
at org.gradle.api.internal.externalresource.transport.http.HttpClientHelper.performGet(HttpClientHelper.java:70)
at org.gradle.api.internal.externalresource.transport.http.HttpResourceAccessor.getResource(HttpResourceAccessor.java:46)
at org.gradle.api.internal.externalresource.transport.http.HttpResourceAccessor.getResource(HttpResourceAccessor.java:32)
at org.gradle.api.internal.externalresource.transfer.ProgressLoggingExternalResourceAccessor.getResource(ProgressLoggingExternalResourceAccessor.java:37)
at org.gradle.api.internal.externalresource.transfer.DefaultCacheAwareExternalResourceAccessor.getResource(DefaultCacheAwareExternalResourceAccessor.java:54)
at org.gradle.api.internal.externalresource.transport.DefaultExternalResourceRepository.getResource(DefaultExternalResourceRepository.java:65)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.getResource(ExternalResourceResolver.java:572)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.findStaticResourceUsingPattern(ExternalResourceResolver.java:455)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.findResourceUsingPattern(ExternalResourceResolver.java:446)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.findResourceUsingPatterns(ExternalResourceResolver.java:368)
at org.gradle.api.internal.artifacts.repositories.resolver.MavenResolver.findIvyFileRef(MavenResolver.java:166)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.getDependency(ExternalResourceResolver.java:156)
at org.gradle.api.internal.artifacts.repositories.resolver.MavenResolver.getDependency(MavenResolver.java:76)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ExternalResourceResolverAdapter.getDependency(ExternalResourceResolverAdapter.java:35)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CacheLockingModuleVersionRepository$1.run(CacheLockingModuleVersionRepository.java:50)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:179)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:232)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:142)
at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.longRunningOperation(DefaultCacheLockingManager.java:49)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CacheLockingModuleVersionRepository.getDependency(CacheLockingModuleVersionRepository.java:48)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleVersionRepository.getDependency(CachingModuleVersionRepository.java:88)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.IvyContextualiser$1.invoke(IvyContextualiser.java:44)
at com.sun.proxy.$Proxy19.getDependency(Unknown Source)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain$RepositoryResolveState.resolve(UserResolverChain.java:185)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain.findLatestModule(UserResolverChain.java:97)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain.findLatestModule(UserResolverChain.java:80)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain.resolve(UserResolverChain.java:54)
I have read [this][1] but after adding the extra lines in my .ini file for eclipse, nothing changed. I have tried changing my java version from 1.8 to 1.6openJDK. I am on Ubuntu 14.
edit
here's the build file
uildscript {
ext {
springBootVersion = '1.0.2.RELEASE'
}
repositories {
maven { url "http://repo.spring.io/libs-snapshot" }
mavenLocal()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.0.2.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'war'
sourceCompatibility = 1.7
targetCompatibility = 1.7
war {
baseName = 'videosvc-mongodb'
version = '0.1.0'
}
repositories {
mavenCentral()
maven { url "http://repo.spring.io/libs-snapshot" }
maven { url "http://maven.springframework.org/milestone" }
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web") {
exclude module: "spring-boot-starter-tomcat"
}
providedRuntime("org.springframework.boot:spring-boot-starter-jetty")
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("org.springframework.boot:spring-boot-starter-aop")
compile("org.springframework.boot:spring-boot-starter-test")
compile("org.springframework.data:spring-data-rest-webmvc")
compile("org.springframework.boot:spring-boot-starter-data-mongodb")
compile("com.google.guava:guava:17.0")
compile("com.squareup.retrofit:retrofit:1.6.0")
compile("commons-io:commons-io:2.4")
testCompile("junit:junit")
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}
When I try to refresh the Gradle dependecy by running gradle -refresh--dependencies in the apps folder I get a new fun error:
FAILURE: Build failed with an exception.
* Where:
Build file '/home/jake/mobilecloud-14/examples/10-VideoServiceWithMongoDB/build.gradle' line: 17
* What went wrong:
A problem occurred evaluating root project '10-VideoServiceWithMongoDB'.
> org.gradle.api.tasks.TaskContainer.create(Ljava/lang/String;Ljava/lang/Class;)Lorg/gradle/api/Task;
[1]: http://stackoverflow.com/questions/26085045/error-at-building-model-of-new-gradle-project-for-libgdx
Okay, so apparently Gradle didn't like my java build. I switched it to java-7-oracle by using this method