Note that there are some explanatory texts on larger screens.

plurals
  1. POEclipse/IVY error indirectly referenced from required .class files
    text
    copied!<p>I am periodically experiencing the <code>"type [blah] cannot be resolved. It is indirectly referenced from required .class files"</code> error, and reaching out for help.</p> <p>I've searched this site and the web, and all of <a href="https://stackoverflow.com/questions/5547162/eclipse-error-indirectly-referenced-from-required-class-files">the</a> <a href="https://stackoverflow.com/questions/7476092/error-in-eclipse-about-type-indirectly-referenced-from-required-class-file">many</a> <a href="https://stackoverflow.com/questions/3464592/getting-the-following-build-error-the-type-cannot-be-resolved-it-is-ind">similar</a>-<a href="https://stackoverflow.com/questions/115971/indirectly-referenced-from-required-class-file">sounding</a> <a href="https://stackoverflow.com/questions/5715033/java-lang-object-can-not-be-resolved-it-is-indirectly-referenced-from-required">questions</a> seem to be resolved by adding classes to the classpath. But in this case, I'm pretty sure they already are on the classpath. </p> <p>Here's the situation, pared down from an extremely large metaproject. There are two eclipse projects ProjectOne and ProjectTwo. </p> <p>Both projects are published by a build server to an Ivy repository, and ProjectTwo's ivy.xml refers to that version of ProjectOne. However, I keep the ivy "resolve dependencies in workspace" preference turned on, so that I can work in both projects, and resolve to my modified classes instead of the published ones.</p> <p>ProjectOne compiles in my workspace (as does ProjectTwo, except (occasionally) for the "indirectly referenced from required .class files" problem.</p> <p>The structure looks basically like this:</p> <pre><code>// ProjectOne class Enum { **// I now suspect this name is the problem** public static class EnumObjectCache { } // ProjectTwo class Bar { **// Occasionally gets error about Enum$EnumObjectcache being unresolvable** } </code></pre> <p>This is despite the facts that:</p> <ol> <li><strong>This only affects Eclipse. The real compiler handles this all with no problem</strong></li> <li>ProjectTwo's ivy.xml file does contain a transitive dependency on ProjectOne. </li> <li>ProjectOne is present in the workspace, and successfully compiles.</li> <li>I always have "resolve dependencies in workspace" turned on.</li> <li>Regardless of how things are resolved, it should work class Enum (and EnumObjectCache) have been unchanged for more than a year.</li> <li>As an experiment, I've tried directly adding ProjectOne to ProjectTwo's classpath (by defining it as a required project). No change.</li> <li>To make this more interesting, this problem doesn't happen all the time, and it only happens to a few classes in this very large codebase. Oh, and when it does happen, it's <em>always</em> on Enum$EnumObjectCache.</li> <li>It doesn't happen to every one of the developers on the team at a time.</li> <li><p>The problem, when it happens, persists over multiple 'clean' and restarts of eclipse, and IVY re-resolves. (though I wasn't doing Ivy clean-all-caches).</p> <p><strong>10. I can "fix" the problem by introducing an otherwise unneccssary import of Enum from ProjectOne</strong></p></li> </ol> <p>Note: I had not previously tried cleaning the cache, as it's painfully slow to do (remote cache is transatlantic, and it's a <em>very</em> large project): 55 minutes to clean all caches and re-resolve, then another 20 or so to rebuild. </p> <p>However, following a clean-all-cache, re-resolve, and rebuild, I still have the same problem.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload