How do I add dependencies to my custom Gradle plugin? - gradle

I get a NoClassDefFoundError when trying to add a dependency to my custom Gradle plugin, and I haven't found a way to solve it.
Added to the plugin's dependency block:
implementation("org.apache.logging.log4j:log4j-api:2.11.2")
implementation("org.apache.logging.log4j:log4j-core:2.11.2")
Added to the plugin's DeclarationAttributeAltererExtension implementation:
val log = LogManager.getLogger(ReallyAllOpenExtension::class.java)
Here's the full stacktrace:
no.synth.kotlin.plugins.reallyallopen.FunctionalPluginTest > should include plugin via plugins block FAILED
org.gradle.testkit.runner.UnexpectedBuildFailure: Unexpected build execution failure in /var/folders/g4/024g2mzn7jl5s2b2cvg_ythh00016k/T/junit5022572406008108408 with arguments [build]
Output:
> Task :compileKotlin FAILED
e: java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager
at no.synth.kotlin.plugins.reallyallopen.ReallyAllOpenExtension.<clinit>(ReallyAllOpenPlugin.kt:106)
at no.synth.kotlin.plugins.reallyallopen.ReallyAllOpenRegistrar.registerProjectComponents(ReallyAllOpenPlugin.kt:79)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:174)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:123)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:413)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:259)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:124)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:54)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:84)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:42)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:103)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:364)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:105)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:237)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.access$compileIncrementally(IncrementalCompilerRunner.kt:37)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner$compile$2.invoke(IncrementalCompilerRunner.kt:79)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:91)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.execIncrementalCompiler(CompileServiceImpl.kt:597)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.access$execIncrementalCompiler(CompileServiceImpl.kt:102)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:455)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:102)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:1023)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:102)
at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:1065)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:1022)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:454)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.LogManager
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 44 more
The full implementation and test case is in a separate branch at https://github.com/henrik242/kotlin-really-allopen/tree/unable-to-add-dependencies
Recreate the problem by running ./gradlew clean :kotlin-really-allopen:build :kotlin-really-allopen:publishToMavenLocal :functional-test:build

I suspect your problem is because of known classloader issues with plugins exercised with Gradle's TestKit.
I will paraphrase what that link says: Your plugin and its runtime classpath are loaded with one classloader. The functional test and its classpath are loaded in yet a second different classloader. Such a situation is the classic recipe for NoClassDefFoundErrors. Therefore, when using TestKit with a custom plugin, the plugin's runtime classpath must be explicitly injected into the runtime classpath of the functional test that is exercising the plugin.
The way your project is organized — with the functional test as a subproject — is likely to compound those known classloader issues. It certainly makes things more complicated than they need to be.
The answer to your question, therefore, is: Reorganize your project.
Using the Gradle User Guide as a guide, I simplified your project.
I forked and reorganized it the way Gradle advises.
The fixed code is in the able-to-add-dependencies branch of the fork.

Related

ClassNotFound exception when I run my packaged jar, it works when launching it using Idea

The strange thing is that I don't use the missing class DispatchApplication and because I have no error when launching it using idea, so i do not know how to debug it.
I tried to clean idea cache, clean local maven repository, restart my PC
but my colleague can run with a jar, and each of them don't know why this happen and how solve this
D:\projectFolder\midel-data\data-integration\data-integration-service\target>java -jar data-integration-service-1.0.jar
Exception in thread "main" java.lang.ClassNotFoundException: com.lty.dispatch.DispatchApplication
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:46)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
This looks to be an issue with dependencies.
You might want to check your IDE settings if you have explicitly enabled any additional jars in the class path.
Also, check out your pom.xml/.gradle file for any difference in dependency versions.
If this class is part of some custom jar, make sure you include it while packaging your jar.

JDK 11 + JUnit 5 + Jigsaw: Junit fails to run tests for `module-info`

I try to use JUnit 5 in a Gradle project. compileJava and compileTestJava both succeed, but test fails with the strange message Could not execute test class 'module-info'. (message from stacktrace):
> Task :test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///Users/axel/git/utility/build/reports/tests/test/index.html
The test result file hints me that "failed to execute tests", but the stack trace looks weird. It seems JUnit is trying to run the class corresponding to my module-info.java file:
org.gradle.api.internal.tasks.testing.TestSuiteExecutionException: Could not execute test class 'module-info'.
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:53)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:117)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:155)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:137)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NoClassDefFoundError: module-info is not a class because access_flag ACC_MODULE is set
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:801)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:699)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:622)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:398)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.loadClass(JUnitPlatformTestClassProcessor.java:103)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.access$200(JUnitPlatformTestClassProcessor.java:54)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.execute(JUnitPlatformTestClassProcessor.java:82)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.execute(JUnitPlatformTestClassProcessor.java:77)
at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:66)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
... 25 more
versions used:
jin:utility axel$ java -version
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
jin:utility axel$ ./gradlew -version
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/Users/axel/.gradle/wrapper/dists/gradle-4.10.2-bin/cghg6c4gf4vkiutgsab8yrnwv/gradle-4.10.2/lib/groovy-all-2.4.15.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
------------------------------------------------------------
Gradle 4.10.2
------------------------------------------------------------
Build time: 2018-09-19 18:10:15 UTC
Revision: b4d8d5d170bb4ba516e88d7fe5647e2323d791dd
Kotlin DSL: 1.0-rc-6
Kotlin: 1.2.61
Groovy: 2.4.15
Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM: 11 (Oracle Corporation 11+28)
OS: Mac OS X 10.14 x86_64
jin:utility axel$ grep -i junit build.gradle
// JUnit
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
useJUnitPlatform()
Does anyone know how to tell JUnit not to try to run module-info or any other workaround?
Ignoring module-info.class at test-runtime is "Resort to the class-path": https://sormuras.github.io/blog/2018-09-11-testing-in-the-modular-world#resort-to-the-classpath -- your tests may access internal classes as before. All modular boundaries are discarded.
If you want stay in the modular world when doing white box tests, you need to patch your main and test modules into a single one. Either at test compile or test runtime. More information about that test modes can also be found in the blog linked above.
For a Gradle setup you may either use the JUnit ConsoleLauncher manually or re-configure the Gradle runtime paths like described here https://guides.gradle.org/building-java-9-modules/ and/or use https://github.com/zyxist/chainsaw
Works if I add a filter in build.gradle:
test {
useJUnitPlatform()
filter {
exclude '**/module-info.class'
}
}

How to resolve conflict in maven dependencies apache: commons-fileupload 1.3.2 and commons-io 2.5

I have developed an app using jhipster generator. I have only slightly changed the pom.xml file. I needed the commons file-upload to be able to receive multipart requests. I am not sure but i believe that was the only change i have made.
I have only noticed the maven build problems when started trying to build the production image.
My IntelliJ uses bundled maven 2 and it works fine there, but when I switch back to maven 3 bundled or installed in my operating system (windows 7 x64) I receive this error.
Exception in thread "main" 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.apache.maven.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:39)
at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:122)
at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:50)
Caused by: java.lang.NoClassDefFoundError: org/apache/maven/exception/ExceptionHandler
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at org.codehaus.plexus.classworlds.launcher.Launcher.getEnhancedMainMethod(Launcher.java:172)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:268)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
... 7 more
Caused by: java.lang.ClassNotFoundException: org.apache.maven.exception.ExceptionHandler
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 17 more
I believe one of the reasons my be conflict in my dependencies.
Here is snapshot of intelij analysis of my pom.xml.
[edit 1]
I have gave up trying to resolve this error. So what i tried to do now is to generate a new project with jhipster and copy all custom elements that was created by me into it.
And here i stumbled on a problem, which is i cant really do that, uperantly i have upgraded the jhipster-generator package incorrectly somewhere in the past.
So now on freshly generated projects i receive the same error + in my webapp bunch of files has an error like "ng-jhipster has no exported class AlertService" or the same but instead of AlertService its EventManager or some other class but it`s always the same package. Yes tried upgrading it.
I have found similar classes with Jhi prefixes on them in #ngx-jhipster package so it seams to me as as generator uses classes for one version of jhipster and package.json, pom.xml for another.
I tried upgrading the jhipster-generator, yarn and yo, removing the jhipster-generator dependency altogether and adding them back again, and generating projects again. Nothing worked =(

Exception: Multiple service implementations found for interface DeployableContainer when running Arquillian tests

I'm trying to follow the example project "Feedback" from Continuous Enterprise Development in Java, ch. 3 with a bit of modification.
I am using IntelliJ Idea and its JBoss-Forge plugin which shouldn't differ from using the console like in the book.
So far I've created a new project with the following characteristics:
Java 1.8
JEE 7
Wildfly 10.1.0.Final
JUnit 4.12
Arquillian 1.1.13.0
Hibernate
Maven profile: arquillian-wildfly-remote
I've followed every step from the tutorial, all using the IntelliJ plugin:
set ACCEPT_DEFAULTS true
created the project
set up persistence with Hibernate
set up validation with Hibernate validator
created entity FeedbackEntry
scaffolded the UI
forge install-plugin arquillian
set up Arquillian with Wildfly remote container
created an Arquillian
built and deploy the app
All of them ended successfully, I can open the UI and store some values in the DB. The problem comes when trying to run the test: I create an Wildfly Remote Arquillian container:
After clicking OK this is the stacktrace I get:
java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:166)
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:103)
at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:114)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:162)
... 8 more
Caused by: org.jboss.arquillian.container.impl.ContainerCreationException: Could not create Container arquillian-wildfly-remote
at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:85)
at org.jboss.arquillian.container.impl.client.container.ContainerRegistryCreator.createRegistry(ContainerRegistryCreator.java:78)
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.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:85)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:143)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
at org.jboss.arquillian.core.impl.ManagerImpl.bindAndFire(ManagerImpl.java:263)
at org.jboss.arquillian.core.impl.InstanceImpl.set(InstanceImpl.java:74)
at org.jboss.arquillian.config.impl.extension.ConfigurationRegistrar.loadConfiguration(ConfigurationRegistrar.java:73)
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.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:85)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:143)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:114)
at org.jboss.arquillian.core.impl.ManagerImpl.start(ManagerImpl.java:288)
at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(EventTestRunnerAdaptor.java:63)
... 13 more
Caused by: java.lang.IllegalStateException: Multiple service implementations found for interface org.jboss.arquillian.container.spi.client.container.DeployableContainer. org.jboss.as.arquillian.container.remote.RemoteDeployableContainer, org.arquillian.container.chameleon.ChameleonContainer
at org.jboss.arquillian.core.impl.loadable.ServiceRegistryLoader.onlyOne(ServiceRegistryLoader.java:74)
at org.jboss.arquillian.container.impl.LocalContainerRegistry.create(LocalContainerRegistry.java:76)
... 37 more
Test ignored.
Test ignored.
Process finished with exit code 255
I've searched in many places and I only have found this. However I don't think I have more than 1 container, only Wildfly, so I'm completely clueless about this.
Pom and other key files here: https://gist.github.com/josemigallas/a139fc601b022356391fad5b2ec588b0
Why is this failing and how can I solve/workaround this issue?
From my experience, it might be an issue with Arquillian Plugin or IDEA Maven support having troubles with activating the profile. Please make sure that arquillian-wildfly-remote is in fact enabled by default (if it's ticked then untick and tick it again :)). Also run the test using regular JUnit runner, not the Arquillian one.
I think this is a problem when using IntelliJ with Arquillian support. Can you try to run it from CLI?

Gradle not satisfying dependencies?

I'm trying to build this project from github:
https://github.com/tomakehurst/wiremock
The thing is, when I download it and run gradle build, I don't think all the required jar files are being loaded onto the class path. I get this error when I actually try to run the thing:
Exception in thread "main" java.lang.NoClassDefFoundError: joptsimple/OptionParser
at com.github.tomakehurst.wiremock.standalone.CommandLineOptions.<init>(CommandLineOptions.java:75)
at com.github.tomakehurst.wiremock.standalone.WireMockServerRunner.run(WireMockServerRunner.java:49)
at com.github.tomakehurst.wiremock.standalone.WireMockServerRunner.main(WireMockServerRunner.java:110)
Caused by: java.lang.ClassNotFoundException: joptsimple.OptionParser
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 3 more
What gives? Isn't grade supposed to have downloaded this dependency by itself?
Try to execute gradle clean build jarAll
See this github issue for reference
From what I see in the build code, the task jarAll handles the joptsimple classes (and various others)

Resources