So, I have the following setup in Eclipse (Java):
Upon calling the constructor from project 2 in project 3, I get the following:
"the type {---} cannot be resolved. it is indirectly referenced from required .class files"
If I add a reference to project 1 from project 3, all is well. Is there a way to NOT have to reference project 3 in this way though? It really doesn't make sense to reference it.
I'm using Eclipse (Helios) with the most recent JDK etc...
This is a "transitive dependency". You need on your classpath all classes that are required by any class you use. So you need to have the classes from project 1 in the classpath somehow - you can package them as a .jar
, for example. Or you can go to Build Path > Order and Export
of Project 2, and mark Project 1 as exported.
An important thing here is that the project dependencies are a mere development "goodie" - when you execute the program standalone (or deploy it to container), the Eclipse project dependencies are gone. So you must ensure your dependencies are met.
Not sure if this is what you're looking for. Try this -
Basically, you're exporting the Project1 dependency from project2. So any project that adds project2 as a dependency will see Project1 too without explicitly having to add it to the classpath. Eclipse will transparently do that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With