Unable to compile / run run book-examples in eclipse

I am trying to run sample code “MyHierarchicalUI”
from section 4.2 from “book of vaadin”
and this code refers toTreeExample and TableExample classes which can be found at
http://dev.vaadin.com/svn/doc/book-examples/
I downloaded the book example code from mentioned svn link and imported it as existing eclipse project however when I try to compile / run this project in eclipse I get following error.

Errors occurred during the build. Errors running builder ‘Integrated External Tool Builder’ on project ‘book-examples’. The file does not exist for the external tool named Copy sources. The file does not exist for the external tool named Copy sources.

Hi,

The book-examples project has not really been intended to be used by checking out and importing it, and there may be some issues with the build environment that may not work with simple import, so that sort of use is completely untested. Usually, you just copy&paste the code snippets from the browser to your own project.

The “Copy Sources” builder currently uses GNU Make, which requires it to be installed in /usr/bin/make… I suppose the script should be an Ant script, but for some reason it isn’t, there may have been some reason for that, or maybe not. The builder is only necessary for displaying the source code in the example view.

There could be some class path problems in importing the project as well.

Anyhow, it would of course be good practice if it was possible to import the project more easily. So, there’s now ticket
#13078
for checking that it works.

Hi Marko ,

Thanks for reply, the information was your provided is really helpful.

What I want to accomplish is to use TreeExample and TableExample class to create / generate sample content for Tree / Table UI elements, so is there any easy way to bring all code related to TreeExample and TableExample class to my project intead of manual copy paste?

Regards,
SMA

One way would be to checkout the book-examples project (or just a single source directory) to somewhere under your project tree and then define its sources as an additional source tree in your project settings, in Java Build Path → Sources.

You could also have it as a separate project in Eclipse, which you include in the build path of your project in Java Build Path → Projects.

Thanks Marko, I have tried the suggested approach to bring source from book-examples projects to my project (Link Source Folder), but it fails to compile with following import errors, how can I resolve these import errors?

import javax.portlet.PortletMode;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.ResourceRequest;
import javax.portlet.ResourceResponse;

Here sis copy of my current ivy.xml

<?xml version="1.0"?>
<!DOCTYPE ivy-module [
    <!ENTITY vaadin.version "7.1.9">
]>
<ivy-module version="2.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
    <info organisation="com.example" module="v7proj" />
    <configurations>
        <!-- The default configuration, which should be deployed to the server -->
        <conf name="default" />
        <!-- A configuration only needed when compiling the widget set. Should 
            not be deployed to the server -->
        <conf name="widgetset-compile" />
        <!-- A configuration used in compilation of server side classes only.
            Should be deployed to the server -->
        <conf name="nodeploy" />
    </configurations>
    <dependencies defaultconf="default" defaultconfmapping="default->default">
        <!-- The core server part of Vaadin -->
        <dependency org="com.vaadin" name="vaadin-server" rev="&vaadin.version;" />

        <!-- Vaadin themes -->
        <dependency org="com.vaadin" name="vaadin-themes" rev="&vaadin.version;" />

        <!-- Push support -->
        <dependency org="com.vaadin" name="vaadin-push" rev="&vaadin.version;" />

        <!-- Servlet 3.0 API -->
        <dependency org="javax.servlet" name="javax.servlet-api" rev="3.0.1" conf="nodeploy->default" />

        <!-- Precompiled DefaultWidgetSet -->
        <dependency org="com.vaadin" name="vaadin-client-compiled"
            rev="&vaadin.version;" />

        <!-- Vaadin client side, needed for widget set compilation -->
        <dependency org="com.vaadin" name="vaadin-client" rev="&vaadin.version;"
             conf="widgetset-compile->default" />

        <!-- Compiler for custom widget sets. Should not be deployed -->
        <dependency org="com.vaadin" name="vaadin-client-compiler"
            rev="&vaadin.version;" conf="widgetset-compile->default" />
    </dependencies>
</ivy-module>

The portlet.jar is located under the lib folder in the project. It’s not to be deployed with the WAR.

If you need only certain sources, you could prune all others away in a build script. Or checkout only those source files with Subversion.