IDEA gradle project import: Could not initialize class o.g.i.n.f.FileSystems$DefaultFileSystem

Hello,

I am in the process of upgrading my tools to IDEA 13.0 and gradle 1.10. During gradle import of my project IDEA complaints (see below). I am on FreeBSD 8.3, which works [1] with IDEA 12.x and gradle 1.2.

[1] needed some tweaking with .gradle/native/jna/freebsd-i386/libjnidispatch.so by compiling jna on my system and using the generated libjnidispatch.so in place of shipped one

com.intellij.openapi.externalSystem.model.ExternalSystemException: Could not initialize class org.gradle.internal.nativeplatform.filesystem.FileSystems$DefaultFileSystem
 at org.jetbrains.plugins.gradle.service.project.AbstractProjectImportErrorHandler.createUserFriendlyError(AbstractProjectImportErrorHandler.java:109)
 at org.jetbrains.plugins.gradle.service.project.BaseProjectImportErrorHandler.getUserFriendlyError(BaseProjectImportErrorHandler.java:143)
 at org.jetbrains.plugins.gradle.service.project.BaseGradleProjectResolverExtension.getUserFriendlyError(BaseGradleProjectResolverExtension.java:308)
 at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$1.fun(GradleProjectResolver.java:122)
 at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$1.fun(GradleProjectResolver.java:113)
 at org.jetbrains.plugins.gradle.service.project.GradleExecutionHelper.execute(GradleExecutionHelper.java:199)
 at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:113)
 at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:61)
 at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:41)
 at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:37)
 at com.intellij.openapi.externalSystem.service.remote.AbstractRemoteExternalSystemService.execute(AbstractRemoteExternalSystemService.java:59)
 at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.resolveProjectInfo(RemoteExternalSystemProjectResolverImpl.java:37)
 at com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemProjectResolverWrapper.resolveProjectInfo(ExternalSystemProjectResolverWrapper.java:49)
 at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:48)
 at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:137)
 at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:123)
 at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:471)
 at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$4$1.run(ExternalSystemUtil.java:540)
 at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:464)
 at com.intellij.openapi.progress.impl.ProgressManagerImpl$6.run(ProgressManagerImpl.java:274)
 at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
 at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
 at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
 at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
 at com.intellij.openapi.application.impl.ApplicationImpl$10$1.run(ApplicationImpl.java:658)
 at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:436)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
 at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
 at java.util.concurrent.FutureTask.run(FutureTask.java:166)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
 at java.lang.Thread.run(Thread.java:679)
 at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:153)

Running gradle from the CL gives:

$ .../gradle-1.10/bin/gradle --debug
      09:30:55.554 [DEBUG] [org.gradle.internal.nativeplatform.services.NativeServices] Native-platform is not available.
09:30:55.651 [ERROR] [org.gradle.BuildExceptionReporter]
 09:30:55.655 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
09:30:55.656 [ERROR] [org.gradle.BuildExceptionReporter]
 09:30:55.656 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
09:30:55.659 [ERROR] [org.gradle.BuildExceptionReporter] java.lang.ExceptionInInitializerError (no error message)
09:30:55.663 [ERROR] [org.gradle.BuildExceptionReporter]
 09:30:55.663 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
09:30:55.664 [ERROR] [org.gradle.BuildExceptionReporter] java.lang.ExceptionInInitializerError
09:30:55.664 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.internal.nativeplatform.filesystem.FileSystems.getDefault(FileSystems.java:22)
09:30:55.664 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.initialization.LayoutCommandLineConverter.convert(LayoutCommandLineConverter.java:39)
09:30:55.665 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.cli.BuildActionsFactory.createAction(BuildActionsFactory.java:107)
09:30:55.665 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.createAction(CommandLineActionFactory.java:206)
09:30:55.665 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:196)
09:30:55.666 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
09:30:55.667 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
09:30:55.667 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
09:30:55.668 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
09:30:55.668 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
09:30:55.669 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.Main.doAction(Main.java:46)
09:30:55.669 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
09:30:55.669 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.Main.main(Main.java:37)
09:30:55.670 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
09:30:55.670 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
09:30:55.671 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
09:30:55.671 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.IllegalArgumentException: Unrecognized calling convention: 4
09:30:55.671 [ERROR] [org.gradle.BuildExceptionReporter]
at com.sun.jna.Function.invokeInt(Native Method)
09:30:55.672 [ERROR] [org.gradle.BuildExceptionReporter]
at com.sun.jna.Function.invoke(Function.java:344)
09:30:55.672 [ERROR] [org.gradle.BuildExceptionReporter]
at com.sun.jna.Function.invoke(Function.java:276)
09:30:55.672 [ERROR] [org.gradle.BuildExceptionReporter]
at com.sun.jna.Library$Handler.invoke(Library.java:216)
09:30:55.673 [ERROR] [org.gradle.BuildExceptionReporter]
at $Proxy2.symlink(Unknown Source)
09:30:55.673 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.internal.nativeplatform.filesystem.LibcSymlink.symlink(LibcSymlink.java:35)
09:30:55.673 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.internal.nativeplatform.filesystem.GenericFileSystem.tryCreateSymbolicLink(GenericFileSystem.java:53)
09:30:55.674 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.internal.nativeplatform.filesystem.GenericFileSystem.probeCanCreateSymbolicLink(GenericFileSystem.java:121)
09:30:55.674 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.internal.nativeplatform.filesystem.GenericFileSystem.<init>(GenericFileSystem.java:86)
09:30:55.674 [ERROR] [org.gradle.BuildExceptionReporter]
at org.gradle.internal.nativeplatform.filesystem.FileSystems$DefaultFileSystem.<clinit>(FileSystems.java:30)
09:30:55.675 [ERROR] [org.gradle.BuildExceptionReporter]
... 16 more
09:30:55.675 [ERROR] [org.gradle.BuildExceptionReporter]
 $ ~/apps/gradle-1.10/bin/gradle --debug
 09:31:02.742 [DEBUG] [org.gradle.internal.nativeplatform.services.NativeServices] Native-platform is not available.

Any help appreciated!

Unfortunately, this is still broken since last time you upgraded: http://issues.gradle.org/browse/GRADLE-2551

As a work around, you’ll need to do the same hack, to use the libjnadispatch.so that you compile on the local machine.

To fix this properly, we need to finish porting our native integration to FreeBSD (https://github.com/adammurdoch/native-platform). Would you be interested in helping out?

As a work around, you’ll need to do the same hack, to use the libjnadispatch.so that you compile on the local machine.

Hmm. The one that works for 1.2 is supposed to work for later versions too if the path of native lib has not changed, right? Or is the lib overwritten if a new gradle version is to be used?

To fix this properly, we need to finish porting our native integration to FreeBSD (https://github.com/adammurdoch/native…). Would you be interested in helping out?

I am going to take a look at it.

Thx!

The lib that works for 1.2 should also work for 1.10. It shouldn’t be overwritten if it’s already there.

Adam,

Native-platform’s code compile fails by either using a local gradle 1.10 or project’s gradlew. I tried once again the jna compile trick (now I am on amd64 arch) reported via GRADLE-2551 to no avail this time. The log is here: http://pastebin.com/x2dGRsvc

It already contains reference to freebsd_i386/freebsd_amd64 that is a trace of some attempts I tried, but the error is same without those. This snippet from the error message is strange: “Could not find method targetPlatforms() for arguments”

Do you have any idea how I could get to compile the code? Is this a right place for communication or should I move with my questions to dev list?

Thanks!

I recommend raising this on the dev list.