How to compile plug-ins referencing external libraries?

Ghostrider
Ghostrider New Altair Community Member
edited November 5 in Community Q&A
I am trying to use the ant build script which was included with the How To Extend RapidMiner tutorial.  I get errors such as these:
 [javac] C:\workspace\RMExtension\src\com\rapidminer\operator\visualization\MainDisplay.java:30: cannot find symbol
    [javac] symbol  : class MyDoggyToolWindowManager
    [javac] location: class com.rapidminer.operator.visualization.MainDisplay
    [javac]        MyDoggyToolWindowManager myDoggyToolWindowManager = new MyDoggyToolWindowManager();
    [javac]        ^
    [javac] C:\workspace\RMExtension\src\com\rapidminer\operator\visualization\MainDisplay.java:30: cannot find symbol
    [javac] symbol  : class MyDoggyToolWindowManager
    [javac] location: class com.rapidminer.operator.visualization.MainDisplay
    [javac]        MyDoggyToolWindowManager myDoggyToolWindowManager = new MyDoggyToolWindowManager();
    [javac]                                                                ^
    [javac] C:\workspace\RMExtension\src\com\rapidminer\operator\visualization\MainDisplay.java:34: cannot find symbol
    [javac] symbol  : class ToolWindow
    [javac] location: class com.rapidminer.operator.visualization.MainDisplay
    [javac]        for (ToolWindow window : toolWindowManager.getToolWindows())
    [javac]              ^
    [javac] 7 errors
    [javac] 4 warnings
The project itself does not show any compile errors in RapidMiner, all java classes build fine.  However, I have 2 other Eclipse Projects linked and I think the issue is that ant tries to build using an unrelated makefile / classpath which does not include these required projects.  What's the easiest way to resolve this?  I'd like to modify my project setup in Eclipse rather than attempt to hack the ant build script if possible.

Answers

  • haddock
    haddock New Altair Community Member
    Hi there,

    I've also run into build problems, but on Vega itself, see the error message in my last post in the CVS tread here. Oh what joy! Can it get any better than this?

  • Ghostrider
    Ghostrider New Altair Community Member
    One work-around is to use Eclipse to Export the dependent project into a JAR file.  Then change build-path to use the JAR instead of the extra project.  Of course, this becomes cumbersome because you have to re-bundle the JAR everytime your dependent project changes.  Is there a way to add another Eclipse project into the ant-build file?  Or better yet, instead of recompiling all the source files everytime ANT is run, is there a way to pull the compiled classes from Eclipse?  Hoping a more-experienced ANT programmer can help us. :-)
  • Ghostrider
    Ghostrider New Altair Community Member
    Alright, I found a solution to my problem that's better than messing around with that arcane ant build-script.  Here's what you do if you want to reference another Eclipse project using your plug-in.  First, export each of the required projects to a JAR file using Eclipse, File -> Export -> Jar File.  Copy / put the JAR files into the lib directory of your rapidminer extension.  The ant-script needs these for compiling.  Then in both the main RapidMiner project (and if you have not already, the RM Extension project) add the dependent projects using Build Path -> Configure Build Path option.  That's it.  The annoyance is that if you are changing the dependent projects, you probably have to recompile the dependent JAR files and place them into the RM_Extension project lib directory every time.  I say probably because although those JAR files will be used when compiling the RM Extension, the dependent class files will actually come directly from the Eclipse project at Runtime.  So for small changes, it might not be necessary to rebuild the dependent JAR files everytime, although I would just in case... 
  • fischer
    fischer New Altair Community Member
    Hi,

    if you use the regular build file, the easiest solution is to just copy your library jars into the "lib" folder in the plugin. The build file will automatically bundle it with the plugin.

    Cheers,
    Simon