I have imported apache nutch from http://svn.apache.org/repos/asf/nutch/trunk/ through SVN on eclipse; however, the project I have imported has 10k+ java errors:
Some errors are due to source files being in a package different from what is specified in their source, (e.g. classes in java.org.apache... but it is declared in source that they should be in org.apache..., this is observed in many other packages)
Unimported classes, for example the Class "Context" is used in many of the classes however when looking at the import list, "Context" is not declared there.
Missing classes, though imported, classes still not resolved to a type, most probably because my imported project lacks many of the needed libraries such as hadoop,gora,witty,etc.
(Not familiar with this) Bound mismatch errors like: The generic method createDataStore(Configuration, Class, Class) of type StorageUtils is not applicable for the arguments (Configuration, Class, Class). The inferred type WebPage is not a valid substitute for the bounded parameter
What is the correct way of importing a nutch through eclipse without encountering the errors specified above? Thanks!
Refer to http://wiki.apache.org/nutch/RunNutchInEclipse
These should be followed to the "T" and it works fine.
Specially, pay attention to the manual configuration of the build paths for the plugins.
You may also notice that some library dependancies are not set even after setting the build path,within certain plugins. .. you will need to manually add the ivey dependancies for these plugins into the build patch as well.
Related
I am trying to build a dynamic web project - if I add the Tomcat as a dependency, it does compile just fine. However, I have run into a peculiar situation that doesn't resolve properly.
Obviously I have many references to servlet-api.jar in my code for things like HttpServlet. Eclipse complains that it can't find HttpServlet and yet when I ctrl+click HttpServlet it recognizes that it lives in c:\programs\tomcat\lib\servlet-api.jar - how can it know that it's there during editing and yet not during build/compile/export?
Ctrl+Click works by different rules. Because of the way the type indexing works, it doesn't attempt to fully qualify the type you're hovering over if the reference is not already fully qualified, so it will still match types of the same name in different packages. It's faster, and usually doesn't cause confusion.
I occasionally get name clash errors in a java project built with Jenkins.
I've seen it in a couple places, and it both places it follows the following format:
public class Foo {
public enum FooEnum {
VALUE1("Val1"),
VALUE2("Val2)
private FooEnum(String) { /*code*/}
}
}
And the error output would say:
[javac] /path/Foo.java:6: error: name clash: FooEnum(String) and FooEnum(String) have the same erasure
[javac] private FooEnum(String)
^
Note that there is only one method named FooEnum, so its not a case of type erasure issues or anything like that. The method seems to be somehow conflicting with itself.
I develop the code in Eclipse and my codebase spans multiple Eclipse projects in the same workspace. For my Jenkin's pipeline, I have a job for each Eclipse project.
When each project finishes, it archives the whole project directory (which includes the source and the .class files). Downstream projects then copy the archived objects from the previous builds so that they can use them as dependencies.
I am using ant build.xml files which are auto-generated from eclipse.
These errors don't show up super often, but when they do, they usually persist for a few builds and then go away. I have not been able to figure out any pattern indicating when they occur and when they don't.
I have never had any issues when building within Eclipse, so I think the issue must have more to do with my Jenkins setup or the build files.
Unfortunately, do to my companies strict proprietary information protection policies, I'm a little apprehensive about sharing any actual code or actual ant files here, but I was hoping someone would have an idea they could share with me.
I was able to fix this by explicitly copying in the dependency projects required for each job and making sure that I only copied in those projects.
Previously, I would sometimes copy in all of the artifacts from a few jobs that had the dependencies I needed. I think that something weird was happening in the cases where a dependency was found in multiple jobs that I copied in. I still haven't figured out exactly what's going on, but this seems to have fixed it.
I have a java project in eclipse and following compile error "The type Vector is not a generic. ...."
I know this error is comming if there are several compiler level/version settings are wrong.
I have added to the build path the JDK1.8:
Also in the Compiler settings I have set Version 1.8:
And last but not least I have also set the correct Java version (1.8) in the Project Facets:
May be I'm blind but where is the project settings with the wrong Java version ....
As I have written in a comment I have "reactivate" a project which is very old ... Not a good idea! Part of the project are also the cldcapi11.zip (which is a jar with a ".zip" suffix) and the midpapi20.jar. Parts of these both jar's also some JDK classes like java.util.Vector and java.util.Timer and some more. For compiling the stuff I must remove both jar's or put both jar's behind the JDK8 library ...
ARRRGH! Who collects official JDK classes in his jar file?!? Not nice...
You can use a "shade" job to move the non-generic JDK Collection classes to a different package (such as backport.java.util.Vector) and update the references in the cldcapi11/midpapi20 jars. This will give you new cldcapi11-shaded and midpapi20-shaded jars that you can include in your apps.
Agreed on the "ARRRGH!"! It's annoying to have to rebuild others' incorrectly built artifacts.
I'm building a plugin to extend the Eclipse BPEL Designer. That plugin is supposed to allow users to add meta information to certain model elements via EAnnotations. I already did the same thing for a BPMN model and it work just finde but when doing this for the BPEL designer I reveive rather strange exceptions.
The first I thing realized when trying to extend the BPEL Designer was that the designers plugins are defined in an unusual package structure. Instead of org.eclipse.bpel.xxx they have a "bin" in front of all package names. When I'm trying to import some of the designers classes I therefore have to refernce the bin path to make it work. However all the examples I was able to find just imported classes from the ordinary package structure.
Most of the time importing classes with the bin in front of the package name worked fine for me but every now and then I receive a strange error message. The message is in the form of: The type org.eclipse.bpel.xxx cannot be resolved. It is indirectly referenced from required .class files
It seems that Eclipse somehow can't find certain classes. I'm stuck at this point for over a week now and don't find any solution. From my point of view the problem has to be seen in the BPEL Designer plugins. Inside those plugins they reference classes in the form of org.eclipse.bpel.xxx but as I said when I reference those plugins their classes are inside packages with a "bin" in front of the normal package name. Could that be an explanation why certain classes can't be referenced by Eclipse and I get those strange error messages?
I'd appreciate any new ideas about that problem and hope that somwebody can give me an advice to solve that problem.
Cheers
Stefan
I already encountered in the past such troubles ...
I think there is a problem with the export/import of the BPEL Designer plugin.
How did you get this plugin ? Are you working with binary plugin or plugin imported as source in your SDk ?
Try to get again this plugin, may be an other version, or from an other source .. an update site.
I really think these "bin" packages/folders should not be here
Hope this can help ...
I've trying to use Eclipse JDT AST parsing classes. After including the initial JAR, and sorting out a couple more dependencies, it is with 7+ JARs and I still having NoClassDefFoundError exceptions. This situation arises whenever I'm trying to test libraries with little or no documentation. Trial and error seems a very dumb (and annoying) approach to solve this problem.
Is there a way to automatically sort this out using Eclipse?
Update: Later I found that adding all the JARs you have, and using Ctrl-T (to view/locate types), lets you manually locate the JAR. That was the solution that Google provided so far. Is there a better way?
If you refer to this SO question Finding unused jars used in an eclipse project, you also have:
ClassPathHelper, which can quickly focus on unresolved classes:
It automatically identifies orphan jars, blocked (obscured) classes, and much more.
The only limit is dependencies that are not defined in classes, e.g. in dependency injection framework configuration files.
I have found setting up a workspace exclusively for browsing the eclipse source code incredibly useful. In this manner, you can use PDE tools like the Plug-in Spy, bundle dependency analysis, browsing the documentation, etc much like you would your own plugin projects. I found this article at Vogella a very useful guide.
If you know which bundle your desired class is you can generate the transitive closure of dependencies by creating a new OSGi launch configuration, with just the single bundle selected. By hitting the Add Required button, you can see all bundles necessary to use the one you're interested in.
Edit:
From your question it wasn't clear as to the environment you want to run the compiler in. If you're interested in an embeddable Java compiler to be run outside of an OSGi environment, may I suggest Janino.
You could use a dependency analyzer like:
JarAnalyzer
This will parse a directory full of Jars and give you an XML output dependency map, for which there are several tools for displaying in either graphical or text form.