question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Manifold cannot compile or run as "Test Sources"

See original GitHub issue

Describe the bug If the directory that Manifold compiles/runs from is marked as a “Test Sources” folder. You will get a ClassCastException: Error:java: java.lang.ClassCastException: manifold.api.fs.jar.JarEntryFileImpl cannot be cast to manifold.api.fs.jar.JarEntryDirectoryImpl

When used as regular source root folder, compilation/run occurs as normal.

To Reproduce Steps to reproduce the behavior:

  1. Create a java class under src/test/java marked as Test Sources Root
  2. Utilize manifold (in my case it was with a .JSON manifold in test resources folder)
  3. Compile test sources

Expected behavior Class(es) compile/run as they would in regular source root folders.

Screenshots If applicable, add screenshots to help explain your problem (drag/drop them here).

Desktop (please complete the following information):

  • OS Type & Version: Mac OS 10.14.5 (18F132)
  • Java/JDK version: 8u212
  • IntelliJ IDEA version: 2019.1.2
  • Manifold version: 0.65
  • Manifold IntelliJ plugin version: 0.65

Stack trace

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:testCompile (default-cli) on project backend: Fatal error compiling
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    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)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1140)
    at org.apache.maven.plugin.compiler.TestCompilerMojo.execute(TestCompilerMojo.java:181)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 21 more
Caused by: org.codehaus.plexus.compiler.CompilerException: java.lang.ClassCastException: manifold.api.fs.jar.JarEntryFileImpl cannot be cast to manifold.api.fs.jar.JarEntryDirectoryImpl
    at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:173)
    at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1129)
    ... 24 more
Caused by: java.lang.RuntimeException: java.lang.ClassCastException: manifold.api.fs.jar.JarEntryFileImpl cannot be cast to manifold.api.fs.jar.JarEntryDirectoryImpl
    at com.sun.tools.javac.main.Main.compile(Main.java:559)
    at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
    at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
    at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
    ... 26 more
Caused by: java.lang.ClassCastException: manifold.api.fs.jar.JarEntryFileImpl cannot be cast to manifold.api.fs.jar.JarEntryDirectoryImpl
    at manifold.api.fs.jar.JarEntryDirectoryImpl.getOrCreateDirectory(JarEntryDirectoryImpl.java:43)
    at manifold.api.fs.jar.JarFileDirectoryImpl.processJarEntry(JarFileDirectoryImpl.java:110)
    at manifold.api.fs.jar.JarFileDirectoryImpl.<init>(JarFileDirectoryImpl.ja```


Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rsmckinneycommented, May 16, 2019

Problem wasn’t so much test v. main sources as it was processing a specific jar file as part of building test sourcers/resources. The sample project you provided (thanks!) has a selenium test dependency jar (I don’t recall the exact name of it) and it had in its META-INF/versions both a directory entry named “9” and a file entry named “9”. My jar file abstraction did not account for this surprise. The fix is available in release 0.68-alpha of both manifold and the ij plugin (plugin available when jetbrains approves the release, probably within a day or two).

0reactions
rsmckinneycommented, May 16, 2019

Fix available in release 0.68-alpha

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Preprocessor for Java - Manifold
First things first, the preprocessor is a javac plugin which means it plugs directly into your Java compiler and runs as part of...
Read more >
Can't use Manifold in gradle java project - Stack Overflow
Your build.gradle is missing the Manifold compiler argument specified above. Copy/Paste the if/else statement dealing with -Xplugin:Manifold ...
Read more >
manifold-systems - Bountysource
Run gradlew build in the project in the description above ... Compiler fail to compile multimodule maven project (without real use of manifold...
Read more >
What is A/B Testing? A Practical Guide With Examples - VWO
Requires the test to run for a set period to get correct data from it but can't figure out how close or far...
Read more >
Fixed! Intake Manifold Runner Stuck Closed (P2006/P2015)
Both are related to an Intake Manifold Runner problem, specifically that it was "stuck closed". This video is a quick session showing how...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found